Skip to content

[RISCV][CostModel] opt crashed and triggered assertion `(SrcLT.first == 1) && (DstLT.first == 1) && "Illegal type"' #166732

@XChy

Description

@XChy

Reproducer: https://godbolt.org/z/fjhevfM8b
Reduced testcase:

target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-musl"

define <512 x i2> @backsmith_pure_9(<16 x i64> %BS_ARG_0) #0 {
entry:
  %0 = bitcast <16 x i64> %BS_ARG_0 to <512 x i2>
  ret <512 x i2> %0
}

attributes #0 = { "target-features"="+v" }

opt output:

opt: /root/llvm-project/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:1690: virtual llvm::InstructionCost llvm::RISCVTTIImpl::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::TargetTransformInfo::CastContextHint, llvm::TargetTransformInfo::TargetCostKind, const llvm::Instruction*) const: Assertion `(SrcLT.first == 1) && (DstLT.first == 1) && "Illegal type"' failed.
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 -O1 <source>
1.	Running pass "ipsccp" on module "<source>"
 #0 0x00000000059aa7e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59aa7e8)
 #1 0x00000000059a7694 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f300f042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f300f0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f300f042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f300f0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007f300f02871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007f300f039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000001db220c llvm::RISCVTTIImpl::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::TargetTransformInfo::CastContextHint, llvm::TargetTransformInfo::TargetCostKind, llvm::Instruction const*) const (.part.0) RISCVTargetTransformInfo.cpp:0:0
 #9 0x0000000001dc818f llvm::TargetTransformInfoImplCRTPBase<llvm::RISCVTTIImpl>::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x1dc818f)
#10 0x00000000050409ad llvm::TargetTransformInfo::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x50409ad)
#11 0x0000000004d547aa 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+0x4d547aa)
#12 0x0000000003402713 llvm::FunctionSpecializer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3402713)
#13 0x00000000033ca78b 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 0x00000000033cc2bd llvm::IPSCCPPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x33cc2bd)
#15 0x0000000002fc41ee 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+0x2fc41ee)
#16 0x0000000005781121 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5781121)
#17 0x000000000098745a 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+0x98745a)
#18 0x000000000097b6d1 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97b6d1)
#19 0x00007f300f029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007f300f029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x0000000000972ae5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x972ae5)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions