1; RUN: opt -S -consthoist < %s | FileCheck %s 2target 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() nounwind { 7entry: 8; CHECK-LABEL: @test1 9; CHECK-NOT: bitcast i32 65535 to i32 10; CHECK: and i32 undef, 65535 11 %conv121 = and i32 undef, 65535 12 br i1 undef, label %if.then152, label %if.end167 13 14if.then152: 15; CHECK: and i32 undef, 65535 16 %conv153 = and i32 undef, 65535 17 br i1 undef, label %if.end167, label %end2 18 19if.end167: 20; CHECK: and i32 {{.*}}, 32768 21 %shl161 = shl nuw nsw i32 %conv121, 15 22 %0 = load i8, i8* undef, align 1 23 %conv169 = zext i8 %0 to i32 24 %shl170 = shl nuw nsw i32 %conv169, 7 25 %shl161.masked = and i32 %shl161, 32768 26 %conv174 = or i32 %shl170, %shl161.masked 27 %cmp178 = icmp ugt i32 %conv174, 32767 28 br i1 %cmp178, label %end1, label %end2 29 30end1: 31 unreachable 32 33end2: 34 unreachable 35} 36 37; Here the masks are not contiguous, and should be hoisted. 38define i32 @test2() nounwind { 39entry: 40; CHECK-LABEL: @test2 41; CHECK: bitcast i32 65531 to i32 42 %conv121 = and i32 undef, 65531 43 br i1 undef, label %if.then152, label %if.end167 44 45if.then152: 46 %conv153 = and i32 undef, 65531 47 br i1 undef, label %if.end167, label %end2 48 49if.end167: 50; CHECK: add i32 {{.*}}, -32758 51 %shl161 = shl nuw nsw i32 %conv121, 15 52 %0 = load i8, i8* undef, align 1 53 %conv169 = zext i8 %0 to i32 54 %shl170 = shl nuw nsw i32 %conv169, 7 55 %shl161.masked = and i32 %shl161, 32773 56 %conv174 = or i32 %shl170, %shl161.masked 57 %cmp178 = icmp ugt i32 %conv174, 32767 58 br i1 %cmp178, label %end1, label %end2 59 60end1: 61 unreachable 62 63end2: 64 unreachable 65} 66 67