summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-10-20 22:46:48 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2019-10-30 20:43:05 -0500
commitb2083c53824d6465344f831e5dd0302ba2c40668 (patch)
treea64c743dd0b571bc79c77c3ed1d2354c998518d8 /llvm/lib/Transforms/IPO
parent4318d3c64ccd0e172c1ac108ff8d646330bfd4b3 (diff)
downloadbcm5719-llvm-b2083c53824d6465344f831e5dd0302ba2c40668.tar.gz
bcm5719-llvm-b2083c53824d6465344f831e5dd0302ba2c40668.zip
[Attributor][NFC] Simplify the IRPosition interface
We pretended IRPosition came either as mutable or immutable objects while they are basically always immutable, with a single (existing) unfortunate exceptions. This patch cleans up the uses to deal with the immutable version.
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index a811471d37e..b397f5a1655 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -328,7 +328,7 @@ ChangeStatus AbstractAttribute::update(Attributor &A) {
}
ChangeStatus
-IRAttributeManifest::manifestAttrs(Attributor &A, IRPosition &IRP,
+IRAttributeManifest::manifestAttrs(Attributor &A, const IRPosition &IRP,
const ArrayRef<Attribute> &DeducedAttrs) {
Function *ScopeFn = IRP.getAssociatedFunction();
IRPosition::Kind PK = IRP.getPositionKind();
@@ -705,7 +705,7 @@ struct AAFromMustBeExecutedContext : public Base {
void initialize(Attributor &A) override {
Base::initialize(A);
- IRPosition &IRP = this->getIRPosition();
+ const IRPosition &IRP = this->getIRPosition();
Instruction *CtxI = IRP.getCtxI();
if (!CtxI)
@@ -987,7 +987,9 @@ ChangeStatus AAReturnedValuesImpl::manifest(Attributor &A) {
// If the assumed unique return value is an argument, annotate it.
if (auto *UniqueRVArg = dyn_cast<Argument>(UniqueRV.getValue())) {
- getIRPosition() = IRPosition::argument(*UniqueRVArg);
+ // TODO: This should be handled differently!
+ this->AnchorVal = UniqueRVArg;
+ this->KindOrArgNo = UniqueRVArg->getArgNo();
Changed = IRAttribute::manifest(A);
} else if (auto *RVC = dyn_cast<Constant>(UniqueRV.getValue())) {
// We can replace the returned value with the unique returned constant.
@@ -3816,7 +3818,7 @@ struct AAMemoryBehaviorImpl : public AAMemoryBehavior {
/// See AbstractAttribute::manifest(...).
ChangeStatus manifest(Attributor &A) override {
- IRPosition &IRP = getIRPosition();
+ const IRPosition &IRP = getIRPosition();
// Check if we would improve the existing attributes first.
SmallVector<Attribute, 4> DeducedAttrs;
OpenPOWER on IntegriCloud