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

Joel Galenson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 15:44:41 PST 2017


jgalenson added a comment.

> The benefits are clear, even from the few tests that changed, but it would be good to have a simple test-suite run in benchmark mode, just to make sure we're not creating any new pathological case on random programs.

Are there instructions for how to run lnt remotely?  I can run it locally, but since I'm on an x86 machine that won't help test this.



================
Comment at: lib/Target/ARM/ARMBaseInstrInfo.cpp:2731
+    // Allow MI to be SubAdd.
+    --E;
   }
----------------
rengolin wrote:
> Can you elaborate on this change?
Sure.

In at least one of my testcases (the first one in su-addsub-overflow.ll), I have a basic block with the following:

%vreg0 = ADDrr %vreg2, %vreg3
CMPrr %vreg0, %vreg2

Here, the compare is CmpInstr and the ADDrr is MI.  But MI gets set to nullptr a little above this because SrcReg2 != 0.  Without this line here, MI and SubAdd would both be nullptr, and so we'd do nothing.  But I want to allow what was MI to be SubAdd, since if it's a sub or add it can potentially replace the compare.  E was initialized to be MI, and the loop just below looks for SubAdd by walking backwards up to E, so I decrement E to allow it to consider MI.

Does that clear it up?  Should I add some of that to this comment?


https://reviews.llvm.org/D38378





More information about the llvm-commits mailing list