[llvm-commits] [llvm] r101902 - /llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Dan Gohman gohman at apple.com
Tue Apr 20 07:50:14 PDT 2010


Author: djg
Date: Tue Apr 20 09:50:13 2010
New Revision: 101902

URL: http://llvm.org/viewvc/llvm-project?rev=101902&view=rev
Log:
Sink this use_empty() check into isUsedOutsideOfDefiningBlock.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=101902&r1=101901&r2=101902&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Tue Apr 20 09:50:13 2010
@@ -124,6 +124,7 @@
 /// PHI nodes or outside of the basic block that defines it, or used by a
 /// switch or atomic instruction, which may expand to multiple basic blocks.
 static bool isUsedOutsideOfDefiningBlock(const Instruction *I) {
+  if (I->use_empty()) return false;
   if (isa<PHINode>(I)) return true;
   const BasicBlock *BB = I->getParent();
   for (Value::const_use_iterator UI = I->use_begin(), E = I->use_end();
@@ -190,7 +191,7 @@
 
   for (; BB != EB; ++BB)
     for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
-      if (!I->use_empty() && isUsedOutsideOfDefiningBlock(I))
+      if (isUsedOutsideOfDefiningBlock(I))
         if (!isa<AllocaInst>(I) ||
             !StaticAllocaMap.count(cast<AllocaInst>(I)))
           InitializeRegForValue(I);





More information about the llvm-commits mailing list