[llvm] b578608 - [DSE,MSSA] Add use of alloca, to guard against removal in the future.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 07:24:16 PDT 2020
Author: Florian Hahn
Date: 2020-04-15T15:23:43+01:00
New Revision: b5786082568ffca22fc044b79b0e58755c2f931c
URL: https://github.com/llvm/llvm-project/commit/b5786082568ffca22fc044b79b0e58755c2f931c
DIFF: https://github.com/llvm/llvm-project/commit/b5786082568ffca22fc044b79b0e58755c2f931c.diff
LOG: [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.
Added:
Modified:
llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
index 11d155c5fc1e..80db7f5d6b6e 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
More information about the llvm-commits
mailing list