[llvm] fe7b3ad - [CVP] LVI: Use in-block values when checking value signedness domain

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 10 11:25:13 PDT 2021


Author: Roman Lebedev
Date: 2021-04-10T21:10:59+03:00
New Revision: fe7b3ad8d5f7bf5f38ccdc5bd11ba0ff5656aeb5

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

LOG: [CVP] LVI: Use in-block values when checking value signedness domain

This has a huge positive impact on all the folds that use these helpers,
as it can be seen on vanilla test-suite + rawspeed + darktable:
correlated-value-propagation.NumSRems             +75.68% (+ 28)
correlated-value-propagation.NumAShrs             +63.87% (+198)
correlated-value-propagation.NumSDivs             +49.42% (+127)
correlated-value-propagation.NumSExt              + 8.85% (+593)
correlated-value-propagation.NumUDivURemsNarrowed	+ 8.65% (+34)

... while having pretty minimal compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=e8c7f43e2c2c6f3581ec1c6489ec21ad9f98958a&to=4cd197711e58ee1b2faeee0c35eea54540185569&stat=instructions

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 9a62f2f6641a..f561dc88e9ba 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -620,14 +620,14 @@ static bool processCallSite(CallBase &CB, LazyValueInfo *LVI) {
 static bool isNonNegative(Value *V, LazyValueInfo *LVI, Instruction *CxtI) {
   Constant *Zero = ConstantInt::get(V->getType(), 0);
   auto Result = LVI->getPredicateAt(ICmpInst::ICMP_SGE, V, Zero, CxtI,
-                                    /*UseBlockValue=*/false);
+                                    /*UseBlockValue=*/true);
   return Result == LazyValueInfo::True;
 }
 
 static bool isNonPositive(Value *V, LazyValueInfo *LVI, Instruction *CxtI) {
   Constant *Zero = ConstantInt::get(V->getType(), 0);
   auto Result = LVI->getPredicateAt(ICmpInst::ICMP_SLE, V, Zero, CxtI,
-                                    /*UseBlockValue=*/false);
+                                    /*UseBlockValue=*/true);
   return Result == LazyValueInfo::True;
 }
 


        


More information about the llvm-commits mailing list