[llvm-dev] llvm PeepholeOptimizer + optimizeLoadInstr question

Andrew Zhogin via llvm-dev llvm-dev at lists.llvm.org
Sun Jul 17 11:29:34 PDT 2016

Hello Lang,

PeepholeOptimizer allows backend to provide optimizeLoadInstr function to
fold memory-load operand.

But it doesn't work for folding load operand into store instruction
(combine into memory-to-memory instruction).
It is rare case, but some backends have such instructions (like SystemZ

It doesn't work because "FoldAsLoadDefCandidates.clear()" occurs too early,
before current instruction "optimizeLoadInstr" check.

Could "FoldAsLoadDefCandidates.clear()" be moved later?

After "!isLoadFoldable(...) && !FoldAsLoadDefCandidates.empty()" condition

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160718/a820fae0/attachment.html>

More information about the llvm-dev mailing list