From 8c57d78e9303a74d435a30d3bc10b5e340bfa1cf Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 7 Feb 2017 03:20:58 +0000 Subject: [PATCH] LowerTypeTests: Simplify. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294273 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/LowerTypeTests.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/IPO/LowerTypeTests.cpp b/lib/Transforms/IPO/LowerTypeTests.cpp index 120e93ab5b7..7bf96510b0a 100644 --- a/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/lib/Transforms/IPO/LowerTypeTests.cpp @@ -746,7 +746,6 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) { TIL.TheKind = TTRes.TheKind; auto ImportGlobal = [&](StringRef Name, unsigned AbsWidth) { - unsigned PtrWidth = IntPtrTy->getBitWidth(); Constant *C = M.getOrInsertGlobal(("__typeid_" + TypeId + "_" + Name).str(), Int8Ty); auto *GV = dyn_cast(C); @@ -757,13 +756,12 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) { GV->setVisibility(GlobalValue::HiddenVisibility); auto SetAbsRange = [&](uint64_t Min, uint64_t Max) { - auto *T = IntegerType::get(M.getContext(), PtrWidth); - auto *MinC = ConstantAsMetadata::get(ConstantInt::get(T, Min)); - auto *MaxC = ConstantAsMetadata::get(ConstantInt::get(T, Max)); + auto *MinC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Min)); + auto *MaxC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Max)); GV->setMetadata(LLVMContext::MD_absolute_symbol, MDNode::get(M.getContext(), {MinC, MaxC})); }; - if (AbsWidth == PtrWidth) + if (AbsWidth == IntPtrTy->getBitWidth()) SetAbsRange(~0ull, ~0ull); // Full set. else if (AbsWidth) SetAbsRange(0, 1ull << AbsWidth);