[llvm] r292674 - LowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initialization out of if statement.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 15:22:28 PST 2017
Author: pcc
Date: Fri Jan 20 17:22:28 2017
New Revision: 292674
URL: http://llvm.org/viewvc/llvm-project?rev=292674&view=rev
Log:
LowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initialization out of if statement.
Modified:
llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/trunk/test/Transforms/LowerTypeTests/export-allones.ll
llvm/trunk/test/Transforms/LowerTypeTests/export-bytearray.ll
llvm/trunk/test/Transforms/LowerTypeTests/export-inline.ll
Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=292674&r1=292673&r2=292674&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Fri Jan 20 17:22:28 2017
@@ -602,8 +602,7 @@ Value *LowerTypeTestsModule::lowerTypeTe
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::lowerTypeTest
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::lowerTypeTest
(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;
Modified: llvm/trunk/test/Transforms/LowerTypeTests/export-allones.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/export-allones.ll?rev=292674&r1=292673&r2=292674&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/export-allones.ll (original)
+++ llvm/trunk/test/Transforms/LowerTypeTests/export-allones.ll Fri Jan 20 17:22:28 2017
@@ -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)
Modified: llvm/trunk/test/Transforms/LowerTypeTests/export-bytearray.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/export-bytearray.ll?rev=292674&r1=292673&r2=292674&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/export-bytearray.ll (original)
+++ llvm/trunk/test/Transforms/LowerTypeTests/export-bytearray.ll Fri Jan 20 17:22:28 2017
@@ -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*)
Modified: llvm/trunk/test/Transforms/LowerTypeTests/export-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/export-inline.ll?rev=292674&r1=292673&r2=292674&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/export-inline.ll (original)
+++ llvm/trunk/test/Transforms/LowerTypeTests/export-inline.ll Fri Jan 20 17:22:28 2017
@@ -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)
More information about the llvm-commits
mailing list