If the address of a load depends on another load, make sure to emit the loads them in the right order.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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 } } |
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.)
I do not get the comment.