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

Joel Galenson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 12:33:38 PDT 2017


jgalenson added inline comments.


================
Comment at: test/CodeGen/ARM/su-addsub-overflow.ll:49
+; CHECK:    cmp r0, r1
+; CHECK-NEXT:    subvc r0, r0, r1
+; CHECK-NEXT:    movvc pc, lr
----------------
efriedma wrote:
> This looks weird; we're generating a cmp, then a sub with exactly the same operands?
Well, as you can see in diff 2, we're currently doing that with a lot of other instructions.  This removes most of those other instructions.  I have another patch I was going to send after this one that fixes this.

Specifically, ARMBaseInstrInfo::optimizeCompareInstr tries to remove the cmp, but it runs right after the MachineSink pass, which sinks the sub into the cont basic block, which stops the optimization from working.


https://reviews.llvm.org/D35635





More information about the llvm-commits mailing list