Fix the problem with running cleanups in bugpoint: We were deleting arguments
authorChris Lattner <sabre@nondot.org>
Wed, 5 Nov 2003 21:53:41 +0000 (21:53 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 5 Nov 2003 21:53:41 +0000 (21:53 +0000)
of intrinsic functions, causing the verifier to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9745 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/DeadArgumentElimination.cpp

index 265c6267602ccc21cb5af49fda905daeefd20222..9003f8877f7dd9f65271f59e84046958fe38e9c5 100644 (file)
@@ -99,6 +99,8 @@ namespace {
   struct DAH : public DAE {
     virtual bool ShouldHackArguments() const { return true; }
   };
+  RegisterPass<DAH> Y("deadarghaX0r",
+                      "Dead Argument Hacking (bugpoint usage only)");
 }
 
 /// createDeadArgEliminationPass - This pass removes arguments from functions
@@ -163,7 +165,8 @@ void DAE::SurveyFunction(Function &F) {
   bool FunctionIntrinsicallyLive = false;
   Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead;
 
-  if (!F.hasInternalLinkage() && !ShouldHackArguments()) 
+  if (!F.hasInternalLinkage() &&
+      (!ShouldHackArguments() || F.getIntrinsicID()))
     FunctionIntrinsicallyLive = true;
   else 
     for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {