[PATCH] D142254: [X86] Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 13:48:56 PST 2023


craig.topper added a comment.

In D142254#4130182 <https://reviews.llvm.org/D142254#4130182>, @saugustine wrote:

> I have tracked an obscure failure down to this change. Still working on getting a reproducer suitable for public consumption, but the stack trace is below. It does go right through several of the places this commit touched.
>
>    #0 0x000055df400bd2fa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:567:11
>    #1 0x000055df400bd4ab PrintStackTraceSignalHandler(void*) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:641:1
>    #2 0x000055df400bba16 llvm::sys::RunSignalHandlers() /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/Signals.cpp:104:5
>    #3 0x000055df400bcb6e llvm::sys::CleanupOnSignal(unsigned long) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:367:1
>    #4 0x000055df3fffece4 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:7
>    #5 0x000055df3ffff0a2 CrashRecoverySignalHandler(int) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:391:1
>    #6 0x00007f7e1b25af90 (/lib/x86_64-linux-gnu/libc.so.6+0x3bf90)
>    #7 0x00007f7e1b2a9ccc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
>    #8 0x00007f7e1b25aef2 raise ./signal/../sysdeps/posix/raise.c:27:6
>    #9 0x00007f7e1b245472 abort ./stdlib/abort.c:81:7
>   #10 0x00007f7e1b245395 _nl_load_domain ./intl/loadmsgcat.c:1177:9
>   #11 0x00007f7e1b253df2 (/lib/x86_64-linux-gnu/libc.so.6+0x34df2)
>   #12 0x000055df3e20e5cc llvm::EVT::getSimpleVT() const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:0:7
>   #13 0x000055df3e351fb5 llvm::SDValue::getSimpleValueType() const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:191:27
>   #14 0x000055df3e49d6db incDecVectorConstant(llvm::SDValue, llvm::SelectionDAG&, bool, bool) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:24734:14
>   #15 0x000055df3e47a27a combineSetCC(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:54098:35
>   #16 0x000055df3e45241e llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:56987:36
>   #17 0x000055df4196019f (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2000:16
>   #18 0x000055df4195f6a6 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1781:18
>   #19 0x000055df4195ef8f llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:26965:3
>   #20 0x000055df41bb190f llvm::SelectionDAGISel::CodeGenAndEmitDAG() /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:784:3
>   #21 0x000055df41bb14bd llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:700:1
>   #22 0x000055df41bb0f4e llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1638:11
>   #23 0x000055df41bae480 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:480:3
>   #24 0x000055df3e31ef0a (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:192:7
>   #25 0x000055df3edc9495 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
>   #26 0x000055df3f6673c6 llvm::FPPassManager::runOnFunction(llvm::Function&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1430:23
>   #27 0x000055df3f66c1f2 llvm::FPPassManager::runOnModule(llvm::Module&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1476:16
>   #28 0x000055df3f667c99 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1545:23
>   #29 0x000055df3f66780d llvm::legacy::PassManagerImpl::run(llvm::Module&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:16
>   #30 0x000055df3f66c4d1 llvm::legacy::PassManager::run(llvm::Module&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1672:3
>   #31 0x000055df41dc95b3 codegen(llvm::lto::Config const&, llvm::TargetMachine*, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:417:7
>   #32 0x000055df41dca05d llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, std::vector<std::pair<llvm::StringRef, llvm::BitcodeModule>, std::allocator<std::pair<llvm::StringRef, llvm::BitcodeModule>>>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&)::$_6::operator()(llvm::Module&, llvm::TargetMachine*, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>) const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:586:9
>   #33 0x000055df41dc9f26 llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, std::vector<std::pair<llvm::StringRef, llvm::BitcodeModule>, std::allocator<std::pair<llvm::StringRef, llvm::BitcodeModule>>>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:657:3
>   #34 0x000055df4065fc60 runThinLTOBackend(clang::DiagnosticsEngine&, llvm::ModuleSummaryIndex*, llvm::Module*, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, clang::BackendAction) /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1202:11
>   #35 0x000055df4065f2cb clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1243:9
>   #36 0x000055df41d50630 clang::CodeGenAction::ExecuteAction() /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1242:3
>   #37 0x000055df412a424c clang::FrontendAction::Execute() /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1062:7
>   #38 0x000055df411cd518 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1049:23
>   #39 0x000055df4146b927 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:264:8
>   #40 0x000055df3e1982d0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /usr/local/google/home/saugustine/llvm/llvm-project/clang/tools/driver/cc1_main.cpp:251:13
>   #41 0x000055df3e182ffa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /usr/local/google/home/saugustine/llvm/llvm-project/clang/tools/driver/driver.cpp:363:5
>   #42 0x000055df3e184c4d clang_main(int, char**, llvm::ToolContext const&)::$_1::operator()(llvm::SmallVectorImpl<char const*>&) const /usr/local/google/home/saugustine/llvm/llvm-project/clang/tools/driver/driver.cpp:541:7
>   #43 0x000055df3e184c1d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::$_1>(long, llvm::SmallVectorImpl<char const*>&) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
>   #44 0x000055df41083e89 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
>   #45 0x000055df41080328 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1::operator()() const /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Driver/Job.cpp:439:34
>   #46 0x000055df410802f5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
>   #47 0x000055df3eacc6d9 llvm::function_ref<void ()>::operator()() const /usr/local/google/home/saugustine/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
>   #48 0x000055df3fffeafa llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /usr/local/google/home/saugustine/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:3
>   #49 0x000055df4107fa87 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Driver/Job.cpp:439:7
>   #50 0x000055df4101cbaf clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:199:15
>   #51 0x000055df4101cdb7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:253:13
>   #52 0x000055df41037298 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /usr/local/google/home/saugustine/llvm/llvm-project/clang/lib/Driver/Driver.cpp:1856:7
>   #53 0x000055df3e182a79 clang_main(int, char**, llvm::ToolContext const&) /usr/local/google/home/saugustine/llvm/llvm-project/clang/tools/driver/driver.cpp:577:9
>   #54 0x000055df3e1ba67d main /usr/local/google/home/saugustine/llvm/build/tools/clang/tools/driver/clang-driver.cpp:15:3
>   #55 0x00007f7e1b24618a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
>   #56 0x00007f7e1b246245 call_init ./csu/../csu/libc-start.c:128:20
>   #57 0x00007f7e1b246245 __libc_start_main ./csu/../csu/libc-start.c:368:5
>   #58 0x000055df3e181451 _start (/usr/local/google/home/saugustine/llvm/build/bin/clang+0x1b2a451)

I suspect we're calling incDecVectorConstant from combineSetCC for an illegal type so it isn't an MVT. It's an EVT.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142254/new/

https://reviews.llvm.org/D142254



More information about the llvm-commits mailing list