[llvm] [Analysis] Ignore convergence tokens in dead branches in `CodeMetrics` (PR #193590)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 11:56:59 PDT 2026
================
@@ -118,7 +119,12 @@ static bool extendsConvergenceOutsideLoop(const Instruction &I, const Loop *L) {
if (!isa<ConvergenceControlInst>(I))
return false;
for (const auto *U : I.users()) {
- if (!L->contains(cast<Instruction>(U)))
+ const auto *UserInst = cast<Instruction>(U);
+ // Ignore users in dead branches, identified by blocks terminated with
+ // unreachable.
+ if (isa<UnreachableInst>(UserInst->getParent()->getTerminator()))
----------------
Icohedron wrote:
Not really relevant to HLSL, but in C/C++ a basic block can end with an `unreachable` but not be dead. For example, an `abort()` will end a basic block with an `unreachable`: https://godbolt.org/z/c83zo3hz7
https://github.com/llvm/llvm-project/pull/193590
More information about the llvm-commits
mailing list