aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-04-15 15:21:30 +0100
committerFlorian Hahn <flo@fhahn.com>2020-04-15 15:23:43 +0100
commitb5786082568ffca22fc044b79b0e58755c2f931c (patch)
treea503f83b83a260215af1bfc8ef17960140cd03dc
parent17198dfaff53a897edfc8d440a91cb9430982dcf (diff)
downloadllvm-b5786082568ffca22fc044b79b0e58755c2f931c.zip
llvm-b5786082568ffca22fc044b79b0e58755c2f931c.tar.gz
llvm-b5786082568ffca22fc044b79b0e58755c2f931c.tar.bz2
[DSE,MSSA] Add use of alloca, to guard against removal in the future.
Currently the alloca does not escape and all stores and the memset can be removed. Adding a use of the alloca ensures not all stores are eliminated.
-rw-r--r--llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
index 11d155c..80db7f5 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
@@ -4,6 +4,7 @@
; RUN: opt -S -march=native -dse -enable-dse-memoryssa < %s| FileCheck %s
; CHECK: bitcast [5 x i64]* %{{[a-zA-Z_][a-zA-Z0-9_]*}} to i8*, !dbg
; CHECK-NEXT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %0, i64 32, !dbg ![[DBG:[0-9]+]]
+; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 16 %1, i8 0, i64 8, i1 false), !dbg ![[DBG:[0-9]+]]
; CHECK: ![[DBG]] = !DILocation(line: 2,
; The test IR is generated by running:
@@ -21,6 +22,8 @@
; }
+declare void @use([5 x i64]*)
+
define dso_local i32 @_Z1av() !dbg !7 {
entry:
%retval = alloca i32, align 4
@@ -37,6 +40,7 @@ entry:
store i64 2, i64* %4, align 16, !dbg !16
%5 = getelementptr inbounds [5 x i64], [5 x i64]* %1, i32 0, i32 3, !dbg !16
store i64 2, i64* %5, align 8, !dbg !16
+ call void @use([5 x i64]* %b)
%call = call i32 @_Z1av(), !dbg !17
%tobool = icmp ne i32 %call, 0, !dbg !17
br i1 %tobool, label %if.then, label %if.end, !dbg !19