https://llvm.org/bugs/show_bug.cgi?id=31116
Bug ID: 31116 Summary: SLP Vectorizer too aggressive with simple stores Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: ma...@braunis.de CC: llvm-bugs@lists.llvm.org Classification: Unclassified In a situation like the following (modeled after what happens in a C++ constructor with two base classes), the SLP vectorizer seems too aggressive: struct C { char *BaseA; char *BaseB; }; extern char VTab[]; void initC(C *c) { c->BaseA = VTab + 48; c->BaseB = VTab + 16; } The SLP Vectorizer transforms: %BaseA = getelementptr inbounds %struct.C, %struct.C* %c, i64 0, i32 0 store i8* getelementptr inbounds ([0 x i8], [0 x i8]* @VTab, i64 0, i64 48), i8** %BaseA, align 8, !tbaa !2 %BaseB = getelementptr inbounds %struct.C, %struct.C* %c, i64 0, i32 1 store i8* getelementptr inbounds ([0 x i8], [0 x i8]* @VTab, i64 0, i64 16), i8** %BaseB, align 8, !tbaa !7 into: %BaseA = getelementptr inbounds %struct.C, %struct.C* %c, i64 0, i32 0 %BaseB = getelementptr inbounds %struct.C, %struct.C* %c, i64 0, i32 1 %0 = bitcast i8** %BaseA to <2 x i8*>* store <2 x i8*> <i8* getelementptr inbounds ([0 x i8], [0 x i8]* @VTab, i64 0, i64 48), i8* getelementptr inbounds ([0 x i8], [0 x i8]* @VTab, i64 0, i64 16)>, <2 x i8*>* %0, align 8, !tbaa !2 ret void which results in this code on X86: movq _VTab@GOTPCREL(%rip), %rax leaq 16(%rax), %rcx movd %rcx, %xmm0 addq $48, %rax movd %rax, %xmm1 punpcklqdq %xmm0, %xmm1 ## xmm1 = xmm1[0],xmm0[0] movdqu %xmm1, (%rdi) while it can be this if the SLP Vectorizer doesn't do anything: movq _VTab@GOTPCREL(%rip), %rax leaq 48(%rax), %rcx movq %rcx, (%rdi) addq $16, %rax movq %rax, 8(%rdi) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs