[PATCH] D48968: [DebugInfo][LoopVectorize] Preserve DL in induction PHI and Add
Anastasis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 5 06:42:04 PDT 2018
gramanas created this revision.
gramanas added a reviewer: vsk.
Herald added subscribers: llvm-commits, JDevlieghere.
Continuation of https://reviews.llvm.org/D48769.
In this case the induction phi and add instructions created
in the vector part of the loop were missing DL.
The i8-induction.ll also fails debugify even after this patch:
opt -S -enable-debugify -loop-vectorize i8-induction.ll -disable-output
ERROR: Instruction with empty DebugLoc in function f -- %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
ERROR: Instruction with empty DebugLoc in function f -- %vec.phi = phi <4 x i8> [ <i8 0, i8 1, i8 1, i8 1>, %vector.ph ], [ %5, %vector.body ]
ERROR: Instruction with empty DebugLoc in function f -- %index.next = add i32 %index, 4
ERROR: Instruction with empty DebugLoc in function f -- %9 = icmp eq i32 %index.next, 16
ERROR: Instruction with empty DebugLoc in function f -- br i1 %9, label %middle.block, label %vector.body, !llvm.loop !32
ERROR: Instruction with empty DebugLoc in function f -- %cmp.n = icmp eq i32 16, 16
ERROR: Instruction with empty DebugLoc in function f -- %bc.merge.rdx = phi i8 [ 0, %scalar.ph ], [ %10, %middle.block ]
ERROR: Instruction with empty DebugLoc in function f -- %mul.lcssa = phi i8 [ %mul, %for.body ], [ %10, %middle.block ]
CheckModuleDebugify: FAIL
but those are from different parts of the code so they will be dealt with in
another patch.
Repository:
rL LLVM
https://reviews.llvm.org/D48968
Files:
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/i8-induction.ll
Index: test/Transforms/LoopVectorize/i8-induction.ll
===================================================================
--- test/Transforms/LoopVectorize/i8-induction.ll
+++ test/Transforms/LoopVectorize/i8-induction.ll
@@ -1,11 +1,18 @@
; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S
+; RUN: opt < %s -debugify -loop-vectorize -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:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
@a = common global i8 0, align 1
@b = common global i8 0, align 1
define void @f() nounwind uwtable ssp {
+; Check that the induction phis and adds have debug location
+; DEBUGLOC-LABEL vector.body:
+; DEBUGLOC: %vec.ind = phi {{.*}}, !dbg ![[DbgLoc:[0-9]+]]
+; DEBUGLOC: %vec.ind.next = add {{.*}}, !dbg ![[DbgLoc]]
+;
+; DEBUGLOC: ![[DbgLoc]] = !DILocation(line: 5
scalar.ph:
store i8 0, i8* inttoptr (i64 1 to i8*), align 1
%0 = load i8, i8* @a, align 1
Index: lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- lib/Transforms/Vectorize/LoopVectorize.cpp
+++ lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1821,6 +1821,7 @@
// factor. The last of those goes into the PHI.
PHINode *VecInd = PHINode::Create(SteppedStart->getType(), 2, "vec.ind",
&*LoopVectorBody->getFirstInsertionPt());
+ VecInd->setDebugLoc(EntryVal->getDebugLoc());
Instruction *LastInduction = VecInd;
for (unsigned Part = 0; Part < UF; ++Part) {
VectorLoopValueMap.setVectorValue(EntryVal, Part, LastInduction);
@@ -1831,6 +1832,7 @@
LastInduction = cast<Instruction>(addFastMathFlag(
Builder.CreateBinOp(AddOp, LastInduction, SplatVF, "step.add")));
+ LastInduction->setDebugLoc(EntryVal->getDebugLoc());
}
// Move the last step to the end of the latch block. This ensures consistent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48968.154222.patch
Type: text/x-patch
Size: 2039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180705/bb87acf2/attachment.bin>
More information about the llvm-commits
mailing list