[llvm] [AMDGPU] Delete redundant s_or_b32 (PR #165261)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 08:25:52 PST 2025
================
@@ -10689,6 +10691,33 @@ bool SIInstrInfo::optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
if (!optimizeSCC(Def, &CmpInstr, RI))
return false;
+ // If s_or_b32 result, sY, is unused (i.e. it is effectively a 64-bit
+ // s_cmp_lg of a register pair) and the inputs are the hi and lo-halves of a
+ // 64-bit foldableSelect then delete s_or_b32 in the sequence:
+ // sX = s_cselect_b64 (non-zero imm), 0
+ // sLo = copy sX.sub0
+ // sHi = copy sX.sub1
+ // sY = s_or_b32 sLo, sHi
----------------
shiltian wrote:
This pattern is very specific. If `sY` is dead`, won't all its operands be dead automatically (if there is no other uses)? Why do we need to have a special handling here?
https://github.com/llvm/llvm-project/pull/165261
More information about the llvm-commits
mailing list