1 ; RUN: opt -S -instcombine < %s | FileCheck %s 2 3 ; In PR20059 ( http://llvm.org/pr20059 ), shufflevector operations are reordered/removed 4 ; for an srem operation. This is not a valid optimization because it may cause a trap 5 ; on div-by-zero. 6 7 ; CHECK-LABEL: @do_not_reorder 8 ; CHECK: %splat1 = shufflevector <4 x i32> %p1, <4 x i32> undef, <4 x i32> zeroinitializer 9 ; CHECK-NEXT: %splat2 = shufflevector <4 x i32> %p2, <4 x i32> undef, <4 x i32> zeroinitializer 10 ; CHECK-NEXT: %retval = srem <4 x i32> %splat1, %splat2 11 define <4 x i32> @do_not_reorder(<4 x i32> %p1, <4 x i32> %p2) { 12 %splat1 = shufflevector <4 x i32> %p1, <4 x i32> undef, <4 x i32> zeroinitializer 13 %splat2 = shufflevector <4 x i32> %p2, <4 x i32> undef, <4 x i32> zeroinitializer 14 %retval = srem <4 x i32> %splat1, %splat2 15 ret <4 x i32> %retval 16 } 17