gdb uses DW_AT_prototyped to identify K&R style in C based languages.
[oota-llvm.git] / lib / Analysis / SparsePropagation.cpp
index e2c739d54185ea97687c3e62c4cd6980bb5ebd8b..8f042c278392f6645bab6954233de8be3200b361 100644 (file)
@@ -57,8 +57,10 @@ SparseSolver::LatticeVal SparseSolver::getOrInitValueState(Value *V) {
     return LatticeFunc->getUntrackedVal();
   else if (Constant *C = dyn_cast<Constant>(V))
     LV = LatticeFunc->ComputeConstant(C);
+  else if (Argument *A = dyn_cast<Argument>(V))
+    LV = LatticeFunc->ComputeArgument(A);
   else if (!isa<Instruction>(V))
-    // Non-instructions (e.g. formal arguments) are overdefined.
+    // All other non-instructions are overdefined.
     LV = LatticeFunc->getOverdefinedVal();
   else
     // All instructions are underdefined by default.
@@ -96,10 +98,10 @@ void SparseSolver::markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest) {
   if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second)
     return;  // This edge is already known to be executable!
   
+  DOUT << "Marking Edge Executable: " << Source->getNameStart()
+       << " -> " << Dest->getNameStart() << "\n";
+
   if (BBExecutable.count(Dest)) {
-    DOUT << "Marking Edge Executable: " << Source->getNameStart()
-    << " -> " << Dest->getNameStart() << "\n";
-    
     // The destination is already executable, but we just made an edge
     // feasible that wasn't before.  Revisit the PHI nodes in the block
     // because they have potentially new operands.
@@ -272,7 +274,7 @@ void SparseSolver::visitInst(Instruction &I) {
 }
 
 void SparseSolver::Solve(Function &F) {
-  MarkBlockExecutable(F.begin());
+  MarkBlockExecutable(&F.getEntryBlock());
   
   // Process the work lists until they are empty!
   while (!BBWorkList.empty() || !InstWorkList.empty()) {