[llvm] f416f6c - [X86] LowerABD - remove freeze from abd*(lhs, rhs) -> trunc(abs(sub(*ext(lhs), *ext(rhs))))

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 02:59:54 PST 2023


Author: Simon Pilgrim
Date: 2023-11-08T10:33:18Z
New Revision: f416f6c46d9318877563fbda4f2da94c579c4fa4

URL: https://github.com/llvm/llvm-project/commit/f416f6c46d9318877563fbda4f2da94c579c4fa4
DIFF: https://github.com/llvm/llvm-project/commit/f416f6c46d9318877563fbda4f2da94c579c4fa4.diff

LOG: [X86] LowerABD - remove freeze from abd*(lhs, rhs) -> trunc(abs(sub(*ext(lhs), *ext(rhs))))

Single use each of lhs/rhs so we shouldn't need them.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 22fba5601ccfd38..8002aa0141910c3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -28180,10 +28180,8 @@ static SDValue LowerABD(SDValue Op, const X86Subtarget &Subtarget,
       // abds(lhs, rhs) -> trunc(abs(sub(sext(lhs), sext(rhs))))
       // abdu(lhs, rhs) -> trunc(abs(sub(zext(lhs), zext(rhs))))
       unsigned ExtOpc = IsSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
-      SDValue LHS = DAG.getFreeze(Op.getOperand(0));
-      SDValue RHS = DAG.getFreeze(Op.getOperand(1));
-      LHS = DAG.getNode(ExtOpc, dl, WideVT, LHS);
-      RHS = DAG.getNode(ExtOpc, dl, WideVT, RHS);
+      SDValue LHS = DAG.getNode(ExtOpc, dl, WideVT, Op.getOperand(0));
+      SDValue RHS = DAG.getNode(ExtOpc, dl, WideVT, Op.getOperand(1));
       SDValue Diff = DAG.getNode(ISD::SUB, dl, WideVT, LHS, RHS);
       SDValue AbsDiff = DAG.getNode(ISD::ABS, dl, WideVT, Diff);
       return DAG.getNode(ISD::TRUNCATE, dl, VT, AbsDiff);


        


More information about the llvm-commits mailing list