[PATCH] D58746: Alternative to D58560.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 15:46:11 PST 2019


asbirlea created this revision.
Herald added subscribers: jlebar, sanjoy.
Herald added a project: LLVM.

Tentative alternative to D58560 <https://reviews.llvm.org/D58560>.
DO NOT CHECK IN.


Repository:
  rL LLVM

https://reviews.llvm.org/D58746

Files:
  lib/Transforms/Utils/SSAUpdater.cpp


Index: lib/Transforms/Utils/SSAUpdater.cpp
===================================================================
--- lib/Transforms/Utils/SSAUpdater.cpp
+++ lib/Transforms/Utils/SSAUpdater.cpp
@@ -190,14 +190,17 @@
   Instruction *User = cast<Instruction>(U.getUser());
 
   Value *V;
-  if (PHINode *UserPN = dyn_cast<PHINode>(User))
+  bool IsPhi = false;
+  if (PHINode *UserPN = dyn_cast<PHINode>(User)) {
     V = GetValueAtEndOfBlock(UserPN->getIncomingBlock(U));
+    IsPhi = true;
+  }
   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())
+  if (OldVal != V && OldVal->hasValueHandle() && !IsPhi)
     ValueHandleBase::ValueIsRAUWd(OldVal, V);
 
   U.set(V);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58746.188639.patch
Type: text/x-patch
Size: 824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190227/72044fac/attachment.bin>


More information about the llvm-commits mailing list