[llvm] [AMDGPU][DAG] Remove AssertZext before some intrinsics (PR #146052)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 04:21:53 PDT 2025


================
@@ -3985,6 +3985,24 @@ SDValue AMDGPUTargetLowering::performAssertSZExtCombine(SDNode *N,
     }
   }
 
+  // AssertZext in front of these intrinsics is not necessary, the lowering of
+  // the intrinsics into a register read will insert one if it is needed.
----------------
Pierre-vh wrote:

> so removing it is presumably just working around some other part of the backend that doesn't know to look through it?

It's a bit of both really
- There's a lot of combines that can't look through it, yes
- It's also really not necessary here because these intrinsics are lowered immediately after and that code will already insert an AssertZext if one is required. Without this we get `(and (assert_zext v31, i10), 1023)` for example.

I'm also not sure AssertZext is strictly an assertion that doesn't generate code. I think some backends use it to guide ISel, and it also has an effect on poison apparently.



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


More information about the llvm-commits mailing list