for (I = Start; I < End; I += 1) always terminates so mark
{scf|affine}.for as RecursivelySpeculatable when step is known to be
1.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/SCF/IR/SCF.cpp | ||
---|---|---|
1069–1070 | Using matchPattern with m_Constant and friends makes the code indepdent of any specific dialects ConstantLike op |
- Use m_Constant
- Change getConstantStep() to return APInt (that's more robust)
- Refactor one obvious place in the code to use ForOp::getConstantStep()
mlir/test/Transforms/loop-invariant-code-motion.mlir | ||
---|---|---|
106 | Any reason this has become 20? |
mlir/test/Transforms/loop-invariant-code-motion.mlir | ||
---|---|---|
106 | Just so that I could visually distinguish between the two loops. |
mlir/lib/Dialect/SCF/IR/SCF.cpp | ||
---|---|---|
1076 | Don't you also have to make sure neither the induction variable nor the range change within the loop? This is an scf.for, the most basic loop, anything can happen inside... |
- Address review
mlir/lib/Dialect/SCF/IR/SCF.cpp | ||
---|---|---|
1076 |
I used a C for loop just for illustration, scf.for has more restrictive semantics and cannot change the IV or the bounds in the loop body. I'll change it to say scf.for and affine.for to make this clear. |
mlir/test/Transforms/loop-invariant-code-motion.mlir | ||
---|---|---|
200 | nit: %c2 is not used here. Please remove it. |
Thanks to me looks good. But please have a look at the build status, as it is currently failing.
Using matchPattern with m_Constant and friends makes the code indepdent of any specific dialects ConstantLike op