Fix a bug where we didn't realize that vaarg reads memory. This fixes
authorChris Lattner <sabre@nondot.org>
Wed, 30 Nov 2005 19:38:22 +0000 (19:38 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 30 Nov 2005 19:38:22 +0000 (19:38 +0000)
Transforms/DeadStoreElimination/2005-11-30-vaarg.ll

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

lib/Transforms/Scalar/DeadStoreElimination.cpp

index 07d5c655205cd76afac80c0c0dbf9767d50b794d..d3f461d3182440ad2fac58ced4539428eaed9e56 100644 (file)
@@ -96,6 +96,13 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
     }
 
     if (!isa<StoreInst>(I) || cast<StoreInst>(I)->isVolatile()) {
+      // If this is a vaarg instruction, it reads its operand.  We don't model
+      // it correctly, so just conservatively remove all entries.
+      if (isa<VAArgInst>(I)) {
+        KillLocs.clear();
+        continue;
+      }      
+      
       // If this is a non-store instruction, it makes everything referenced no
       // longer killed.  Remove anything aliased from the alias set tracker.
       KillLocs.remove(I);