[polly] r292470 - Improve test coverage in test/Isl/CodeGen/loop_partially_in_scop.ll [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 20:54:45 PST 2017


Author: grosser
Date: Wed Jan 18 22:54:45 2017
New Revision: 292470

URL: http://llvm.org/viewvc/llvm-project?rev=292470&view=rev
Log:
Improve test coverage in test/Isl/CodeGen/loop_partially_in_scop.ll [NFC]

We rename the test case with -metarenamer to make the variable names easier to
read and add additional check lines that verify the code we currently generate
for PHI nodes. This code is interesting as it contains a PHI node in a
non-affine sub-region, where some incoming blocks are within the non-affine
sub-region and others are outside of the non-affine subregion.

As can be seen in the check lines we currently load the PHI-node value twice.
This commit documents this behavior. In a subsequent patch we will try to
improve this.

Modified:
    polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll

Modified: polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll?rev=292470&r1=292469&r2=292470&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll (original)
+++ polly/trunk/test/Isl/CodeGen/loop_partially_in_scop.ll Wed Jan 18 22:54:45 2017
@@ -1,33 +1,50 @@
 ; RUN: opt %loadPolly -S -polly-codegen < %s | FileCheck %s
 ;
-; Verify we do not crash for this test case.
+; Verify we do not crash for this test case and additionally check the code
+; that we generate for the %tmp PHI node in the non-affine region. This code
+; is difficult to generate as some incoming edges are from basic blocks
+; from within the region and others from basic blocks from outside of the
+; non-affine region. As visible in the CHECK lines, the code we generate
+; currently loads from the PHI twice in %polly.stmt.bb2.entry, which is
+; something we should avoid.
 ;
 ; CHECK: polly.start
-;
+
+; CHECK: polly.stmt.bb2.entry:                             ; preds = %polly.start
+; CHECK-NEXT:   %tmp.phiops.reload = load i32, i32* %tmp.phiops
+; CHECK-NEXT:   %tmp.phiops.reload2 = load i32, i32* %tmp.phiops
+; CHECK-NEXT:   br label %polly.stmt.bb2
+
+; CHECK: polly.stmt.bb2:                                   ; preds = %polly.stmt.bb2, %polly.stmt.bb2.entry
+; CHECK-NEXT:   %polly.tmp = phi i32 [ %tmp.phiops.reload2, %polly.stmt.bb2.entry ], [ %p_tmp4, %polly.stmt.bb2 ]
+; CHECK-NEXT:   %p_tmp3 = or i32 undef, undef
+; CHECK-NEXT:   %p_tmp4 = udiv i32 %p_tmp3, 10
+; CHECK-NEXT:   %p_tmp6 = icmp eq i8 undef, 0
+; CHECK-NEXT:   br i1 %p_tmp6, label %polly.stmt.polly.merge_new_and_old.exit, label %polly.stmt.bb2
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
-; Function Attrs: nounwind uwtable
-define void @compressStream() #0 {
-entry:
-  br label %if.else
-
-if.else:                                          ; preds = %entry
-  br label %do.body.i
-
-do.body.i:                                        ; preds = %for.cond.i.i.6, %for.cond.i.i.4, %do.body.i, %if.else
-  %0 = phi i32 [ undef, %if.else ], [ 0, %for.cond.i.i.6 ], [ %div.i.i.2, %for.cond.i.i.4 ], [ %div.i.i.2, %do.body.i ]
-  %add.i.i.2 = or i32 undef, undef
-  %div.i.i.2 = udiv i32 %add.i.i.2, 10
-  %1 = trunc i32 undef to i8
-  %2 = icmp eq i8 %1, 0
-  br i1 %2, label %for.cond.i.i.4, label %do.body.i
+define void @baz(i32 %before) {
+bb:
+  br label %bb1
+
+bb1:                                              ; preds = %bb
+  br label %bb2
+
+bb2:                                              ; preds = %bb8, %bb7, %bb2, %bb1
+  %tmp = phi i32 [ %before, %bb1 ], [ 0, %bb8 ], [ %tmp4, %bb7 ], [ %tmp4, %bb2 ]
+  %tmp3 = or i32 undef, undef
+  %tmp4 = udiv i32 %tmp3, 10
+  %tmp5 = trunc i32 undef to i8
+  %tmp6 = icmp eq i8 %tmp5, 0
+  br i1 %tmp6, label %bb7, label %bb2
 
-for.cond.i.i.4:                                   ; preds = %do.body.i
-  br i1 undef, label %for.cond.i.i.6, label %do.body.i
+bb7:                                              ; preds = %bb2
+  br i1 undef, label %bb8, label %bb2
 
-for.cond.i.i.6:                                   ; preds = %for.cond.i.i.4
-  br i1 undef, label %for.cond.i.i.7, label %do.body.i
+bb8:                                              ; preds = %bb7
+  br i1 undef, label %bb9, label %bb2
 
-for.cond.i.i.7:                                   ; preds = %for.cond.i.i.6
+bb9:                                              ; preds = %bb8
   unreachable
 }




More information about the llvm-commits mailing list