[llvm-bugs] [Bug 48166] New: Stale SCEVs still used after https://reviews.llvm.org/D87494

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 12 15:56:19 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48166

            Bug ID: 48166
           Summary: Stale SCEVs still used after
                    https://reviews.llvm.org/D87494
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: chang-sun.lin.jr at intel.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24159
  --> https://bugs.llvm.org/attachment.cgi?id=24159&action=edit
test case

Hi! We're working on some code where we are calling getType() in
ScalarEvolution::computeConstantDifference. After
https://reviews.llvm.org/D87494, this function is getting dead SCEVs that have
been deleted by phi cleanup in LoopStrengthReduce. We have fixed it locally by
guarding the getType() call, but probably the dead SCEVs should not be passed
in the first place.

I have an IR file that will reproduce the problem, if you call getType
somewhere, for example:

diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
b/llvm/lib/Transf
index 2713fa6..6eed23a 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -5849,6 +5849,7 @@ static bool ReduceLoopStrength(Loop *L, IVUsers &IU,
Scala
         if (!SE.isSCEVable(Phi.getType()))
           continue;
         auto PhiSCEV = SE.getSCEV(&Phi);
+        auto *thing = DbgValueSCEV->getType(); // ADDED
         if (Optional<APInt> Offset =
                 SE.computeConstantDifference(DbgValueSCEV, PhiSCEV)) {
           auto &Ctx = DbgValue->getContext();

opt -S -loop-reduce lsr-null-scev.ll

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201112/6422789e/attachment-0001.html>


More information about the llvm-bugs mailing list