Index: lib/Target/ARM/ARMTargetTransformInfo.cpp =================================================================== --- lib/Target/ARM/ARMTargetTransformInfo.cpp +++ lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -19,7 +19,7 @@ assert(Ty->isIntegerTy()); unsigned Bits = Ty->getPrimitiveSizeInBits(); - if (Bits == 0 || Bits > 64) + if (Bits == 0 || Imm.getActiveBits() > 64) return 4; int64_t SImmVal = Imm.getSExtValue(); Index: test/Transforms/ConstantHoisting/ARM/bad-cases.ll =================================================================== --- test/Transforms/ConstantHoisting/ARM/bad-cases.ll +++ test/Transforms/ConstantHoisting/ARM/bad-cases.ll @@ -90,3 +90,29 @@ end: ret void } + +%mystruct = type { [12 x i8] } + +define i32 @struct_type_test(%mystruct* %v0, %mystruct* %v1) { +;CHECK-LABEL: @struct_type_test +entry: +;CHECK-NOT: %const = bitcast i96 32 to i96 + %v2 = bitcast %mystruct* %v1 to i96* + %load0 = load i96, i96* %v2, align 4 + %v3 = bitcast %mystruct* %v0 to i96* + %load1 = load i96, i96* %v3, align 4 +;CHECK: lshr0 = lshr i96 %load0, 32 + %lshr0 = lshr i96 %load0, 32 + %cast0 = trunc i96 %lshr0 to i32 +;lshr1 = lshr i96 %load1, 32 + %lshr1 = lshr i96 %load1, 32 + %cast1 = trunc i96 %lshr1 to i32 + %cmp = icmp eq i32 %cast0, %cast1 + br i1 %cmp, label %if.then, label %if.else + +if.then: + ret i32 1 + +if.else: + ret i32 2; +}