[PATCH] D60036: [CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw.

Luqman Aden via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 23:12:43 PDT 2019


luqmana marked an inline comment as done.
luqmana added inline comments.


================
Comment at: llvm/test/Transforms/CorrelatedValuePropagation/sub.ll:11
+; CHECK: %sub = sub nuw nsw i32 %a, 1
+  %sub = sub i32 %a, 1
+  br label %exit
----------------
nikic wrote:
> These cases aren't particularly meaningful, because this is non-canonical IR -- usually the `sub %a, 1` gets canonicalized to `add %a, -1`, at which point the existing `add` code would add nowrap flags. Sub nowrap flags are generally only useful if the second operand is non-constant.
> 
> But I guess that for the purposes of this test this doesn't really matter, as it shows the relevant transform, even if the specific case can't occur naturally.
Yea, mostly just to test that the right flags get added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60036





More information about the llvm-commits mailing list