[llvm-commits] [llvm] r89434 - /llvm/trunk/lib/Analysis/CaptureTracking.cpp

Dan Gohman gohman at apple.com
Thu Nov 19 17:34:03 PST 2009


Author: djg
Date: Thu Nov 19 19:34:03 2009
New Revision: 89434

URL: http://llvm.org/viewvc/llvm-project?rev=89434&view=rev
Log:
Simplify this code; it's not necessary to check isIdentifiedObject here
because if the results from getUnderlyingObject match, the values must
be from the same underlying object, even if we don't know what that
object is.

Modified:
    llvm/trunk/lib/Analysis/CaptureTracking.cpp

Modified: llvm/trunk/lib/Analysis/CaptureTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CaptureTracking.cpp?rev=89434&r1=89433&r2=89434&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/CaptureTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/CaptureTracking.cpp Thu Nov 19 19:34:03 2009
@@ -105,7 +105,7 @@
           Worklist.push_back(U);
       }
       break;
-    case Instruction::ICmp: {
+    case Instruction::ICmp:
       // Don't count comparisons of the original value against null as captures.
       // This allows us to ignore comparisons of malloc results with null,
       // for example.
@@ -114,16 +114,14 @@
               dyn_cast<ConstantPointerNull>(I->getOperand(1)))
           if (CPN->getType()->getAddressSpace() == 0)
             break;
-      // Don't count comparisons of two pointers within the same identified
-      // object as captures.
-      Value *O0 = I->getOperand(0)->getUnderlyingObject();
-      if (isIdentifiedObject(O0) &&
-          O0 == I->getOperand(1)->getUnderlyingObject())
+      // Don't count comparisons of two pointers within the same object
+      // as captures.
+      if (I->getOperand(0)->getUnderlyingObject() ==
+          I->getOperand(1)->getUnderlyingObject())
         break;
       // Otherwise, be conservative. There are crazy ways to capture pointers
       // using comparisons.
       return true;
-    }
     default:
       // Something else - be conservative and say it is captured.
       return true;





More information about the llvm-commits mailing list