[llvm-bugs] [Bug 25705] New: Vector and scalar loop being dead code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 2 01:55:24 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25705

            Bug ID: 25705
           Summary: Vector and scalar loop being dead code
           Product: Projects
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Polly
          Assignee: polly-dev at googlegroups.com
          Reporter: chrisj at codeaurora.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15379
  --> https://llvm.org/bugs/attachment.cgi?id=15379&action=edit
reduced test

opt  -polly-process-unprofitable -polly-code-generator=isl -polly-scops
-polly-codegen  test.ll -S

Both the scalar version and vector loop body polly.stmt.for.body end up being
dead code,

polly.preload.begin:
  br i1 true, label %polly.start, label %for.body

for.body:
  %i.034 = phi i32 [ %inc, %for.body ], [ 0, %polly.preload.begin ]
  %arrayidx = getelementptr inbounds i16, i16* %2, i32 %i.034
  %3 = load i16, i16* %arrayidx, align 2
  %add = add i16 %3, 10
  store i16 %add, i16* %arrayidx, align 2
  %inc = add nuw nsw i32 %i.034, 1
  %cmp = icmp slt i32 %inc, %1
  br i1 %cmp, label %for.body, label %for.cond2.preheader
..
..
..
polly.loop_if:
  br i1 false, label %polly.loop_preheader, label %polly.loop_exit

polly.loop_header:
  %polly.indvar = phi i64 [ 0, %polly.loop_preheader ], [ %polly.indvar_next,
%polly.stmt.for.body ]
  br label %polly.stmt.for.body

polly.stmt.for.body:
  %10 = trunc i64 %polly.indvar to i32
  %11 = shl i32 %10, 1
  %scevgep = getelementptr i8, i8* %call, i32 %11
  %scevgep1 = bitcast i8* %scevgep to i16*
  %_p_scalar_ = load i16, i16* %scevgep1, align 2, !alias.scope !0, !noalias !2
  %p_add = add i16 %_p_scalar_, 10
  store i16 %p_add, i16* %scevgep1, align 2, !alias.scope !0, !noalias !2
  %12 = trunc i64 %polly.indvar to i32
  %13 = add i32 %12, 1
  %p_cmp = icmp slt i32 %13, %1
  %polly.indvar_next = add nsw i64 %polly.indvar, 1
  %polly.loop_cond = icmp slt i64 %polly.indvar, -1
  br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit

polly.loop_preheader:
  br label %polly.loop_header



When run with -simplifycfg 


define void @foo1() #0 {
entry:
  %0 = load i32, i32* @n, align 4
  %call = tail call i8* @foo(i32 %0)
  store i8* %call, i8** bitcast (i16** @A to i8**), align 4
  %1 = load i32, i32* @n, align 4
  %cmp33 = icmp sgt i32 %1, 0
  %2 = bitcast i8* %call to i16*
  br i1 %cmp33, label %polly.stmt.for.body2, label %for.end20

for.end20:                                        ; preds =
%polly.stmt.for.body2, %entry
  ret void

polly.stmt.for.body2:                             ; preds = %entry
  %scevgep3 = getelementptr i8, i8* %call, i32 0
  %scevgep34 = bitcast i8* %scevgep3 to i16*
  %_p_scalar_5 = load i16, i16* %scevgep34, align 2, !alias.scope !0, !noalias
!2
  %p_add6 = add i16 %_p_scalar_5, 10
  store i16 %p_add6, i16* %scevgep34, align 2, !alias.scope !0, !noalias !2
  %p_cmp7 = icmp slt i32 1, %1
  br label %for.end20
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151202/474162b2/attachment.html>


More information about the llvm-bugs mailing list