LICM uses AliasSet information to hoist and sink instructions. However, other passes...
authorNadav Rotem <nrotem@apple.com>
Mon, 13 Aug 2012 23:06:54 +0000 (23:06 +0000)
committerNadav Rotem <nrotem@apple.com>
Mon, 13 Aug 2012 23:06:54 +0000 (23:06 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161803 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/ValueHandle.h
lib/Transforms/Utils/SSAUpdater.cpp

index 6787633c1dc7461f72a91b87d4f1963ace15d348..61e21b86ead87a0b765ff884a16862a85ce2c57d 100644 (file)
@@ -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(); }
index b3f5289fcda94447c7d3355448dedf57ba24cc33..e568a616b6f0a853285561918741bd9eae31bb99 100644 (file)
@@ -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);
 }