[llvm-commits] [llvm] r52542 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Dan Gohman gohman at apple.com
Fri Jun 20 09:39:44 PDT 2008


Author: djg
Date: Fri Jun 20 11:39:44 2008
New Revision: 52542

URL: http://llvm.org/viewvc/llvm-project?rev=52542&view=rev
Log:
Fix the conditions under which SCCP should examine insertvalue
instructions. Thanks to Matthijs Kooijman for pointing this out!

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

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=52542&r1=52541&r2=52542&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Fri Jun 20 11:39:44 2008
@@ -750,7 +750,7 @@
   Value *Val = IVI.getOperand(1);
 
   // If the operand to the getresult is an undef, the result is undef.
-  if (isa<UndefValue>(Aggr))
+  if (isa<UndefValue>(Aggr) && isa<UndefValue>(Val))
     return;
 
   // Currently only handle single-index insertvalues.
@@ -758,6 +758,23 @@
     markOverdefined(&IVI);
     return;
   }
+
+  // Currently only handle insertvalue instructions that are in a single-use
+  // chain that builds up a return value.
+  for (const InsertValueInst *TmpIVI = &IVI; ; ) {
+    if (!TmpIVI->hasOneUse()) {
+      markOverdefined(&IVI);
+      return;
+    }
+    const Value *V = *TmpIVI->use_begin();
+    if (isa<ReturnInst>(V))
+      break;
+    TmpIVI = dyn_cast<InsertValueInst>(V);
+    if (!TmpIVI) {
+      markOverdefined(&IVI);
+      return;
+    }
+  }
   
   // See if we are tracking the result of the callee.
   Function *F = IVI.getParent()->getParent();





More information about the llvm-commits mailing list