mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
LowerTypeTests: Simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4145c2707
commit
8c57d78e93
@ -746,7 +746,6 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) {
|
|||||||
TIL.TheKind = TTRes.TheKind;
|
TIL.TheKind = TTRes.TheKind;
|
||||||
|
|
||||||
auto ImportGlobal = [&](StringRef Name, unsigned AbsWidth) {
|
auto ImportGlobal = [&](StringRef Name, unsigned AbsWidth) {
|
||||||
unsigned PtrWidth = IntPtrTy->getBitWidth();
|
|
||||||
Constant *C =
|
Constant *C =
|
||||||
M.getOrInsertGlobal(("__typeid_" + TypeId + "_" + Name).str(), Int8Ty);
|
M.getOrInsertGlobal(("__typeid_" + TypeId + "_" + Name).str(), Int8Ty);
|
||||||
auto *GV = dyn_cast<GlobalVariable>(C);
|
auto *GV = dyn_cast<GlobalVariable>(C);
|
||||||
@ -757,13 +756,12 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) {
|
|||||||
|
|
||||||
GV->setVisibility(GlobalValue::HiddenVisibility);
|
GV->setVisibility(GlobalValue::HiddenVisibility);
|
||||||
auto SetAbsRange = [&](uint64_t Min, uint64_t Max) {
|
auto SetAbsRange = [&](uint64_t Min, uint64_t Max) {
|
||||||
auto *T = IntegerType::get(M.getContext(), PtrWidth);
|
auto *MinC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Min));
|
||||||
auto *MinC = ConstantAsMetadata::get(ConstantInt::get(T, Min));
|
auto *MaxC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Max));
|
||||||
auto *MaxC = ConstantAsMetadata::get(ConstantInt::get(T, Max));
|
|
||||||
GV->setMetadata(LLVMContext::MD_absolute_symbol,
|
GV->setMetadata(LLVMContext::MD_absolute_symbol,
|
||||||
MDNode::get(M.getContext(), {MinC, MaxC}));
|
MDNode::get(M.getContext(), {MinC, MaxC}));
|
||||||
};
|
};
|
||||||
if (AbsWidth == PtrWidth)
|
if (AbsWidth == IntPtrTy->getBitWidth())
|
||||||
SetAbsRange(~0ull, ~0ull); // Full set.
|
SetAbsRange(~0ull, ~0ull); // Full set.
|
||||||
else if (AbsWidth)
|
else if (AbsWidth)
|
||||||
SetAbsRange(0, 1ull << AbsWidth);
|
SetAbsRange(0, 1ull << AbsWidth);
|
||||||
|
Loading…
Reference in New Issue
Block a user