[llvm] [AMDGPU] Simplify cond branch if condition is known (PR #180081)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 16 10:48:49 PST 2026


LU-JOHN wrote:

> At the very least we need a better motivating example for why this new machinery is required.

This change was motivated by testing with the check-libc-amdgcn-amd-amdhsa target.  I've added a reduced motivating testcase.  The const compare is created by the lowering of memcpy.  In this case the loop length is given by:

`i64 add (i64 sub (i64 16, i64 ptrtoint (ptr addrspacecast (ptr addrspace(4) null to ptr) to i64)), i64 13)`

which is a constant but not a ConstantInt, which leads to generation of a constant compare to guard the loop.  

In check-libc-amdgcn-amd-amdhsa 47K constant compares were simplified, and I believe almost all of them were due to memcpy loop lowering.

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


More information about the llvm-commits mailing list