[LLVMbugs] [Bug 17498] New: LoopVectorizer: Can only vectorize reductions if the external user uses the “last” value in reduction cycle

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 7 09:56:24 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17498

            Bug ID: 17498
           Summary: LoopVectorizer: Can only vectorize reductions if the
                    external user uses the “last” value in reduction cycle
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: aschwaighofer at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

See the last two examples of PR17473.

for.body3.1:                                      ; preds = %for.body3.1,
%for.inc7                                                                     
  %inc613.1 = phi i32 [ 0, %for.inc7 ], [ %inc6.1, %for.body3.1 ]               
  %inc511.1 = phi i32 [ %inc.1, %for.inc7 ], [ %inc5.1, %for.body3.1 ]          
  %2 = zext i1 %tobool to i32
  %inc4.1 = xor i32 %2, 1                                                       
  %inc511.1.inc4.1 = add nsw i32 %inc511.1, %inc4.1
  %inc5.1 = add nsw i32 %inc511.1.inc4.1, 1                                     
  %inc6.1 = add nsw i32 %inc613.1, 1
  %exitcond.1 = icmp eq i32 %inc6.1, 22
  br i1 %exitcond.1, label %for.inc7.1, label %for.body3.1

for.inc7.1:                                       ; preds = %for.body3.1        
  %inc.2 = add nsw i32 %inc511.1.inc4.1, 2        
  br label %for.body3.2

And where generating this. The problem is that the external user was not using
the “last” value in the reduction. So we would loose 3 "(add 1)”s.

vector.body23:                                    ; preds = %vector.body23,
%for.inc7
  %index26 = phi i32 [ 0, %for.inc7 ], [ %index.next30, %vector.body23 ]        
  %vec.phi34 = phi <4 x i32> [ %7, %for.inc7 ], [ %11, %vector.body23 ]
  %8 = zext <4 x i1> %broadcast.splat36 to <4 x i32>
  %9 = xor <4 x i32> %8, <i32 1, i32 1, i32 1, i32 1>
  %10 = add nsw <4 x i32> %vec.phi34, %9          
  %11 = add nsw <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1>
  %index.next30 = add i32 %index26, 4
  %12 = icmp eq i32 %index.next30, 20
  br i1 %12, label %middle.block24, label %vector.body23

middle.block24:                                   ; preds = %vector.body23
  %rdx.shuf38 = shufflevector <4 x i32> %10, <4 x i32> undef, <4 x i32> <i32 2,
i32 3, i32 undef, i32 undef>

-- 
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/20131007/65b0afe0/attachment.html>


More information about the llvm-bugs mailing list