IndVarSimplify::sinkUnusedInvariants would sink a instruction from a loop's preheader block to exit block to reduce register pressure. But the optimization is not conservative, it could increase register pressure conversely if none operand is used in or after loop exit block, because sinking could extend operands' liveness range hence increase register pressure.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Event Timeline
Comment Actions
This looks pretty ad-hoc to me.
I believe we consider this to be a canonicalization transform that will be undone by other passes if profitable.
Comment Actions
Change rejected. As Roman mentions, this is more of a canonicalization than an optimization. If you want to do actual scheduling, please use the MI layer.
p.s. The wording "If none operand is used" does not parse for me. I think I get the intent of the change, but I'd suggest rewording any future discussion of this.
clang-tidy: warning: invalid case style for variable 'i' [readability-identifier-naming]
not useful
clang-format: please reformat the code