summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-08-13 23:06:54 +0000
committerNadav Rotem <nrotem@apple.com>2012-08-13 23:06:54 +0000
commit8d804520766b6772277fcc1d9b31da02f320bc12 (patch)
treebe4177477844c06c7e2416f4f320af2afbba02b0
parent5d4e20587494c6e90e1f606ce8859a1c793ad37c (diff)
downloadbcm5719-llvm-8d804520766b6772277fcc1d9b31da02f320bc12.tar.gz
bcm5719-llvm-8d804520766b6772277fcc1d9b31da02f320bc12.zip
LICM uses AliasSet information to hoist and sink instructions. However, other passes, such as LoopRotate
may invalidate its AliasSet because SSAUpdater does not update the AliasSet properly. This patch teaches SSAUpdater to notify AliasSet that it made changes. The testcase in PR12901 is too big to be useful and I could not reduce it to a normal size. rdar://11872059 PR12901 llvm-svn: 161803
-rw-r--r--llvm/include/llvm/Support/ValueHandle.h3
-rw-r--r--llvm/lib/Transforms/Utils/SSAUpdater.cpp5
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/ValueHandle.h b/llvm/include/llvm/Support/ValueHandle.h
index 6787633c1dc..61e21b86ead 100644
--- a/llvm/include/llvm/Support/ValueHandle.h
+++ b/llvm/include/llvm/Support/ValueHandle.h
@@ -110,11 +110,12 @@ protected:
V != DenseMapInfo<Value *>::getTombstoneKey();
}
-private:
+public:
// Callbacks made from Value.
static void ValueIsDeleted(Value *V);
static void ValueIsRAUWd(Value *Old, Value *New);
+private:
// Internal implementation details.
ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); }
HandleBaseKind getKind() const { return PrevPair.getInt(); }
diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index b3f5289fcda..e568a616b6f 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -214,6 +214,11 @@ void SSAUpdater::RewriteUse(Use &U) {
else
V = GetValueInMiddleOfBlock(User->getParent());
+ // Notify that users of the existing value that it is being replaced.
+ Value *OldVal = U.get();
+ if (OldVal != V && OldVal->hasValueHandle())
+ ValueHandleBase::ValueIsRAUWd(OldVal, V);
+
U.set(V);
}
OpenPOWER on IntegriCloud