summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/LowerBitSets.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-09-14 18:01:59 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-09-14 18:01:59 +0000
commit16a2f3e3022a48426e10ab7b822e8dc824abe23c (patch)
treea2f8977ccdc019e30fe644e1104bfecb47b57f39 /llvm/lib/Transforms/IPO/LowerBitSets.cpp
parentc23a8b2d39f8965af32e880d2d336f4f77d8a867 (diff)
downloadbcm5719-llvm-16a2f3e3022a48426e10ab7b822e8dc824abe23c.tar.gz
bcm5719-llvm-16a2f3e3022a48426e10ab7b822e8dc824abe23c.zip
Revert "[opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space"
This was a flawed change - it just caused the getElementType call to be deferred until later, when we really need to remove it. Now that the IR for GlobalAliases has been updated, the root cause is addressed that way instead and this change is no longer needed (and in fact gets in the way - because we want to pass the pointee type directly down further). Follow up patches to push this through GlobalValue, bitcode format, etc, will come along soon. This reverts commit 236160. llvm-svn: 247585
Diffstat (limited to 'llvm/lib/Transforms/IPO/LowerBitSets.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/LowerBitSets.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerBitSets.cpp b/llvm/lib/Transforms/IPO/LowerBitSets.cpp
index 549c4bf557a..555fc4f45a9 100644
--- a/llvm/lib/Transforms/IPO/LowerBitSets.cpp
+++ b/llvm/lib/Transforms/IPO/LowerBitSets.cpp
@@ -399,9 +399,8 @@ void LowerBitSets::allocateByteArrays() {
if (LinkerSubsectionsViaSymbols) {
BAI->ByteArray->replaceAllUsesWith(GEP);
} else {
- GlobalAlias *Alias =
- GlobalAlias::create(PointerType::getUnqual(Int8Ty),
- GlobalValue::PrivateLinkage, "bits", GEP, M);
+ GlobalAlias *Alias = GlobalAlias::create(
+ Int8Ty, 0, GlobalValue::PrivateLinkage, "bits", GEP, M);
BAI->ByteArray->replaceAllUsesWith(Alias);
}
BAI->ByteArray->eraseFromParent();
@@ -443,7 +442,7 @@ Value *LowerBitSets::createBitSetTest(IRBuilder<> &B, BitSetInfo &BSI,
// Each use of the byte array uses a different alias. This makes the
// backend less likely to reuse previously computed byte array addresses,
// improving the security of the CFI mechanism based on this pass.
- ByteArray = GlobalAlias::create(BAI->ByteArray->getType(),
+ ByteArray = GlobalAlias::create(BAI->ByteArray->getValueType(), 0,
GlobalValue::PrivateLinkage, "bits_use",
ByteArray, M);
}
@@ -581,9 +580,10 @@ void LowerBitSets::buildBitSetsFromGlobalVariables(
if (LinkerSubsectionsViaSymbols) {
Globals[I]->replaceAllUsesWith(CombinedGlobalElemPtr);
} else {
- GlobalAlias *GAlias =
- GlobalAlias::create(Globals[I]->getType(), Globals[I]->getLinkage(),
- "", CombinedGlobalElemPtr, M);
+ GlobalAlias *GAlias = GlobalAlias::create(
+ Globals[I]->getType()->getElementType(),
+ Globals[I]->getType()->getAddressSpace(), Globals[I]->getLinkage(),
+ "", CombinedGlobalElemPtr, M);
GAlias->setVisibility(Globals[I]->getVisibility());
GAlias->takeName(Globals[I]);
Globals[I]->replaceAllUsesWith(GAlias);
@@ -818,9 +818,10 @@ void LowerBitSets::buildBitSetsFromFunctions(ArrayRef<Metadata *> BitSets,
if (LinkerSubsectionsViaSymbols || Functions[I]->isDeclarationForLinker()) {
Functions[I]->replaceAllUsesWith(CombinedGlobalElemPtr);
} else {
- GlobalAlias *GAlias = GlobalAlias::create(Functions[I]->getType(),
- Functions[I]->getLinkage(), "",
- CombinedGlobalElemPtr, M);
+ GlobalAlias *GAlias = GlobalAlias::create(
+ Functions[I]->getType()->getElementType(),
+ Functions[I]->getType()->getAddressSpace(),
+ Functions[I]->getLinkage(), "", CombinedGlobalElemPtr, M);
GAlias->setVisibility(Functions[I]->getVisibility());
GAlias->takeName(Functions[I]);
Functions[I]->replaceAllUsesWith(GAlias);
OpenPOWER on IntegriCloud