[PATCH] D38378: [ARM] Optimize {s,u}{add,sub}.with.overflow.

Roger Ferrer Ibanez via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 00:08:06 PST 2017


rogfer01 added inline comments.


================
Comment at: lib/Target/ARM/ARMBaseInstrInfo.cpp:2677-2679
   // One is MI, the other is a SUB instruction.
   // For CMPrr(r1,r2), we are looking for SUB(r1,r2) or SUB(r2,r1).
   // For CMPri(r1, CmpValue), we are looking for SUBri(r1, CmpValue).
----------------
Maybe I'm reading it wrong: should this comment say something like `the other is a SUB or ADD instruction`?


================
Comment at: lib/Target/ARM/ARMBaseInstrInfo.cpp:2741-2745
+    // Check whether CmpInstr can be made redundant by the current instruction.
+    if (isRedundantFlagInstr(&CmpInstr, SrcReg, SrcReg2, CmpValue, &*I)) {
+      SubAdd = &*I;
+      break;
+    }
----------------
It is not clear to me why you had to swap this check with the one below? Is it related to the `--E;` in line 2731?


https://reviews.llvm.org/D38378





More information about the llvm-commits mailing list