[LLVMdev] Codegen performance issue: LEA vs. INC.

Andrew Trick atrick at apple.com
Sat Oct 5 10:27:01 PDT 2013


On Oct 5, 2013, at 5:06 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

>> The lea->cmp problem is fixed by switching to the MI scheduler. Please run with -mllvm -misched-bench to confirm.
> 
> I get the same output in the testcase in pr13320. The leaq is in
> between the cmp and the jmp, preventing  macro-fusion.

Right, Aleksey's test case works now because the SD scheduler no longer reorders the inc with earlier uses of the loop counter.

The 2-address pass still does the wrong thing in pr13320. It would be nice to improve those heuristics. Also, the MI scheduler could correct the problem if it could create copies and split live ranges. That was part of the original MI scheduler plan but was never implemented. The implementation would look like this:

- DAG builder creates weak edges for vreg antidependence.
- Check for unresolved weak edge when scheduling the instruction.
- Create the copy an DAG node on -the-fly (not currently supported).
- Create a new live interval for the copy and shrink the original.

I'll copy this into the bug for future reference.

-Andy



More information about the llvm-dev mailing list