[llvm] [SelectionDAG] Fold (icmp eq/ne (shift X, C), 0) -> (icmp eq/ne X, 0) (PR #88801)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 02:18:50 PDT 2024


================
@@ -4530,20 +4530,13 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
          N0.getOpcode() == ISD::SRA)) {
       bool IsRightShift = N0.getOpcode() != ISD::SHL;
       SDValue N00 = N0.getOperand(0);
-      // Quick checks based on exact/nuw/nsw flags.
-      if (IsRightShift ? N0->getFlags().hasExact()
-                       : (N0->getFlags().hasNoUnsignedWrap() ||
-                          N0->getFlags().hasNoSignedWrap()))
+      // We cam't rely on flags already being present on all shift operations,
----------------
arsenm wrote:

```suggestion
      // We can't rely on flags already being present on all shift operations,
```

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


More information about the llvm-commits mailing list