llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.25k stars 11.67k forks source link

Long live ranges of constants don't get rematerialized #42592

Open aemerson opened 5 years ago

aemerson commented 5 years ago
Bugzilla Link 43247
Version trunk
OS All
CC @efriedma-quic,@kamleshbhalui,@qcolombet

Extended Description

We're enabling the localizer pass for optimizations in AArch64 GlobalISel, which is a pass that tries to duplicate and move defs of constant-like instructions close to their uses, so as to reduce the live ranges and register pressure.

It would be good if the greedy register allocator could handle this problem for us, but it seems to have been written with only SelectionDAG in mind which is always block-local and doesn't have any notion of live range in its graph representation.

aemerson commented 4 years ago

Sorry, I was going to provide an example but haven't got around to it yet.

qcolombet commented 5 years ago

+1 on what Eli was saying. We'll need an example to see what is the problem.

efriedma-quic commented 5 years ago

Could you give an example here? greedy regalloc has support for remat, at least in some cases. I don't think it's restricted to a single basic block... but maybe there are other issues.