public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/107196] [13 Regression] llvm-14.0.6 is miscompiles by gcc-13 in -O3: hangs llvm testsuite (inliner seems to break it) Date: Sun, 09 Oct 2022 20:02:06 +0000 [thread overview] Message-ID: <bug-107196-4-5l1jY2263k@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107196-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107196 --- Comment #6 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > llvm/lib/Target/RISCV/RISCVISelLowering.cpp is huge source and it might have > undefined code in it. > Maybe narrow down which function is going wrong. What would be the best way to do it? I initially tried '#pragma GCC push_options/#pragma GCC optimize(0)/#pragma GCC pop_options', but the final result still requires a few headers and RISCVISelLowering.cpp functions to be outside optimize(0). I'm afraid I spent on in a few days and filed the bug in hopes there is a nicer technique to nail down the specific transformation that changes the behaviour. If there is no better way to do it I'll start sprinkling __attribute__((noinline, noipa)) around to get broken and working variants closer. > Maybe fire up gdb and see where the infinite loop is located too. Looking at gdb the problem is not very clear: generic (not RISCV-specific code) at '#8 Run () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1538' implements some instruction selection logic to pick better instructions (DAGCombiner). Normally it stabilizes, but in this case it does not finish. Heavy use of STL-like data structures do not make it easier to trace through in gdb to see where first deviation bet ween good/bad happens. llvm has debugging mode to dump the transformations applied but enabling it at build time make the bug to go away. Full backtrace: llvm::DenseMapBase<llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >, llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >::LookupBucketFor<llvm::SDNode*> () at llvm/include/llvm/ADT/DenseMap.h:632 632 if (LLVM_LIKELY(KeyInfoT::isEqual(Val, ThisBucket->getFirst()))) { (gdb) bt #0 llvm::DenseMapBase<llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >, llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >::LookupBucketFor<llvm::SDNode*> () at llvm/include/llvm/ADT/DenseMap.h:632 #1 llvm::DenseMapBase<llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >, llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >::LookupBucketFor<llvm::SDNode*> () at llvm/include/llvm/ADT/DenseMap.h:663 #2 llvm::DenseMapBase<llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >, llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >::try_emplace<unsigned int> () at llvm/include/llvm/ADT/DenseMap.h:225 #3 llvm::DenseMapBase<llvm::DenseMap<llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >, llvm::SDNode*, unsigned int, llvm::DenseMapInfo<llvm::SDNode*, void>, llvm::detail::DenseMapPair<llvm::SDNode*, unsigned int> >::insert () at llvm/include/llvm/ADT/DenseMap.h:216 #4 AddToWorklist () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:273 #5 0x00000000014f12e8 in AddToWorklist () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:268 #6 AddUsersToWorklist () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:195 #7 AddToWorklistWithUsers () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:200 #8 Run () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1538 #9 llvm::SelectionDAG::Combine () at llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:24210 #10 0x00000000015ea7bf in llvm::SelectionDAGISel::CodeGenAndEmitDAG () at llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:958 #11 0x00000000015ed2c5 in llvm::SelectionDAGISel::SelectAllBasicBlocks () at llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1634 #12 0x00000000015efd8b in llvm::SelectionDAGISel::runOnMachineFunction () at llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:515 #13 0x0000000000ba4f34 in llvm::MachineFunctionPass::runOnFunction () at llvm/lib/CodeGen/MachineFunctionPass.cpp:72 #14 llvm::MachineFunctionPass::runOnFunction () at llvm/lib/CodeGen/MachineFunctionPass.cpp:37 #15 0x0000000000ff87b0 in llvm::FPPassManager::runOnFunction () at llvm/lib/IR/LegacyPassManager.cpp:1434 #16 0x0000000000ff8b3c in llvm::FPPassManager::runOnModule () at llvm/lib/IR/LegacyPassManager.cpp:1480 #17 0x0000000000ffa39e in runOnModule () at llvm/lib/IR/LegacyPassManager.cpp:1549 #18 llvm::legacy::PassManagerImpl::run () at llvm/lib/IR/LegacyPassManager.cpp:539 #19 0x000000000065a38a in compileModule () at llvm/tools/llc/llc.cpp:719 #20 main () at llvm/tools/llc/llc.cpp:417
next prev parent reply other threads:[~2022-10-09 20:02 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-09 18:32 [Bug ipa/107196] New: " slyfox at gcc dot gnu.org 2022-10-09 18:34 ` [Bug ipa/107196] " pinskia at gcc dot gnu.org 2022-10-09 18:34 ` pinskia at gcc dot gnu.org 2022-10-09 18:38 ` slyfox at gcc dot gnu.org 2022-10-09 18:47 ` pinskia at gcc dot gnu.org 2022-10-09 19:25 ` slyfox at gcc dot gnu.org 2022-10-09 20:02 ` slyfox at gcc dot gnu.org [this message] 2022-10-10 7:25 ` rguenth at gcc dot gnu.org 2022-10-20 17:28 ` pinskia at gcc dot gnu.org 2022-10-21 6:26 ` slyfox at gcc dot gnu.org 2022-10-21 6:28 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107196-4-5l1jY2263k@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).