[llvm-bugs] [Bug 32698] New: LoopVectorizer is analyzing poorly due to unoptimized input

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 18 04:55:16 PDT 2017


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

            Bug ID: 32698
           Summary: LoopVectorizer is analyzing poorly due to unoptimized
                    input
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18305
  --> https://bugs.llvm.org/attachment.cgi?id=18305&action=edit
automatically reduced test case with loop.

I came across a loop that for the loop vectorizer looks like:

for.body33:
  %indvars.iv1225 = phi i64 
  %typed_outval.1909 = phi i32
  %arrayidx36 = getelementptr 
  %58 = load i8, i8* %arrayidx36, align 1, !tbaa !11
  %conv37 = zext i8 %58 to i32
  %conv38 = and i32 %typed_outval.1909, 255
  %add39 = add nuw nsw i32 %conv38, %conv37
  %indvars.iv.next1226 = add nsw i64 %indvars.iv1225, 1
  %cmp31 = icmp slt i64 %indvars.iv.next1226, %57
  br i1 %cmp31, label %for.body33, label %for.end43.loopexit


It then thinks about these instructions with TTI individually. The problem is
that this is a phi that later gets optimized by InstCombine, because it is
actually just an i8 value, due to the 'and 255'.

A first thought is to run the instcombiner or some similar phi optimizer before
LoopVectorizer. Another idea is that it seems that SROA is introducing this
phi, which it could optimize?

Why is this not done? Compile time?

bin/opt -mtriple=s390x-unknown-linux -mcpu=z13 -O3 ./LoopVec_phi.ll -o
./out.opt.ll -S -debug-only=loop-vectorize

-- 
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/20170418/883fbe57/attachment-0001.html>


More information about the llvm-bugs mailing list