Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNREACHABLE: "Not a vector MVT!" in X86TTIImpl #38963

Closed
gburgessiv opened this issue Nov 10, 2018 · 3 comments
Closed

UNREACHABLE: "Not a vector MVT!" in X86TTIImpl #38963

gburgessiv opened this issue Nov 10, 2018 · 3 comments
Labels
backend:X86 bugzilla Issues migrated from bugzilla

Comments

@gburgessiv
Copy link
Member

Bugzilla Link 39615
Resolution FIXED
Resolved on Nov 10, 2018 09:46
Version trunk
OS Linux
CC @topperc,@RKSimon,@rotateright
Fixed by commit(s) 346589

Extended Description

Bisection pointed to an unreachable being hit while we're running the SLP Vectorizer.

Repro:

int a, b, g, h, i;
__int128 c, d, e, f;

void gcm_HashMult_sftw() {
  for (; h; h++) {
    f = b = g * c ^ a * f ^ g * e ^ b * d;
    g = i;
  }
}

$ $clang -O2 -std=gnu99 -x c repro.c

Full backtrace:

Not a vector MVT!
UNREACHABLE executed at ../../include/llvm/Support/MachineValueType.h:521!
Stack dump:
0. Program arguments: /path/to/llvm/build/debug/bin/clang-8 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name gcm-a8cff7.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /path/to/llvm/build/debug/lib/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /path/to/llvm/build/debug/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -std=gnu99 -fdebug-compilation-dir /path/to/llvm/gbiv_creduce -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /tmp/gcm-a8cff7-4dc836.o -x c gcm-a8cff7.c -faddrsig

  1.  <eof> parser at end of file
    
  2.  Per-module optimization passes
    
  3.  Running pass 'Function Pass Manager' on module 'gcm-a8cff7.c'.
    
  4.  Running pass 'SLP Vectorizer' on function '@gcm_HashMult_sftw'
    

#​0 0x0000000003c8b059 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /path/to/llvm/build/debug/../../lib/Support/Unix/Signals.inc:495:11
#​1 0x0000000003c8b209 PrintStackTraceSignalHandler(void*) /path/to/llvm/build/debug/../../lib/Support/Unix/Signals.inc:559:1
#​2 0x0000000003c89486 llvm::sys::RunSignalHandlers() /path/to/llvm/build/debug/../../lib/Support/Signals.cpp:66:5
#​3 0x0000000003c8b83b SignalHandler(int) /path/to/llvm/build/debug/../../lib/Support/Unix/Signals.inc:358:1
#​4 0x00007fd5789c50c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
#​5 0x00007fd577770fcf gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
#​6 0x00007fd5777723fa abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
#​7 0x0000000003baf170 llvm::install_out_of_memory_new_handler() /path/to/llvm/build/debug/../../lib/Support/ErrorHandling.cpp:193:0
#​8 0x00000000012a7714 llvm::MVT::getVectorNumElements() const /path/to/llvm/build/debug/../../include/llvm/Support/MachineValueType.h:522:21
#​9 0x0000000002514144 llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*) /path/to/llvm/build/debug/../../lib/Target/X86/X86TargetTransformInfo.cpp:878:27
#​10 0x000000000251cfab llvm::BasicTTIImplBasellvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /path/to/llvm/build/debug/../../include/llvm/CodeGen/BasicTTIImpl.h:1350:35
#​11 0x0000000002516829 llvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /path/to/llvm/build/debug/../../lib/Target/X86/X86TargetTransformInfo.cpp:2163:3
#​12 0x000000000250ebd1 llvm::TargetTransformInfo::Modelllvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /path/to/llvm/build/debug/../../include/llvm/Analysis/TargetTransformInfo.h:1499:5
#​13 0x0000000002c5569a llvm::TargetTransformInfo::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) const /path/to/llvm/build/debug/../../lib/Analysis/TargetTransformInfo.cpp:569:7
#​14 0x0000000003e58cec (anonymous namespace)::HorizontalReduction::getReductionCost(llvm::TargetTransformInfo*, llvm::Value*, unsigned int) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:5861:23
#​15 0x0000000003e56937 (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:5774:27
#​16 0x0000000003e52fb2 tryToVectorizeHorReductionOrInstOperands(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::function_ref<bool (llvm::Instruction*, llvm::slpvectorizer::BoUpSLP&)>) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:6110:13
#​17 0x0000000003e52d71 llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Value*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:6166:3
#​18 0x0000000003e4fc55 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:6318:11
#​19 0x0000000003e4ef13 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:4645:16
#​20 0x0000000003e5b074 (anonymous namespace)::SLPVectorizer::runOnFunction(llvm::Function&) /path/to/llvm/build/debug/../../lib/Transforms/Vectorize/SLPVectorizer.cpp:4550:5
#​21 0x000000000332c3a4 llvm::FPPassManager::runOnFunction(llvm::Function&) /path/to/llvm/build/debug/../../lib/IR/LegacyPassManager.cpp:1644:23
#​22 0x000000000332c785 llvm::FPPassManager::runOnModule(llvm::Module&) /path/to/llvm/build/debug/../../lib/IR/LegacyPassManager.cpp:1679:16
#​23 0x000000000332cf97 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /path/to/llvm/build/debug/../../lib/IR/LegacyPassManager.cpp:1744:23
#​24 0x000000000332ca5b llvm::legacy::PassManagerImpl::run(llvm::Module&) /path/to/llvm/build/debug/../../lib/IR/LegacyPassManager.cpp:1857:16
#​25 0x000000000332d571 llvm::legacy::PassManager::run(llvm::Module&) /path/to/llvm/build/debug/../../lib/IR/LegacyPassManager.cpp:1888:3
#​26 0x0000000003fb1c87 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) /path/to/llvm/build/debug/../../tools/clang/lib/CodeGen/BackendUtil.cpp:864:3
#​27 0x0000000003fae9df clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) /path/to/llvm/build/debug/../../tools/clang/lib/CodeGen/BackendUtil.cpp:1296:5
#​28 0x0000000004e91074 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /path/to/llvm/build/debug/../../tools/clang/lib/CodeGen/CodeGenAction.cpp:293:7
#​29 0x00000000066ec407 clang::ParseAST(clang::Sema&, bool, bool) /path/to/llvm/build/debug/../../tools/clang/lib/Parse/ParseAST.cpp:177:12
#​30 0x0000000004878762 clang::ASTFrontendAction::ExecuteAction() /path/to/llvm/build/debug/../../tools/clang/lib/Frontend/FrontendAction.cpp:1019:1
#​31 0x0000000004e8e580 clang::CodeGenAction::ExecuteAction() /path/to/llvm/build/debug/../../tools/clang/lib/CodeGen/CodeGenAction.cpp:1045:1
#​32 0x00000000048781a0 clang::FrontendAction::Execute() /path/to/llvm/build/debug/../../tools/clang/lib/Frontend/FrontendAction.cpp:920:7
#​33 0x00000000047f070f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /path/to/llvm/build/debug/../../tools/clang/lib/Frontend/CompilerInstance.cpp:968:7
#​34 0x0000000004a1408b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /path/to/llvm/build/debug/../../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:8
#​35 0x0000000001253230 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /path/to/llvm/build/debug/../../tools/clang/tools/driver/cc1_main.cpp:218:11
#​36 0x0000000001245c80 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) /path/to/llvm/build/debug/../../tools/clang/tools/driver/driver.cpp:310:5
#​37 0x00000000012448af main /path/to/llvm/build/debug/../../tools/clang/tools/driver/driver.cpp:382:5
#​38 0x00007fd57775e2b1 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
#​39 0x00000000012437aa _start (/path/to/llvm/build/debug/bin/clang-8+0x12437aa)

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2018

not sure if it helped, i tested with O3:

clang -O3 -std=gnu99 -x c -c test5.cc
Not a vector MVT!
UNREACHABLE executed at /root/llvm/include/llvm/Support/MachineValueType.h:521!
Stack dump:
0. Program arguments: /root/build/bin/clang-8 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name test5.cc -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file /root/test/test5.gcno -resource-dir /root/build/lib/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /root/build/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=gnu99 -fdebug-compilation-dir /root/test -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o test5.o -x c test5.cc -faddrsig

  1. parser at end of file
  2. Per-module optimization passes
  3. Running pass 'Function Pass Manager' on module 'test5.cc'.
  4. Running pass 'SLP Vectorizer' on function '@gcm_HashMult_sftw'
    #​0 0x0000000004b8cd2b llvm::sys::PrintStackTrace(llvm::raw_ostream&) /root/llvm/lib/Support/Unix/Signals.inc:495:0
    #​1 0x0000000004b8cdbe PrintStackTraceSignalHandler(void*) /root/llvm/lib/Support/Unix/Signals.inc:559:0
    #​2 0x0000000004b8aab8 llvm::sys::RunSignalHandlers() /root/llvm/lib/Support/Signals.cpp:67:0
    #​3 0x0000000004b8c726 SignalHandler(int) /root/llvm/lib/Support/Unix/Signals.inc:358:0
    #​4 0x00007f39ef3d7390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
    #​5 0x00007f39ee149428 gsignal /build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
    #​6 0x00007f39ee14b02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
    #​7 0x0000000004ad7b38 bindingsErrorHandler(void*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool) /root/llvm/lib/Support/ErrorHandling.cpp:231:0
    #​8 0x0000000002567045 llvm::MVT::getVectorNumElements() const /root/llvm/include/llvm/Support/MachineValueType.h:522:0
    #​9 0x0000000003611b2f llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*) /root/llvm/lib/Target/X86/X86TargetTransformInfo.cpp:878:0
    #​10 0x000000000361a076 llvm::BasicTTIImplBasellvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /root/llvm/include/llvm/CodeGen/BasicTTIImpl.h:1349:0
    #​11 0x0000000003613cf0 llvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /root/llvm/lib/Target/X86/X86TargetTransformInfo.cpp:2164:0
    #​12 0x000000000360cee4 llvm::TargetTransformInfo::Modelllvm::X86TTIImpl::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) /root/llvm/include/llvm/Analysis/TargetTransformInfo.h:1500:0
    #​13 0x0000000003c79ca4 llvm::TargetTransformInfo::getArithmeticReductionCost(unsigned int, llvm::Type*, bool) const /root/llvm/lib/Analysis/TargetTransformInfo.cpp:569:0
    #​14 0x0000000004d3edd3 (anonymous namespace)::HorizontalReduction::getReductionCost(llvm::TargetTransformInfo*, llvm::Value*, unsigned int) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5863:0
    #​15 0x0000000004d3e52c (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5774:0
    #​16 0x0000000004d3fca7 tryToVectorizeHorReductionOrInstOperands(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*, llvm::function_ref<bool (llvm::Instruction*, llvm::slpvectorizer::BoUpSLP&)>) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6110:0
    #​17 0x0000000004d40068 llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Value*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::TargetTransformInfo*) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6167:0
    #​18 0x0000000004d40c6d llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6318:0
    #​19 0x0000000004d37e0d llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4645:0
    #​20 0x0000000004d376aa (anonymous namespace)::SLPVectorizer::runOnFunction(llvm::Function&) /root/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4550:0
    #​21 0x00000000042ef683 llvm::FPPassManager::runOnFunction(llvm::Function&) /root/llvm/lib/IR/LegacyPassManager.cpp:1644:0
    #​22 0x00000000042ef8f5 llvm::FPPassManager::runOnModule(llvm::Module&) /root/llvm/lib/IR/LegacyPassManager.cpp:1679:0
    #​23 0x00000000042efcfc (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /root/llvm/lib/IR/LegacyPassManager.cpp:1744:0
    #​24 0x00000000042f0509 llvm::legacy::PassManagerImpl::run(llvm::Module&) /root/llvm/lib/IR/LegacyPassManager.cpp:1857:0
    #​25 0x00000000042f074d llvm::legacy::PassManager::run(llvm::Module&) /root/llvm/lib/IR/LegacyPassManager.cpp:1889:0
    #​26 0x0000000004e780fc (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) /root/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:862:0
    #​27 0x0000000004e7b4c2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) /root/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1296:0
    #​28 0x0000000005b6e6d3 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /root/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:295:0
    #​29 0x000000000706b567 clang::ParseAST(clang::Sema&, bool, bool) /root/llvm/tools/clang/lib/Parse/ParseAST.cpp:177:0
    #​30 0x0000000005616019 clang::ASTFrontendAction::ExecuteAction() /root/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1018:0
    #​31 0x0000000005b6c502 clang::CodeGenAction::ExecuteAction() /root/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1045:0
    #​32 0x0000000005615a1a clang::FrontendAction::Execute() /root/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:920:0
    #​33 0x00000000055a17f6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /root/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:968:0
    #​34 0x000000000577b98f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /root/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:0
    #​35 0x000000000252f39e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /root/llvm/tools/clang/tools/driver/cc1_main.cpp:218:0
    #​36 0x000000000252455c ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) /root/llvm/tools/clang/tools/driver/driver.cpp:310:0
    #​37 0x00000000025252a1 main /root/llvm/tools/clang/tools/driver/driver.cpp:382:0
    #​38 0x00007f39ee134830 __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
    #​39 0x0000000002521e79 _start (/root/build/bin/clang-8+0x2521e79)
    clang-8: error: unable to execute command: Aborted (core dumped)
    clang-8: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 8.0.0 (trunk 346579) (llvm/trunk 346569)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /root/build/bin
    clang-8: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
    clang-8: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/test5-52adf9.c
clang-8: note: diagnostic msg: /tmp/test5-52adf9.sh
clang-8: note: diagnostic msg:


@RKSimon
Copy link
Collaborator

RKSimon commented Nov 10, 2018

Forgot to account for legalization of vector types might return a scalar - fix in progress.

@RKSimon
Copy link
Collaborator

RKSimon commented Nov 10, 2018

rL346589

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants