[llvm] [RISCV] Insert a freeze before converting select to AND/OR. (PR #84232)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 14:35:32 PST 2024
================
@@ -7289,14 +7290,14 @@ static SDValue combineSelectToBinOp(SDNode *N, SelectionDAG &DAG,
// (select x, x, y) -> x | y
// (select !x, x, y) -> x & y
if (std::optional<bool> MatchResult = matchSetCC(LHS, RHS, CC, TrueV)) {
- return DAG.getNode(*MatchResult ? ISD::OR : ISD::AND, DL, VT, TrueV,
- FalseV);
+ return DAG.getNode(*MatchResult ? ISD::OR : ISD::AND, DL, VT,
+ DAG.getFreeze(TrueV), DAG.getFreeze(FalseV));
----------------
nikic wrote:
You do still need the freeze on y (FalseV), just not on x (TrueV).
https://github.com/llvm/llvm-project/pull/84232
More information about the llvm-commits
mailing list