[llvm] 4a8dbc6 - [SSAUpdater] Don't call ValueIsRAUWd upon single use replacement

Daniil Suchkov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 00:55:18 PST 2020


Author: Daniil Suchkov
Date: 2020-01-23T15:53:53+07:00
New Revision: 4a8dbc617d0b28ce2ce3e6856376b3802409554e

URL: https://github.com/llvm/llvm-project/commit/4a8dbc617d0b28ce2ce3e6856376b3802409554e
DIFF: https://github.com/llvm/llvm-project/commit/4a8dbc617d0b28ce2ce3e6856376b3802409554e.diff

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

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 PR44320.

Previously this call was used specifically to keep LICM's cache of
AliasSetTrackers up to date across passes (as PR36801 showed, even for
that purpose it didn't work properly), but since LICM doesn't have that
cache anymore, we can safely remove this incorrect call with no
repercussions.

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

Reviewers: asbirlea, fhahn, efriedma, reames

Reviewed-By: asbirlea

Differential Revision: https://reviews.llvm.org/D73089

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index bffdd115d940..36a17ce76198 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -195,11 +195,6 @@ 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);
 }
 

diff  --git a/llvm/test/Transforms/LCSSA/pr44320.ll b/llvm/test/Transforms/LCSSA/pr44320.ll
index a211cf82cc89..b6082ac96ed7 100644
--- a/llvm/test/Transforms/LCSSA/pr44320.ll
+++ b/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


        


More information about the llvm-commits mailing list