67 lines · plain
1; RUN: opt -S -passes=consthoist < %s | FileCheck %s2target datalayout = "E-m:e-i64:64-n32:64"3target triple = "powerpc64-unknown-linux-gnu"4 5; Here the masks are all contiguous, and should not be hoisted.6define i32 @test1(i1 %arg) nounwind {7entry:8; CHECK-LABEL: @test19; CHECK-NOT: bitcast i32 65535 to i3210; CHECK: and i32 undef, 6553511 %conv121 = and i32 undef, 6553512 br i1 %arg, label %if.then152, label %if.end16713 14if.then152:15; CHECK: and i32 undef, 6553516 %conv153 = and i32 undef, 6553517 br i1 %arg, label %if.end167, label %end218 19if.end167:20; CHECK: and i32 {{.*}}, 3276821 %shl161 = shl nuw nsw i32 %conv121, 1522 %0 = load i8, ptr undef, align 123 %conv169 = zext i8 %0 to i3224 %shl170 = shl nuw nsw i32 %conv169, 725 %shl161.masked = and i32 %shl161, 3276826 %conv174 = or i32 %shl170, %shl161.masked27 %cmp178 = icmp ugt i32 %conv174, 3276728 br i1 %cmp178, label %end1, label %end229 30end1:31 unreachable32 33end2:34 unreachable35}36 37; Here the masks are not contiguous, and should be hoisted.38define i32 @test2(i1 %arg) nounwind {39entry:40; CHECK-LABEL: @test241; CHECK: bitcast i32 65531 to i3242 %conv121 = and i32 undef, 6553143 br i1 %arg, label %if.then152, label %if.end16744 45if.then152:46 %conv153 = and i32 undef, 6553147 br i1 %arg, label %if.end167, label %end248 49if.end167:50; CHECK: add i32 {{.*}}, -3275851 %shl161 = shl nuw nsw i32 %conv121, 1552 %0 = load i8, ptr undef, align 153 %conv169 = zext i8 %0 to i3254 %shl170 = shl nuw nsw i32 %conv169, 755 %shl161.masked = and i32 %shl161, 3277356 %conv174 = or i32 %shl170, %shl161.masked57 %cmp178 = icmp ugt i32 %conv174, 3276758 br i1 %cmp178, label %end1, label %end259 60end1:61 unreachable62 63end2:64 unreachable65}66 67