| Issue |
176823
|
| Summary |
[X86] TTI crashes on scalable vectors in getVectorInstrCost()
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
sairam2661
|
**Fuzzer Generated Test**
**Reproducer**
https://godbolt.org/z/vjWsWbjn9
**Test Commit**
[0b2f3cfb72a76fa90f3ec2a234caabe0d0712590](https://github.com/llvm/llvm-project/commit/0b2f3cfb72a76fa90f3ec2a234caabe0d0712590)
**Description**
X86's TTI cost model crashes when encountering scalable vectors, which occurs during specialization cost analysis. Related to https://github.com/llvm/llvm-project/issues/173755, https://github.com/llvm/llvm-project/issues/175868, etc., but in the X86 backend.
**Steps to reproduce**
- Minimized test case, `input.ll`
```
target triple = "x86_64-apple-macosx"
define <vscale x 1 x i64> @test(i64 %x) {
%v = insertelement <vscale x 1 x i64> poison, i64 %x, i64 0
ret <vscale x 1 x i64> %v
}
```
**Command**
```
opt -passes=default<O2> -S input.ll
```
**Output**
```
LLVM ERROR: Cannot implicitly convert a scalable size to a fixed-width size in `TypeSize::operator ScalarTy()`
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=default<O2> <source>
1. Running pass "ipsccp" on module "<source>"
#0 0x0000000005a80c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a80c68)
#1 0x0000000005a7db44 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007a996d442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007a996d4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007a996d442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007a996d4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000000000082d619 llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
#7 0x00000000059b2f10 llvm::reportFatalInternalError(llvm::StringRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b2f10)
#8 0x0000000002324da9 llvm::X86TTIImpl::getVectorInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::TargetCostKind, unsigned int, llvm::Value const*, llvm::Value const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2324da9)
#9 0x00000000023340d3 llvm::TargetTransformInfoImplCRTPBase<llvm::X86TTIImpl>::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x23340d3)
#10 0x00000000050f871d llvm::TargetTransformInfo::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x50f871d)
#11 0x0000000004e1b4ca llvm::CodeMetrics::analyzeBasicBlock(llvm::BasicBlock const*, llvm::TargetTransformInfo const&, llvm::SmallPtrSetImpl<llvm::Value const*> const&, bool, llvm::Loop const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e1b4ca)
#12 0x00000000034649c3 llvm::FunctionSpecializer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x34649c3)
#13 0x000000000342c746 runIPSCCP(llvm::Module&, llvm::DataLayout const&, llvm::AnalysisManager<llvm::Function>*, std::function<llvm::TargetLibraryInfo const& (llvm::Function&)>, std::function<llvm::TargetTransformInfo& (llvm::Function&)>, std::function<llvm::AssumptionCache& (llvm::Function&)>, std::function<llvm::DominatorTree& (llvm::Function&)>, std::function<llvm::BlockFrequencyInfo& (llvm::Function&)>, bool) SCCP.cpp:0:0
#14 0x000000000342e25d llvm::IPSCCPPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x342e25d)
#15 0x00000000030218ee llvm::detail::PassModel<llvm::Module, llvm::IPSCCPPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x30218ee)
#16 0x00000000057f3131 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57f3131)
#17 0x000000000096e8ca llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96e8ca)
#18 0x0000000000962978 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x962978)
#19 0x00007a996d429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007a996d429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000009595f5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9595f5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs