[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 12:57:12 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 don't need to freeze x, as it's part of the select condition.
https://github.com/llvm/llvm-project/pull/84232
    
    
More information about the llvm-commits
mailing list