[PATCH] D90648: [SCEV] Fix nsw flags for GEP expressions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 14:34:19 PST 2020


nikic added inline comments.


================
Comment at: llvm/test/Analysis/ScalarEvolution/nsw.ll:130
 ; CHECK-LABEL: PR12375
-; CHECK: -->  {(4 + %arg)<nsw>,+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax (8 + %arg)<nsw>)) /u 4))<nuw> + %arg)
+; CHECK: -->  {(4 + %arg)<nuw>,+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (8 + %arg)<nuw>
+
----------------
An unexpected improvement.


================
Comment at: llvm/test/Transforms/LoopFusion/simple.ll:301
 
 define void @forward_dep(i32* noalias %arg) {
 ; CHECK-LABEL: @forward_dep(
----------------
Genuine regression. Looking at the loop fusion log, the problem is that SCEV can no longer prove
```
Before:
    Relation: {%arg,+,4}<nsw><%bb19>  >=  {(-12 + %arg)<nsw>,+,4}<nsw><%bb19>

After:
    Relation: {%arg,+,4}<nuw><%bb19>  may <  {(-12 + %arg),+,4}<nw><%bb19>
```
where the comparisons are in a signed sense. And indeed, I do not believe that condition actually holds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90648



More information about the llvm-commits mailing list