1; RUN: opt -gvn-hoist -S < %s | FileCheck %s 2 3; Check that urem is not hoisted. 4; CHECK-LABEL: @main 5; CHECK: urem 6; CHECK: urem 7; CHECK: urem 8 9@g_x_s = global i32 -470211272, align 4 10@g_z_s = global i32 2007237709, align 4 11@g_x_u = global i32 282475249, align 4 12@g_z_u = global i32 984943658, align 4 13@g_m = global i32 16807, align 4 14@res = common global i32 0, align 4 15 16; Function Attrs: 17define i64 @func() #0 { 18entry: 19 ret i64 1 20} 21 22; Function Attrs: 23define i32 @main() { 24entry: 25 %0 = load volatile i32, i32* @g_x_s, align 4 26 %1 = load volatile i32, i32* @g_z_s, align 4 27 %2 = load volatile i32, i32* @g_x_u, align 4 28 %3 = load volatile i32, i32* @g_z_u, align 4 29 %4 = load volatile i32, i32* @g_m, align 4 30 %call = call i64 @func() #4 31 %conv = sext i32 %1 to i64 32 %cmp = icmp ne i64 %call, %conv 33 br i1 %cmp, label %if.end, label %lor.lhs.false 34 35lor.lhs.false: 36 %div = udiv i32 %4, %1 37 %rem = urem i32 %0, %div 38 %cmp2 = icmp eq i32 %rem, 0 39 br i1 %cmp2, label %if.end, label %if.then 40 41if.then: 42 br label %cleanup 43 44if.end: 45 %call4 = call i64 @func() #4 46 %conv5 = zext i32 %3 to i64 47 %cmp6 = icmp ne i64 %call4, %conv5 48 br i1 %cmp6, label %if.end14, label %lor.lhs.false8 49 50lor.lhs.false8: 51 %div9 = udiv i32 %4, %3 52 %rem10 = urem i32 %0, %div9 53 %cmp11 = icmp eq i32 %rem10, 0 54 br i1 %cmp11, label %if.end14, label %if.then13 55 56if.then13: 57 br label %cleanup 58 59if.end14: 60 %call15 = call i64 @func() #4 61 %cmp17 = icmp ne i64 %call15, %conv 62 br i1 %cmp17, label %if.end25, label %lor.lhs.false19 63 64lor.lhs.false19: 65 %div20 = udiv i32 %4, %1 66 %rem21 = urem i32 %0, %div20 67 %cmp22 = icmp eq i32 %rem21, 0 68 br i1 %cmp22, label %if.end25, label %if.then24 69 70if.then24: 71 br label %cleanup 72 73if.end25: 74 br label %cleanup 75 76cleanup: 77 %retval.0 = phi i32 [ 0, %if.end25 ], [ 1, %if.then24 ], [ 1, %if.then13 ], [ 1, %if.then ] 78 ret i32 %retval.0 79} 80 81attributes #0 = { minsize noinline nounwind optsize uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 82