This is an archive of the discontinued LLVM Phabricator instance.

[PeepholeOptimizer] Load now may be folded into isLoadFoldBarrier instruction
AbandonedPublic

Authored by andrew.zhogin on Oct 16 2016, 9:10 PM.

Details

Reviewers
manmanren
lhames
Summary

Patch to postpone FoldAsLoadDefCandidates array clean to the moment before next loop iteration (when IsLoadFoldBarrier instruction met).
With this change, load may be folded into store instruction (for memory-to-memory copy). Or into call instruction, or into instruction with side effects.
Targets with memory-to-memory copy may override TargetInstrInfo::optimizeLoadInstr to implement such folding.

Diff Detail

Event Timeline

andrew.zhogin retitled this revision from to [PeepholeOptimizer] Load now may be folded into isLoadFoldBarrier instruction.
andrew.zhogin updated this object.
andrew.zhogin added a reviewer: lhames.

Hi Andrew,

This will need a test case.

Also, would it be clearer to just test the condition at the end of the loop?

CCing Manman as a reviewer, as I'm out on vacation, and may not have a chance to check in on this for a few days.

  • Lang.
manmanren edited edge metadata.Mar 9 2017, 10:32 AM

Is it possible to add a testing case?

Manman

Is it possible to add a testing case?

Manman

'optimizeLoadInstr' function is used now only by X86-backend and there aren't any memory-to-memory instructions in X86 (to fold load argument into store-barrier instruction).
SystemZ-backend doesn't use this mechanics to produce MVC instruction for now.
So I couldn't create working test case for existing backends.
I think it may be usefull for SystemZ machine-level MVC instructions combining.

andrew.zhogin abandoned this revision.Jul 1 2017, 6:24 AM