[PATCH] D95286: [LSR] Drop potentially invalid nowrap flags when switching to post-inc IV (PR46943)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 04:28:40 PST 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:1447
+    if (isa<OverflowingBinaryOperator>(Result)) {
+      if (auto *I = dyn_cast<Instruction>(Result)) {
+        if (!S->hasNoUnsignedWrap())
----------------
nikic wrote:
> reames wrote:
> > if (auto *op = dyn_cast<OBO>...)
> > 
> > e.g. you don't need the instruction, you can use the accessors on OBO.  
> OBO can generally also be a constant expression, which is why it's not allowed to set nowrap flags directly on it. We need to go through Instruction to modify the flags.
But can `Result` be a constant expression here? `PN` must be an AddRec for L, then the incoming value from the loop should be non-constant, otherwise it wouldn't be an AddRec?


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

https://reviews.llvm.org/D95286



More information about the llvm-commits mailing list