1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

don't delete the last store to an alloca if the store is volatile.

llvm-svn: 50390
This commit is contained in:
Chris Lattner 2008-04-29 04:58:38 +00:00
parent 0f63b8fecc
commit 51fe8415da
2 changed files with 9 additions and 1 deletions

View File

@ -10311,7 +10311,7 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
// If the RHS is an alloca with a single use, zapify the store, making the
// alloca dead.
if (Ptr->hasOneUse()) {
if (Ptr->hasOneUse() && !SI.isVolatile()) {
if (isa<AllocaInst>(Ptr)) {
EraseInstFromFunction(SI);
++NumCombined;

View File

@ -0,0 +1,8 @@
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
define void @test() {
%votf = alloca <4 x float> ; <<4 x float>*> [#uses=1]
volatile store <4 x float> zeroinitializer, <4 x float>* %votf, align 16
ret void
}