[llvm-bugs] [Bug 39235] New: [loop vectorize] failure to vectorize after GVN load-pre

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 9 13:42:56 PDT 2018


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

            Bug ID: 39235
           Summary: [loop vectorize] failure to vectorize after GVN
                    load-pre
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: mpfergu at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20981
  --> https://bugs.llvm.org/attachment.cgi?id=20981&action=edit
test showing the problem

I'm seeing an issue where adding !noalias metadata seems to prevents loop
vectorization from occurring. The issue seems to be that GVN does a PRE of a
load and this prevents the loop vectorizer from functioning.

See the attached .ll file. Supposing it's named opt-me.ll, to reproduce you can
do this:

 opt -O3 -loop-vectorize -force-vector-width=4 -force-vector-interleave=1
opt-me.ll -S 

Result:

 remark: <unknown>:0:0: loop not vectorized: value that could not be identified
as reduction is used outside the loop
remark: <unknown>:0:0: loop not vectorized: value that could not be identified
as reduction is used outside the loop
 -> loop not vectorized

Compare with

opt -O3 -loop-vectorize -force-vector-width=4 -force-vector-interleave=1
-enable-load-pre=false opt-me.ll -S

 -> loop is vectorized, I see 4 x i32, extractelements, and no loop not
vectorized remarks.

If you remove the !noalias metadata from opt-me.ll, vectorization occurs
whether or not -enable-load-pre=false is passed. This seems unfortunate, as
front-ends would like to provide !noalias metadata where possible to improve
(and not hinder!) optimization.

I believe this problem is present in LLVM 6 as well as master.

-- 
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/20181009/5cce0cd2/attachment-0001.html>


More information about the llvm-bugs mailing list