[PATCH] D48640: [WIP][SROA] Preserve DebugLoc when rewriting alloca partitions
Anastasis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 27 10:17:02 PDT 2018
gramanas updated this revision to Diff 153117.
gramanas added a comment.
Addressing the comments
Repository:
rL LLVM
https://reviews.llvm.org/D48640
Files:
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/alignment.ll
Index: test/Transforms/SROA/alignment.ll
===================================================================
--- test/Transforms/SROA/alignment.ll
+++ test/Transforms/SROA/alignment.ll
@@ -1,4 +1,6 @@
; RUN: opt < %s -sroa -S | FileCheck %s
+; RUN: opt -debugify -instcombine -sroa -S < %s | FileCheck %s -check-prefix DEBUGLOC
+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i1)
@@ -99,6 +101,14 @@
; CHECK: load volatile i16, i16* %{{.*}}, align 1
; CHECK: ret void
+; Check that when sroa rewrites the alloca partition
+; it preserves the original DebugLocation.
+; DEBUGLOC-LABEL: @test5(
+; DEBUGLOC: {{.*}} = alloca {{.*}} !dbg ![[DbgLoc:[0-9]+]]
+; DEBUGLOC-NEXT: {{.*}} = alloca {{.*}} !dbg ![[DbgLoc]]
+
+; DEBUGLOC: ![[DbgLoc]] = !DILocation(
+
entry:
%a = alloca [18 x i8]
%raw1 = getelementptr inbounds [18 x i8], [18 x i8]* %a, i32 0, i32 0
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -4029,6 +4029,8 @@
NewAI = new AllocaInst(
SliceTy, AI.getType()->getAddressSpace(), nullptr, Alignment,
AI.getName() + ".sroa." + Twine(P.begin() - AS.begin()), &AI);
+ // Copy the old AI debug location over to the new one.
+ NewAI->setDebugLoc(AI.getDebugLoc());
++NumNewAllocas;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48640.153117.patch
Type: text/x-patch
Size: 1521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180627/d4735107/attachment.bin>
More information about the llvm-commits
mailing list