[PATCH] D79746: [SCEV] Relax abnormal exit check in isAddRecNeverPoison.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 15:08:01 PDT 2020


efriedma added a comment.

Despite the fact that this takes an "Instruction*", it's not really trying to compute some property of users of that instruction; it's trying compute some property of users of the equivalent SCEV expression.  So any computation based on the position of the instruction in the loop is not going to give the result you want: even if users of the given instruction can be assumed to be never poison, you can't generalize that property to all equivalent values in the loop.

I think there might be another way to handle the testcase, though.  If the input instruction is a PHI node, we can use PHI-specific reasoning.  In this context, we don't care if the base value is poison, I think; we're trying to compute a property of the increment.  And the "add nsw" can't be poison because it's also used by the loop latch of the previous iteration: if it's poison, we can't reach the current iteration, regardless of whether the loop has other exits.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6180
+      // block are guaranteed to execute, I cannot be poison.
+      return isGuaranteedToTransferExecutionToSuccessor(I);
+    return loopHasNoAbnormalExits(L);
----------------
You're not checking "all instructions between I and the end of the block".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79746/new/

https://reviews.llvm.org/D79746





More information about the llvm-commits mailing list