93 lines · plain
1; RUN: opt -O3 -S < %s | FileCheck %s2; XFAIL: *3 4declare i32 @doo(...)5 6; PR6627 - This whole nasty sequence should be flattened down to a single7; 32-bit comparison.8define void @test2(ptr %arrayidx) nounwind ssp {9entry:10 %x1 = load i32, ptr %arrayidx, align 411 %tmp = trunc i32 %x1 to i812 %conv = zext i8 %tmp to i3213 %cmp = icmp eq i32 %conv, 12714 br i1 %cmp, label %land.lhs.true, label %if.end15 16land.lhs.true: ; preds = %entry17 %arrayidx4 = getelementptr inbounds i8, ptr %arrayidx, i64 118 %tmp5 = load i8, ptr %arrayidx4, align 119 %conv6 = zext i8 %tmp5 to i3220 %cmp7 = icmp eq i32 %conv6, 6921 br i1 %cmp7, label %land.lhs.true9, label %if.end22 23land.lhs.true9: ; preds = %land.lhs.true24 %arrayidx12 = getelementptr inbounds i8, ptr %arrayidx, i64 225 %tmp13 = load i8, ptr %arrayidx12, align 126 %conv14 = zext i8 %tmp13 to i3227 %cmp15 = icmp eq i32 %conv14, 7628 br i1 %cmp15, label %land.lhs.true17, label %if.end29 30land.lhs.true17: ; preds = %land.lhs.true931 %arrayidx20 = getelementptr inbounds i8, ptr %arrayidx, i64 332 %tmp21 = load i8, ptr %arrayidx20, align 133 %conv22 = zext i8 %tmp21 to i3234 %cmp23 = icmp eq i32 %conv22, 7035 br i1 %cmp23, label %if.then, label %if.end36 37if.then: ; preds = %land.lhs.true1738 %call25 = call i32 (...) @doo()39 br label %if.end40 41if.end:42 ret void43 44; CHECK-LABEL: @test2(45; CHECK: %x1 = load i32, ptr %arrayidx, align 446; CHECK-NEXT: icmp eq i32 %x1, 117940364747; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end 48}49 50; PR6627 - This should all be flattened down to one compare. This is the same51; as test2, except that the initial load is done as an i8 instead of i32, thus52; requiring widening.53define void @test2a(ptr %arrayidx) nounwind ssp {54entry:55 %x1 = load i8, ptr %arrayidx, align 456 %conv = zext i8 %x1 to i3257 %cmp = icmp eq i32 %conv, 12758 br i1 %cmp, label %land.lhs.true, label %if.end59 60land.lhs.true: ; preds = %entry61 %arrayidx4 = getelementptr inbounds i8, ptr %arrayidx, i64 162 %tmp5 = load i8, ptr %arrayidx4, align 163 %conv6 = zext i8 %tmp5 to i3264 %cmp7 = icmp eq i32 %conv6, 6965 br i1 %cmp7, label %land.lhs.true9, label %if.end66 67land.lhs.true9: ; preds = %land.lhs.true68 %arrayidx12 = getelementptr inbounds i8, ptr %arrayidx, i64 269 %tmp13 = load i8, ptr %arrayidx12, align 170 %conv14 = zext i8 %tmp13 to i3271 %cmp15 = icmp eq i32 %conv14, 7672 br i1 %cmp15, label %land.lhs.true17, label %if.end73 74land.lhs.true17: ; preds = %land.lhs.true975 %arrayidx20 = getelementptr inbounds i8, ptr %arrayidx, i64 376 %tmp21 = load i8, ptr %arrayidx20, align 177 %conv22 = zext i8 %tmp21 to i3278 %cmp23 = icmp eq i32 %conv22, 7079 br i1 %cmp23, label %if.then, label %if.end80 81if.then: ; preds = %land.lhs.true1782 %call25 = call i32 (...) @doo()83 br label %if.end84 85if.end:86 ret void87 88; CHECK-LABEL: @test2a(89; CHECK: %x1 = load i32, ptr {{.*}}, align 490; CHECK-NEXT: icmp eq i32 %x1, 117940364791; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end 92}93