[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 07:59:33 PDT 2025


LU-JOHN wrote:

> It is not obvious to judge whether this patch is profitable. Can you share some performance data on SPEC/LLVM test-suite/your motivating case?

This PR was inspired by code generated for Triton.  A reduced example can be found in function testA in jump-threading-live-on-exit.ll.

I've changed the block searching to go backward from uses to the def instead of forward from the def.   This is more efficient since a forward search is not guaranteed to hit a use, but a backward search must hit the def.  I've also added a limit to ensure that the search gives up if too many blocks are searched.

I tested this with a 3-stage build of LLVM.  This change increased the number of threaded branches from` 186726 to 197086, +10360.  The number of blocks that could be threaded and required backward searches from the uses was 331442. The number of blocks searched from the uses ranged from 0 to 25 (the search limit).  The average of number of blocks searched was 5.21.

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


More information about the llvm-commits mailing list