From 4f75e1ae308c22c4ab16c6a002f0f93f8dcec02a Mon Sep 17 00:00:00 2001 From: AZero13 Date: Thu, 10 Jul 2025 14:26:53 -0400 Subject: [PATCH] Remove PeekThroughFreeze (NFC) Now that SelectionDAG already peeks through freezes, this is not needed anymore. --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 9ffdda28f7899..6767606f0719a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4067,18 +4067,12 @@ SDValue DAGCombiner::visitSUB(SDNode *N) { unsigned BitWidth = VT.getScalarSizeInBits(); SDLoc DL(N); - auto PeekThroughFreeze = [](SDValue N) { - if (N->getOpcode() == ISD::FREEZE && N.hasOneUse()) - return N->getOperand(0); - return N; - }; - if (SDValue V = foldSubCtlzNot(N, DAG)) return V; // fold (sub x, x) -> 0 // FIXME: Refactor this and xor and other similar operations together. - if (PeekThroughFreeze(N0) == PeekThroughFreeze(N1)) + if (N0 == N1) return tryFoldToZero(DL, TLI, VT, DAG, LegalOperations); // fold (sub c1, c2) -> c3