[PATCH] D62057: [ARM][CGP] Skip nuw values in PrepareConstants

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 07:58:23 PDT 2019


SjoerdMeijer accepted this revision.
SjoerdMeijer added a comment.
This revision is now accepted and ready to land.

Looks like a good improvement to me.



================
Comment at: lib/Target/ARM/ARMCodeGenPrepare.cpp:305
   // %sub = sub i8 %a, 2
   // %cmp = icmp ule i8 %sub, 254
   //
----------------
Looking at this example and comment again, we are explaining that this is not equivalent:

  %sub = sub i8 %a, 2
  %cmp = icmp ule i8 %sub, 254
  =>
  %a32 = zext i8 %a to i32
  %sub1 = sub i32 %a32, 2
  %cmp = icmp ule i32 %sub1, 254

and alive agrees with us :-) and gives the same values: https://rise4fun.com/Alive/6gzR

And changing the sub to a sub with constant 1 shows it is all good.


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

https://reviews.llvm.org/D62057





More information about the llvm-commits mailing list