Make sure the caller doesn't use freed memory.
authorDuncan Sands <baldrick@free.fr>
Sun, 20 Jan 2008 16:51:46 +0000 (16:51 +0000)
committerDuncan Sands <baldrick@free.fr>
Sun, 20 Jan 2008 16:51:46 +0000 (16:51 +0000)
Fixes PR1935.

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

lib/Transforms/Scalar/CodeGenPrepare.cpp

index 8d6c923ab1347fb494fe61ca3ede1c763c570f77..5c572a640ed018f3339a3aa04334731e1aa93bf3 100644 (file)
@@ -401,8 +401,10 @@ static bool OptimizeNoopCopyExpression(CastInst *CI, const TargetLowering &TLI){
   }
   
   // If we removed all uses, nuke the cast.
-  if (CI->use_empty())
+  if (CI->use_empty()) {
     CI->eraseFromParent();
+    MadeChange = true;
+  }
   
   return MadeChange;
 }