1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Verify that DAGCombiner does not crash when checking if it is 4*9880d681SAndroid Build Coastguard Worker; safe to fold the shuffles in function @sample_test according to rule 5*9880d681SAndroid Build Coastguard Worker; (shuffle (shuffle A, Undef, M0), Undef, M1) -> (shuffle A, Undef, M2) 6*9880d681SAndroid Build Coastguard Worker; 7*9880d681SAndroid Build Coastguard Worker; The DAGCombiner avoids folding shuffles if 8*9880d681SAndroid Build Coastguard Worker; the resulting shuffle dag node is not legal for the target. 9*9880d681SAndroid Build Coastguard Worker; That means, the shuffle must have legal type and legal mask. 10*9880d681SAndroid Build Coastguard Worker; 11*9880d681SAndroid Build Coastguard Worker; Before, the DAGCombiner forgot to check if the resulting shuffle 12*9880d681SAndroid Build Coastguard Worker; was legal. It instead just called method 13*9880d681SAndroid Build Coastguard Worker; 'X86TargetLowering::isShuffleMaskLegal'; however, that was not enough since 14*9880d681SAndroid Build Coastguard Worker; that method always expect to have a valid vector type in input. 15*9880d681SAndroid Build Coastguard Worker; As a consequence, compiling the function below would have caused a crash. 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdefine void @sample_test() { 18*9880d681SAndroid Build Coastguard Worker br i1 undef, label %5, label %1 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; <label>:1 ; preds = %0 21*9880d681SAndroid Build Coastguard Worker %2 = load <4 x i8>, <4 x i8>* undef 22*9880d681SAndroid Build Coastguard Worker %3 = shufflevector <4 x i8> %2, <4 x i8> undef, <4 x i32> <i32 2, i32 2, i32 0, i32 0> 23*9880d681SAndroid Build Coastguard Worker %4 = shufflevector <4 x i8> %3, <4 x i8> undef, <4 x i32> <i32 2, i32 3, i32 0, i32 1> 24*9880d681SAndroid Build Coastguard Worker store <4 x i8> %4, <4 x i8>* undef 25*9880d681SAndroid Build Coastguard Worker br label %5 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker; <label>:5 ; preds = %1, %0 28*9880d681SAndroid Build Coastguard Worker ret void 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31