[Mlir-commits] [mlir] [MLIR][SCF] Sink scf.if from scf.while before region into after region in scf-uplift-while-to-for (PR #165216)
Ming Yan
llvmlistbot at llvm.org
Fri Nov 28 01:13:51 PST 2025
================
----------------
NexMing wrote:
> You're introducing the concept of "dead values" here, I don't have a problem with these values existing. If you want to argue something you need to look at whether it affects liveness and live ranges, or how it is treated in a lowering pipeline: what happens with such a while loop when lowered to a CFG? Hopefully the logic is already smart enough to ignore these values, but it's possible we can do better (I don't see any fundamental issue here).
Hi, I tried to see what happens when `scf.while` is lowered to the CFG.
I found that when `scf.condition` is lowered to `cf.cond_br`, the “dead values” disappear. So my earlier guess was incorrect, and it doesn’t introduce optimization risks. I apologize for my mistaken "guess". I think I’ll submit a new PR and continue using the original approach. Sorry for any trouble this may have caused you.
But I do have a question: why isn’t `scf.condition` designed with two sets of operands—one passed to the do region and the other passed as the result values?
https://github.com/llvm/llvm-project/pull/165216
More information about the Mlir-commits
mailing list