[PATCH] D73089: [SSAUpdater] Don't call ValueIsRAUWd upon single use replacement

Daniil Suchkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 03:05:42 PST 2020


DaniilSuchkov created this revision.
DaniilSuchkov added reviewers: asbirlea, fhahn, efriedma, reames.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

It is incorrect to call ValueHandleBase::ValueIsRAUWd when only one use is replaced since it simply violates semantics of the callback and leads to bugs like this one: https://bugs.llvm.org/show_bug.cgi?id=44320
Previously this call was used specifically to keep LICM's cache of AliasSetTrackers up to date across passes (as the bug #36801 showed, even for that purpose it didn't work properly), but since LICM doesn't have that cache anymore (as of D73084 <https://reviews.llvm.org/D73084>), we can safely remove this incorrect call with no repercussions.

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=44320


https://reviews.llvm.org/D73089

Files:
  llvm/lib/Transforms/Utils/SSAUpdater.cpp
  llvm/test/Transforms/LCSSA/pr44320.ll


Index: llvm/test/Transforms/LCSSA/pr44320.ll
===================================================================
--- llvm/test/Transforms/LCSSA/pr44320.ll
+++ llvm/test/Transforms/LCSSA/pr44320.ll
@@ -1,4 +1,3 @@
-; XFAIL: *
 ; RUN: opt -passes="verify<scalar-evolution>,lcssa,verify<scalar-evolution>" -verify-scev-strict -S -disable-output %s
 
 ; The first SCEV verification is required because it queries SCEV and populates
Index: llvm/lib/Transforms/Utils/SSAUpdater.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -195,11 +195,6 @@
   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);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73089.239256.patch
Type: text/x-patch
Size: 934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/ca3149e5/attachment.bin>


More information about the llvm-commits mailing list