[llvm] [AMDGPU] fix a scc clobber bug (PR #193143)

Zeng Wu via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 23:30:13 PDT 2026


zwu-2025 wrote:

> Instead of adding a whole new pass to fix this problem, we should fix it up front where it is introduced. It looks like this happens when SITargetLowering::EmitInstrWithCustomInserter calls splitKillBlock, it splits a block at a point where scc is live. We should either fix it there or somehow arrange that scc is never live across one of these pseudos, maybe by saying that they clobber scc? (TBH I'm not sure if that's a good idea. It feels like a lie, since they don't actually touch scc, but it might fix the problem?)

Thanks for your comment. 
Actually, in the previous iteration of this patch, I do this at `splitBB` in the `fianlize-isel` since it is where the problem originates from.  However, for the [comment](https://github.com/llvm/llvm-project/pull/193143#discussion_r3148737065), the patch is updated with changes now. IMHO, not relying on `SplitBB` makes sense to me since `SplitBB` is only one of the known sources of this problem so extending it to a more general case might make check more robust. So finally, a new pass is added to check and fix this. And I agree that adding a new pass for it could be over-kill.

As for making scc is never live across pseudos, it is viable to me, could you give me list of this kind instructions? Or what kind of flat exists for it in the td files?

@arsenm , are you OK with `making scc is never live across pseudos`? If so, I will update the patch using this method.



https://github.com/llvm/llvm-project/pull/193143


More information about the llvm-commits mailing list