[llvm-bugs] [Bug 43882] New: [SLPVectorizer] Failure to vectorize extract from two vectors
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Nov 2 05:33:09 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43882
Bug ID: 43882
Summary: [SLPVectorizer] Failure to vectorize extract from two
vectors
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
Stumbling into this while analyzing https://bugs.llvm.org/show_bug.cgi?id=43844
https://godbolt.org/z/a5HeXw
%3 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 0
%4 = bitcast %"struct.std::array.0"* %1 to <4 x i32>*
%5 = load <4 x i32>, <4 x i32>* %4, align 8, !tbaa !2
%6 = extractelement <4 x i32> %5, i32 0
store i32 %6, i32* %3, align 4, !tbaa !2
%7 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 2
%8 = extractelement <4 x i32> %5, i32 1
store i32 %8, i32* %7, align 4, !tbaa !2
%9 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 4
%10 = extractelement <4 x i32> %5, i32 2
store i32 %10, i32* %9, align 4, !tbaa !2
%11 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 6
%12 = extractelement <4 x i32> %5, i32 3
store i32 %12, i32* %11, align 4, !tbaa !2
%13 = getelementptr inbounds %"struct.std::array.0", %"struct.std::array.0"*
%1, i64 0, i32 0, i64 4
%14 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 1
%15 = bitcast i32* %13 to <4 x i32>*
%16 = load <4 x i32>, <4 x i32>* %15, align 8, !tbaa !2
%17 = extractelement <4 x i32> %16, i32 0
store i32 %17, i32* %14, align 4, !tbaa !2
%18 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 3
%19 = extractelement <4 x i32> %16, i32 1
store i32 %19, i32* %18, align 4, !tbaa !2
%20 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 5
%21 = extractelement <4 x i32> %16, i32 2
store i32 %21, i32* %20, align 4, !tbaa !2
%22 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 7
%23 = extractelement <4 x i32> %16, i32 3
store i32 %23, i32* %22, align 4, !tbaa !2
I.e. e.g. the stores are fed by:
[ %6 = extractelement <4 x i32> %5, i32 0; %17 = extractelement <4 x i32>
%16, i32 0; %8 = extractelement <4 x i32> %5, i32 1; %19 = extractelement <4
x i32> %16, i32 1]
and so on.
This can be represented as a shuffle: https://godbolt.org/z/KfWvCe
%3 = bitcast %"struct.std::array.0"* %1 to <4 x i32>*
%4 = load <4 x i32>, <4 x i32>* %3, align 8, !tbaa !2
%5 = getelementptr inbounds %"struct.std::array", %"struct.std::array"* %0,
i64 0, i32 0, i64 4
%6 = getelementptr inbounds %"struct.std::array.0", %"struct.std::array.0"*
%1, i64 0, i32 0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
%8 = load <4 x i32>, <4 x i32>* %7, align 8, !tbaa !2
%9 = shufflevector <4 x i32> %4, <4 x i32> %8, <4 x i32> <i32 0, i32 4, i32
1, i32 5>
%10 = bitcast %"struct.std::array"* %0 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %10, align 4, !tbaa !2
%11 = shufflevector <4 x i32> %4, <4 x i32> %8, <4 x i32> <i32 2, i32 6, i32
3, i32 7>
%12 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> %11, <4 x i32>* %12, align 4, !tbaa !2
--
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/20191102/1c163f80/attachment.html>
More information about the llvm-bugs
mailing list