Fix a trivial use after free.
[oota-llvm.git] / tools / bugpoint / TestPasses.cpp
index 4bfc42c8181ba03cd19f4e31c4b79647045d08df..900bf632a83bb1552d527469c1b3cb27bf8d6d39 100644 (file)
@@ -60,7 +60,7 @@ namespace {
       for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
         if (CallInst *CI = dyn_cast<CallInst>(I)) {
           if (!CI->use_empty())
-            CI->replaceAllUsesWith(BB.getContext().getNullValue(CI->getType()));
+            CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
           CI->getParent()->getInstList().erase(CI);
           break;
         }