Original review: https://reviews.llvm.org/D121354
The original commit 9136145eb019e1d18c966d4d06a3df349b88cc14 broke the build on several targets.
Paths
| Differential D121973
Recommit "[SLP] Fix lookahead operand reordering for splat loads." ClosedPublic Authored by vporpo on Mar 17 2022, 7:33 PM.
Details Summary Original review: https://reviews.llvm.org/D121354 The original commit 9136145eb019e1d18c966d4d06a3df349b88cc14 broke the build on several targets.
Diff Detail
Event TimelineComment Actions @ABataev could you rubber stamp this once more? The only difference from https://reviews.llvm.org/D121354 is the missing Args argument in getShuffleCost for the various targets. This revision is now accepted and ready to land.Mar 21 2022, 3:32 PM This revision was landed with ongoing or failed builds.Mar 21 2022, 3:58 PM Closed by commit rG79613185d305: Recommit "[SLP] Fix lookahead operand reordering for splat loads." (authored by vporpo). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions this causes crashes: $ cat /tmp/a.ll target triple = "x86_64-unknown-linux-gnu" define internal fastcc void @0() #0 { %1 = load double, double* null, align 8 %2 = fcmp ogt double 0.000000e+00, %1 %3 = fcmp ogt double 0.000000e+00, %1 ret void } attributes #0 = { "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+sse3,+x87" } $ bin/opt -passes=slp-vectorizer -disable-output /tmp/a.ll opt: ../../llvm/lib/Target/X86/X86TargetTransformInfo.cpp:1563: llvm::InstructionCost llvm::X86TTIImpl::getShuffleCost(TTI::ShuffleKind, llvm::VectorType *, ArrayRef<int>, int, llvm::VectorType *, ArrayRef<llvm::Value *>): Assertion `isLegalBroadcastLoad( BaseTp->getElementType(), cast<FixedVectorType>(BaseTp)->getNumElements()) && "Table entry missing from isLegalBroadcastLoad()"' failed. Comment Actions Thanks @aeubanks for reporting this and for providing a reproducer. Comment Actions One more crash: $ cat /tmp/a.ll target triple = "x86_64-pc-windows-msvc19.16.0" %class.MockPrinter = type { %"class.gfx::Size", %"class.gfx::Size" } %"class.gfx::Size" = type { i32, i32 } define %class.MockPrinter* @"??0MockPrinter@@QEAA@XZ"(%class.MockPrinter* %this) #0 { entry: %page_size_ = getelementptr inbounds %class.MockPrinter, %class.MockPrinter* %this, i64 0, i32 0 %content_size_ = getelementptr inbounds %class.MockPrinter, %class.MockPrinter* %this, i64 0, i32 1 %0 = load double, double* null, align 8 %mul = fmul double %0, 0.000000e+00 %conv = fptosi double %mul to i32 %mul10 = fmul double %0, 0.000000e+00 %conv11 = fptosi double %mul10 to i32 %width_.i.i = getelementptr inbounds %"class.gfx::Size", %"class.gfx::Size"* %page_size_, i64 0, i32 0 store i32 %conv11, i32* %width_.i.i, align 4 %height_.i.i = getelementptr inbounds %"class.gfx::Size", %"class.gfx::Size"* %page_size_, i64 0, i32 1 store i32 %conv, i32* %height_.i.i, align 4 %mul14 = fmul double %0, 0.000000e+00 %conv15 = fptosi double %mul14 to i32 %mul17 = fmul double %0, 0.000000e+00 %conv18 = fptosi double %mul17 to i32 %width_.i.i3 = getelementptr inbounds %"class.gfx::Size", %"class.gfx::Size"* %content_size_, i64 0, i32 0 store i32 %conv18, i32* %width_.i.i3, align 4 %height_.i.i4 = getelementptr inbounds %"class.gfx::Size", %"class.gfx::Size"* %content_size_, i64 0, i32 1 store i32 %conv15, i32* %height_.i.i4, align 4 ret %class.MockPrinter* null } attributes #0 = { "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+sse3,+x87" } $ bin/opt -passes='slp-vectorizer' -disable-output /tmp/a.ll opt: ../../llvm/lib/Target/X86/X86TargetTransformInfo.cpp:1563: llvm::InstructionCost llvm::X86TTIImpl::getShuffleCost(TTI::ShuffleKind, llvm::VectorType *, ArrayRef<int>, int, llvm::VectorType *, ArrayRef<llvm::Value *>): Assertion `isLegalBroadcastLoad( BaseTp->getElementType(), cast<FixedVectorType>(BaseTp)->getNumElements()) && "Table entry missing from isLegalBroadcastLoad()"' failed.
Comment Actions Recommitted fixed patch: 39aa202affd99d1713daea00b7681571fe478a12
Revision Contents
Diff 417123 llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
llvm/lib/Target/X86/X86TargetTransformInfo.h
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll
llvm/test/Transforms/SLPVectorizer/X86/operandorder.ll
|
This isn't accounting for type legalization reducing the width of the broadcasted vector - you probably need to use LT.second.getVectorNumElements().