instr-combiner: sum up all latencies of the transformed instructions
authorSebastian Pop <sebpop@gmail.com>
Sun, 11 Dec 2016 19:39:32 +0000 (19:39 +0000)
committerSebastian Pop <sebpop@gmail.com>
Sun, 11 Dec 2016 19:39:32 +0000 (19:39 +0000)
commite08d9c7c8748670b4fa0e215ac11c89675bda6ab
tree33d5cff1132ebc45c51a91bf210cf7583c731b59
parent8766a76f3d561c42c95281f2ca0f8da489a5d824
instr-combiner: sum up all latencies of the transformed instructions

We have found that -- when the selected subarchitecture has a scheduling model
and we are not optimizing for size -- the machine-instruction combiner uses a
too-simple algorithm to compute the cost of one of the two alternatives [before
and after running a combining pass on a section of code], and therefor it throws
away the combination results too often.

This fix has the potential to help any ISA with the potential to combine
instructions and for which at least one subarchitecture has a scheduling model.
As of now, this is only known to definitely affect AArch64 subarchitectures with
a scheduling model.

Regression tested on AMD64/GNU-Linux, new test case tested to fail on an
unpatched compiler and pass on a patched compiler.

Patch by Abe Skolnik and Sebastian Pop.

llvm-svn: 289399
llvm/lib/CodeGen/MachineCombiner.cpp
llvm/test/CodeGen/AArch64/arm64-fma-combines.ll
llvm/test/CodeGen/AArch64/machine-combiner-madd.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/mul-lohi.ll