This is an archive of the discontinued LLVM Phabricator instance.

Update vectorization debug info unittest.
ClosedPublic

Authored by danielcdh on Nov 8 2016, 3:21 PM.

Details

Summary

The change will test the change in r286159.
The idea behind the change: Make the dbg location different between loop header and preheader/exit. Originally, dbg location 21 exists in 3 BBs: preheader, header, critical edge (exit). Update the debug location of inside the loop header from !21 to !22 so that it will reflect the correct location.

Event Timeline

danielcdh updated this revision to Diff 77276.Nov 8 2016, 3:21 PM
danielcdh retitled this revision from to Update vectorization debug info unittest..
danielcdh updated this object.
danielcdh added a reviewer: probinson.
danielcdh added a subscriber: llvm-commits.
probinson edited edge metadata.Nov 9 2016, 10:58 AM

I built opt r286158 and r286159. Running the modified test through both copies of opt, I get identical output .ll files. This tells me that the modified test does not actually test r286159. I should get different outputs, that reflect the code change.

test/Transforms/LoopVectorize/debugloc.ll
8

This line sets the LOC variable but it is no longer used elsewhere.

That's weird. From my testing:

#svn info
Path: .
Working Copy Root Path: /ssd/llvm1
URL: https://dehao@llvm.org/svn/llvm-project/llvm/trunk
Relative URL: ^/llvm/trunk
Repository Root: https://dehao@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 286307
Node Kind: directory
Schedule: normal
Last Changed Author: zturner
Last Changed Rev: 286305
Last Changed Date: 2016-11-08 14:30:11 -0800 (Tue, 08 Nov 2016)

#svn diff

Index: test/Transforms/LoopVectorize/debugloc.ll

  • test/Transforms/LoopVectorize/debugloc.ll (revision 286307)

+++ test/Transforms/LoopVectorize/debugloc.ll (working copy)
@@ -7,12 +7,12 @@
; CHECK: for.body.lr.ph
; CHECK: cmp.zero = icmp eq i64 {{.*}}, 0, !dbg ![[LOC:[0-9]+]]
; CHECK: vector.body
-; CHECK: index {{.*}}, !dbg ![[LOC]]
-; CHECK: getelementptr inbounds i32, i32* %a, {{.*}}, !dbg ![[LOC2:[0-9]+]]
+; CHECK: index {{.*}}, !dbg ![[LOC2:[0-9]+]]
+; CHECK: getelementptr inbounds i32, i32* %a, {{.*}}, !dbg ![[LOC2]]
; CHECK: load <2 x i32>, <2 x i32>* {{.*}}, !dbg ![[LOC2]]
; CHECK: add <2 x i32> {{.*}}, !dbg ![[LOC2]]
-; CHECK: add i64 %index, 2, !dbg ![[LOC]]
-; CHECK: icmp eq i64 %index.next, %n.vec, !dbg ![[LOC]]
+; CHECK: add i64 %index, 2, !dbg ![[LOC2]]
+; CHECK: icmp eq i64 %index.next, %n.vec, !dbg ![[LOC2]]
; CHECK: middle.block
; CHECK: add <2 x i32> %{{.*}}, %rdx.shuf, !dbg ![[LOC2]]
; CHECK: extractelement <2 x i32> %bin.rdx, i32 0, !dbg ![[LOC2]]
@@ -36,10 +36,10 @@

%0 = load i32, i32* %arrayidx, align 4, !dbg !22
%add = add i32 %0, %sum.05, !dbg !22
tail call void @llvm.dbg.value(metadata i32 %add.lcssa, i64 0, metadata !15, metadata !DIExpression()), !dbg !22
  • %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !21
  • tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !16, metadata !DIExpression()), !dbg !21
  • %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !21
  • %exitcond = icmp ne i32 %lftr.wideiv, %size, !dbg !21

+ %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !22
+ tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !16, metadata !DIExpression()), !dbg !22
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !22
+ %exitcond = icmp ne i32 %lftr.wideiv, %size, !dbg !22

br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge, !dbg !21

for.cond.for.end_crit_edge: ; preds = %for.body

#cd build.gccopt;make -j64;cd ..
#build.gccopt/bin/llvm-lit test/Transforms/LoopVectorize/debugloc.ll -v

  • Testing: 1 tests, 1 threads --

PASS: LLVM :: Transforms/LoopVectorize/debugloc.ll (1 of 1)
Testing Time: 0.24s

Expected Passes    : 1

#svn diff -r 286159:286158 |patch -p0
#cd build.gccopt;make -j64;cd ..
#build.gccopt/bin/llvm-lit test/Transforms/LoopVectorize/debugloc.ll -v

  • Testing: 1 tests, 1 threads --

FAIL: LLVM :: Transforms/LoopVectorize/debugloc.ll (1 of 1)

  • TEST 'LLVM :: Transforms/LoopVectorize/debugloc.ll' FAILED ****

Script:

/ssd/llvm1/build.gccopt/./bin/opt -S < /ssd/llvm1/test/Transforms/LoopVectorize/debugloc.ll -loop-vectorize -force-vector-interleave=1 -force-vector-width=2 | /ssd/llvm1/build.gccopt/./bin/FileCheck /ssd/llvm1/test/Transforms/LoopVectorize/debugloc.ll

Exit Code: 1

Command Output (stderr):

/ssd/llvm1/test/Transforms/LoopVectorize/debugloc.ll:14:10: error: expected string not found in input
; CHECK: add i64 %index, 2, !dbg ![[LOC2]]

^

<stdin>:43:2: note: scanning from here
%8 = add i64 %3, 1, !dbg !22
^
<stdin>:43:2: note: with variable "LOC2" equal to "22"
%8 = add i64 %3, 1, !dbg !22
^
<stdin>:45:16: note: possible intended match here
%index.next = add i64 %index, 2, !dbg !21

^

Testing Time: 0.25s


Failing Tests (1):

  LLVM :: Transforms/LoopVectorize/debugloc.ll

Unexpected Failures: 1

I will try again. Maybe I messed up my build.

probinson accepted this revision.Nov 9 2016, 2:06 PM
probinson edited edge metadata.

Okay, a clean build shows that the modified test does get different results with r286159.
Fix the one inline comment and LGTM.

This revision is now accepted and ready to land.Nov 9 2016, 2:06 PM
danielcdh updated this revision to Diff 77395.Nov 9 2016, 2:34 PM
danielcdh edited edge metadata.

update

danielcdh closed this revision.Nov 9 2016, 2:34 PM