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

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 08:08:22 PDT 2019


SjoerdMeijer added inline comments.


================
Comment at: lib/Target/ARM/ARMCodeGenPrepare.cpp:480
 
-      if (auto *Const = dyn_cast<ConstantInt>(I->getOperand(1))) {
-        if (!Const->isNegative())
-          continue;
+  // For adds that safely wrap and use a negative immediate as operand 1, we
+  // create an equivalent instruction using a positive immediate.
----------------
Perhaps you can be more specific here:

> adds that safely wrap

This is for unsigned values for which behaviour is well defined as wrapping or modulo behaviour. 

The Instructions that exhibit this behaviour are added to a list `SafeUnderflow` in function `isSafeOverflow`, which all looks a bit inconsistent (yep, I'm bikeshedding names ;-)). 


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

https://reviews.llvm.org/D62057





More information about the llvm-commits mailing list