[llvm] 0ab99bb - [NFC][SCEV] Cleanup lowering of @llvm.uadd.sat, (-1 - V) is just ~V

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 12:11:30 PDT 2020


Author: Roman Lebedev
Date: 2020-09-21T22:10:59+03:00
New Revision: 0ab99bb314203d8f3b40e805ffea03857ca5c21e

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

LOG: [NFC][SCEV] Cleanup lowering of @llvm.uadd.sat, (-1 - V) is just ~V

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index b82132d1d90c..46664192d70c 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6368,11 +6368,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
       case Intrinsic::uadd_sat: {
         const SCEV *X = getSCEV(II->getArgOperand(0));
         const SCEV *Y = getSCEV(II->getArgOperand(1));
-        const SCEV *ClampedX = getUMinExpr(
-            X, getMinusSCEV(
-                   getConstant(cast<ConstantInt>(
-                       Constant::getAllOnesValue(II->getType()))),
-                   Y, (SCEV::NoWrapFlags)(SCEV::FlagNSW | SCEV::FlagNUW)));
+        const SCEV *ClampedX = getUMinExpr(X, getNotSCEV(Y));
         return getAddExpr(ClampedX, Y, SCEV::FlagNUW);
       }
       default:


        


More information about the llvm-commits mailing list