This is an archive of the discontinued LLVM Phabricator instance.

[polly codegen] Handle multi-dimensional invariant load.
ClosedPublic

Authored by efriedma on Oct 13 2016, 4:37 PM.

Details

Summary

If the address of a load depends on another load, make sure to emit the loads them in the right order.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma updated this revision to Diff 74594.Oct 13 2016, 4:37 PM
efriedma retitled this revision from to [polly codegen] Handle multi-dimensional invariant load..
efriedma updated this object.
efriedma added reviewers: Meinersbur, jdoerfert.
efriedma set the repository for this revision to rL LLVM.
efriedma added subscribers: llvm-commits, pollydev.
jdoerfert edited edge metadata.Oct 14 2016, 1:06 AM

Assuming all checks prior to code generation can handle this case properly this is the "right way" to fix this. One modification and it should be good to go.

lib/CodeGen/IslNodeBuilder.cpp
1115

I do not get the comment.

1116

To get all SCEVUnknowns that might be loads which are somewhere referenced in the dimension size we need to do it somewhat like:

SetVector<Value *> Values;
findValues(ParamSCEV, SE, Values);                                                                  
for (auto *Val : Values) {
  if (auto *BaseIAClass = S.lookupInvariantEquivClass(Val) {
    ...
1128

I do not see the need here but OK.

I realized that we should check hoisting is actually performed.

test/Isl/CodeGen/invariant-load-dimension.ll
4

Maybe add another check line that verifies we actually hoist the multidimensional loads.

Invariant Accesses: {
        ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
            [l2, l1] -> { Stmt_for_body_i[i0] -> MemRef_cpi[0, 0] };
        Execution Context: [l2, l1] -> {  :  }
        ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
            [l2, l1] -> { Stmt_for_body_lr_ph_i[] -> MemRef_cpi[0, 1] };
        Execution Context: [l2, l1] -> {  : l2 > 0 }
}
efriedma updated this revision to Diff 74724.Oct 14 2016, 11:50 AM
efriedma updated this object.
efriedma edited edge metadata.

Updated to correctly iterate over all the inputs to the SCEV value.

efriedma abandoned this revision.Oct 17 2016, 2:19 PM

https://reviews.llvm.org/rL284426 . (I accidentally committed without linking to the review, and for some reason, phabricator doesn't want to let me close this.)

efriedma reclaimed this revision.Oct 17 2016, 2:59 PM
efriedma accepted this revision.
efriedma added a reviewer: efriedma.
This revision is now accepted and ready to land.Oct 17 2016, 2:59 PM
efriedma closed this revision.Oct 17 2016, 3:00 PM