[llvm-commits] [llvm] r133240 - /llvm/trunk/lib/CodeGen/TailDuplication.cpp

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Wed Jun 22 18:31:19 PDT 2011


> This commit appears to be causing a significant performance regression
> on a couple tests in the test-suite for x86-32;
> test-suite/SingleSource/Benchmarks/Shootout-C++/matrix.cpp is a good
> example (3.3s before, 4.1s after).  Would you mind taking a look to
> see if anything unexpected is happening?

It looks like a register allocation issue. On this benchmark, the hot
bb is not duplicated (or duplicated into), but gets a new phi node.
After register allocation, the start of the block goes from

	%ECX<def> = MOV32rm %EDI, 4, %EBX, 0, %noreg; mem:LD4[%scevgep9](tbaa=!"any pointer")
	%ECX<def> = MOV32rm %ECX<kill>, 4, %ESI, 0, %noreg; mem:LD4[%scevgep12](tbaa=!"int")
	%ECX<def> = IMUL32rm %ECX<kill>, %EDX, 4, %EBX, 0, %noreg, %EFLAGS<imp-def,dead>; mem:LD4[%scevgep10](tbaa=!"int")

to

	%EDI<def> = MOV32rm <fi#2>, 1, %noreg, 0, %noreg; mem:LD4[FixedStack2]
	%EDI<def> = MOV32rm %EDI<kill>, 4, %EBX, 0, %noreg; mem:LD4[%scevgep9](tbaa=!"any pointer")
	%EDI<def> = MOV32rm %EDI<kill>, 4, %EAX, 0, %noreg; mem:LD4[%scevgep12](tbaa=!"int")
	%EDI<def> = IMUL32rm %EDI<kill>, %EDX, 4, %EBX, 0, %noreg, %EFLAGS<imp-def,dead>; mem:LD4[%scevgep10](tbaa=!"int")

Note that the value that before was in EDI at the start of the loop is now in fi#2.

I have placed the files (test.bc, no-tail-dup.log, tail-dup.log) in
http://people.mozilla.com/~respindola if you are interested. I will check if I
can make the early tail duplication a bit more conservative.
 
> -Eli

Cheers,
Rafael



More information about the llvm-commits mailing list