From 2bd4cb597a58d0a8f1ff332c2f50ed8232cc5898 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 30 Nov 2005 19:38:22 +0000 Subject: [PATCH] Fix a bug where we didn't realize that vaarg reads memory. This fixes 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 07d5c655205..d3f461d3182 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -96,6 +96,13 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { } if (!isa(I) || cast(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(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); -- 2.34.1