[llvm] [SDAG] Combine select into ABD?, for const (PR #173581)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 27 06:09:44 PST 2025
================
@@ -12360,29 +12360,43 @@ SDValue DAGCombiner::foldSelectToABD(SDValue LHS, SDValue RHS, SDValue True,
if (LegalOperations && !hasOperation(ABDOpc, VT))
return SDValue();
+ if (!VT.isInteger())
+ return SDValue();
+
+ // Hack to support constants. (sub a, const) becomes (add a, -const)
+ SDValue NegRHS = DAG.getNegative(RHS, SDLoc(RHS), VT),
+ NegLHS = DAG.getNegative(LHS, SDLoc(LHS), VT);
----------------
RKSimon wrote:
This will create nodes every time the fold is attempted. Can you limit this to cases where LHS/RHS are constant and use m_SpecificInt - or we could even create a m_SpecificNeg() ?
https://github.com/llvm/llvm-project/pull/173581
More information about the llvm-commits
mailing list