forked from OSchip/llvm-project
LowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initialization out of if statement.
llvm-svn: 292674
This commit is contained in:
parent
18de36bc90
commit
67addbcacf
|
@ -602,8 +602,7 @@ Value *LowerTypeTestsModule::lowerTypeTestCall(Metadata *TypeId, CallInst *CI,
|
|||
IntPtrTy));
|
||||
Value *BitOffset = B.CreateOr(OffsetSHR, OffsetSHL);
|
||||
|
||||
Constant *BitSizeConst = ConstantExpr::getZExtOrBitCast(TIL.SizeM1, IntPtrTy);
|
||||
Value *OffsetInRange = B.CreateICmpULE(BitOffset, BitSizeConst);
|
||||
Value *OffsetInRange = B.CreateICmpULE(BitOffset, TIL.SizeM1);
|
||||
|
||||
// If the bit set is all ones, testing against it is unnecessary.
|
||||
if (TIL.TheKind == TypeTestResolution::AllOnes)
|
||||
|
@ -832,14 +831,12 @@ void LowerTypeTestsModule::lowerTypeTestCalls(
|
|||
TIL.OffsetedGlobal = ConstantExpr::getGetElementPtr(
|
||||
Int8Ty, CombinedGlobalAddr, ConstantInt::get(IntPtrTy, BSI.ByteOffset)),
|
||||
TIL.AlignLog2 = ConstantInt::get(Int8Ty, BSI.AlignLog2);
|
||||
TIL.SizeM1 = ConstantInt::get(IntPtrTy, BSI.BitSize - 1);
|
||||
if (BSI.isAllOnes()) {
|
||||
TIL.TheKind = (BSI.BitSize == 1) ? TypeTestResolution::Single
|
||||
: TypeTestResolution::AllOnes;
|
||||
TIL.SizeM1 = ConstantInt::get((BSI.BitSize <= 128) ? Int8Ty : Int32Ty,
|
||||
BSI.BitSize - 1);
|
||||
} else if (BSI.BitSize <= 64) {
|
||||
TIL.TheKind = TypeTestResolution::Inline;
|
||||
TIL.SizeM1 = ConstantInt::get(Int8Ty, BSI.BitSize - 1);
|
||||
uint64_t InlineBits = 0;
|
||||
for (auto Bit : BSI.Bits)
|
||||
InlineBits |= uint64_t(1) << Bit;
|
||||
|
@ -850,8 +847,6 @@ void LowerTypeTestsModule::lowerTypeTestCalls(
|
|||
(BSI.BitSize <= 32) ? Int32Ty : Int64Ty, InlineBits);
|
||||
} else {
|
||||
TIL.TheKind = TypeTestResolution::ByteArray;
|
||||
TIL.SizeM1 = ConstantInt::get((BSI.BitSize <= 128) ? Int8Ty : Int32Ty,
|
||||
BSI.BitSize - 1);
|
||||
++NumByteArraysCreated;
|
||||
ByteArrayInfo *BAI = createByteArray(BSI);
|
||||
TIL.TheByteArray = BAI->ByteArray;
|
||||
|
|
|
@ -140,11 +140,11 @@
|
|||
|
||||
; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0)
|
||||
; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i8 1 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 1 to i8*)
|
||||
|
||||
; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4)
|
||||
; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i32 128 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 128 to i8*)
|
||||
|
||||
; CHECK: @foo = alias [2048 x i8], getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0)
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
|
||||
; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0)
|
||||
; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i8 65 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 65 to i8*)
|
||||
; CHECK: @__typeid_typeid1_byte_array = hidden alias i8, i8* @bits.1
|
||||
; CHECK: @__typeid_typeid1_bit_mask = hidden alias i8, inttoptr (i8 2 to i8*)
|
||||
|
||||
; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4)
|
||||
; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i32 257 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 257 to i8*)
|
||||
; CHECK: @__typeid_typeid2_byte_array = hidden alias i8, i8* @bits
|
||||
; CHECK: @__typeid_typeid2_bit_mask = hidden alias i8, inttoptr (i8 1 to i8*)
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0)
|
||||
; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i8 3 to i8*)
|
||||
; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 3 to i8*)
|
||||
; CHECK: @__typeid_typeid1_inline_bits = hidden alias i8, inttoptr (i32 9 to i8*)
|
||||
|
||||
; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4)
|
||||
; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i8 33 to i8*)
|
||||
; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 33 to i8*)
|
||||
; CHECK: @__typeid_typeid2_inline_bits = hidden alias i8, inttoptr (i64 8589934593 to i8*)
|
||||
|
||||
; CHECK: @foo = alias [2048 x i8], getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0)
|
||||
|
|
Loading…
Reference in New Issue