[llvm] [DAGCombine] Fold icmp with chain of or of loads (PR #139165)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 23:32:43 PDT 2025


================
@@ -28654,7 +28738,15 @@ SDValue DAGCombiner::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
                                    bool foldBooleans) {
   TargetLowering::DAGCombinerInfo
     DagCombineInfo(DAG, Level, false, this);
-  return TLI.SimplifySetCC(VT, N0, N1, Cond, foldBooleans, DagCombineInfo, DL);
+  if (SDValue C =
+          TLI.SimplifySetCC(VT, N0, N1, Cond, foldBooleans, DagCombineInfo, DL))
+    return C;
+
+  if ((Cond == ISD::SETNE || Cond == ISD::SETEQ) && isNullConstant(N1) &&
+      N0.getOpcode() == ISD::OR)
+    if (SDValue Load = MatchOrOfLoadToLargeLoad(N0, DAG, TLI))
----------------
arsenm wrote:

```suggestion
  if ((Cond == ISD::SETNE || Cond == ISD::SETEQ) && N0.getOpcode() == ISD::OR && 
       isNullConstant(N1))
    if (SDValue Load = MatchOrOfLoadToLargeLoad(N0, DAG, TLI))
```

Is this assuming zero ext bool handling? Seems invalid for the any ext case?

https://github.com/llvm/llvm-project/pull/139165


More information about the llvm-commits mailing list