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

            Bug ID: 44067
           Summary: [SLPVectorizer] Generation of seed operands in the
                    wrong order for insertelement.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: v.porpo...@gmail.com
                CC: a.bat...@hotmail.com, anton.a.afanas...@gmail.com,
                    llvm-bugs@lists.llvm.org, llvm-...@redking.me.uk,
                    spatel+l...@rotateright.com

There seems to be a bug in findBuildVector() when the insertelement
instructions are not in increasing index order.

For example:
  %Ins1 = insertelement <2 x float> undef, float %Elem1, i32 1 ; NOTE: index=1
  %Ins0 = insertelement <2 x float> %Ins1, float %Elem0, i32 0 ; NOTE: index=0

This generates a seed vector of %Elem1, %Elem0, but it should generate the
reverse: %Elem0, %Elem1.

Test:
----
define dso_local <2 x float> @foo({{float, float}}* %A, float %B) {
entry:
  %0 = bitcast {{float, float}}* %A to <2 x float>*
  %1 = load <2 x float>, <2 x float>* %0
  %L0 = extractelement <2 x float> %1, i32 0
  %L1 = extractelement <2 x float> %1, i32 1
  %Mul0 = fmul float %L0, 2.000000e+00
  %Mul1 = fmul float %L1, 2.000000e+00
  %Ins1 = insertelement <2 x float> undef, float %Mul1, i32 1
  %Ins0 = insertelement <2 x float> %Ins1, float %Mul0, i32 0
  ret <2 x float> %Ins0
}


Compile:
----
opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu test.ll

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to