[llvm] [X86] Fix potential CSE issues in commuteSelect multi-use path (PR #214092)
Timur Golubovich via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 05:07:09 PDT 2026
================
@@ -48594,11 +48594,14 @@ static SDValue commuteSelect(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
return DAG.getSelect(DL, LHS.getValueType(), NewCond, RHS, LHS);
// Invert the setcc for all users and commute all vselects.
+ SmallVector<SDNode *> UsersToUpdate(Cond->users());
DAG.ReplaceAllUsesOfValueWith(Cond, NewCond);
- for (SDNode *User : NewCond->users()) {
+ for (SDNode *User : UsersToUpdate) {
SDValue UserLHS = User->getOperand(1);
SDValue UserRHS = User->getOperand(2);
- DAG.UpdateNodeOperands(User, NewCond, UserRHS, UserLHS);
+ [[maybe_unused]] SDNode *Updated =
+ DAG.UpdateNodeOperands(User, NewCond, UserRHS, UserLHS);
----------------
timurgol007 wrote:
@phoebewang, no, we don't need it. Thank you, this is a good catch
https://github.com/llvm/llvm-project/pull/214092
More information about the llvm-commits
mailing list