Skip to content

Commit

Permalink
[SDAG] enable binop identity constant folds for multiplies
Browse files Browse the repository at this point in the history
Add mul to the list of ops that we canonicalize with a select to expose an identity merge

Differential Revision: https://reviews.llvm.org/D122071
  • Loading branch information
RKSimon committed Mar 25, 2022
1 parent 8639bc1 commit e209190
Show file tree
Hide file tree
Showing 5 changed files with 652 additions and 1,127 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,8 @@ static SDValue foldSelectWithIdentityConstant(SDNode *N, SelectionDAG &DAG,
case ISD::SRA: // X s>> 0 --> X
case ISD::SRL: // X u>> 0 --> X
return C->isZero();
case ISD::MUL: // X * 1 --> X
return C->isOne();
}
}
return false;
Expand Down
Loading

0 comments on commit e209190

Please sign in to comment.