[llvm] r260451 - Follow up to 260439, Speculative fix to clang builders

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 14:22:41 PST 2016


Author: reames
Date: Wed Feb 10 16:22:41 2016
New Revision: 260451

URL: http://llvm.org/viewvc/llvm-project?rev=260451&view=rev
Log:
Follow up to 260439, Speculative fix to clang builders

It looks like clang has a couple of test cases which caught the fact LVI was not slightly more precise after 260439.  When looking at the failures, it struck me as wasteful to be querying nullness of a constant via LVI, so instead of tweaking the clang tests, let's just stop querying constants from this source.


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

Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=260451&r1=260450&r2=260451&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Wed Feb 10 16:22:41 2016
@@ -312,8 +312,11 @@ bool CorrelatedValuePropagation::process
 
   for (Value *V : CS.args()) {
     PointerType *Type = dyn_cast<PointerType>(V->getType());
-
+    // Try to mark pointer typed parameters as non-null.  We skip the
+    // relatively expensive analysis for constants which are obviously either
+    // null or non-null to start with.
     if (Type && !CS.paramHasAttr(ArgNo + 1, Attribute::NonNull) &&
+        !isa<Constant>(V) && 
         LVI->getPredicateAt(ICmpInst::ICMP_EQ, V,
                             ConstantPointerNull::get(Type),
                             CS.getInstruction()) == LazyValueInfo::False)




More information about the llvm-commits mailing list