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

Crash in DAGCombiner, aarch64-windows-msvc, llvm-19.1.3 #114962

Open
abique opened this issue Nov 5, 2024 · 4 comments
Open

Crash in DAGCombiner, aarch64-windows-msvc, llvm-19.1.3 #114962

abique opened this issue Nov 5, 2024 · 4 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well

Comments

@abique
Copy link

abique commented Nov 5, 2024

Hi,

I'm getting a weird crash in llvm optimizer:

BitwigAudioEngine-ARM64-NEON.exe!std::pair<llvm::AACacheLoc,llvm::AACacheLoc>::pair<llvm::AACacheLoc,llvm::AACacheLoc,0>(llvm::AACacheLoc && _Val1, llvm::AACacheLoc && _Val2) Line 247 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\utility:247)
BitwigAudioEngine-ARM64-NEON.exe!std::make_pair<llvm::AACacheLoc,llvm::AACacheLoc>(llvm::AACacheLoc && _Val1, llvm::AACacheLoc && _Val2) Line 561 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\utility:561)
BitwigAudioEngine-ARM64-NEON.exe!llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>::getEmptyKey() Line 227 (c:\Users\alex\bitwig\target\dependencies\windows-arm64\include\llvm\ADT\DenseMapInfo.h:227)
BitwigAudioEngine-ARM64-NEON.exe!llvm::DenseMapBase<llvm::SmallDenseMap<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,8,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>,std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>::getEmptyKey() Line 499 (c:\Users\alex\bitwig\target\dependencies\windows-arm64\include\llvm\ADT\DenseMap.h:499)
BitwigAudioEngine-ARM64-NEON.exe!llvm::DenseMapBase<llvm::SmallDenseMap<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,8,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>,std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>::LookupBucketFor<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>>(const std::pair<llvm::AACacheLoc,llvm::AACacheLoc> & Val, const llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry> * & FoundBucket) Line 664 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\include\llvm\ADT\DenseMap.h:664)
BitwigAudioEngine-ARM64-NEON.exe!llvm::DenseMapBase<llvm::SmallDenseMap<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,8,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>,std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>::LookupBucketFor<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>>(const std::pair<llvm::AACacheLoc,llvm::AACacheLoc> & Val, llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry> * & FoundBucket) Line 704 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\include\llvm\ADT\DenseMap.h:704)
BitwigAudioEngine-ARM64-NEON.exe!llvm::DenseMapBase<llvm::SmallDenseMap<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,8,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>,std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry,llvm::DenseMapInfo<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,void>,llvm::detail::DenseMapPair<std::pair<llvm::AACacheLoc,llvm::AACacheLoc>,llvm::AAQueryInfo::CacheEntry>>::try_emplace<llvm::AAQueryInfo::CacheEntry>(const std::pair<llvm::AACacheLoc,llvm::AACacheLoc> & Key, llvm::AAQueryInfo::CacheEntry && <Args_0>) Line 262 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\include\llvm\ADT\DenseMap.h:262)
BitwigAudioEngine-ARM64-NEON.exe!llvm::BasicAAResult::aliasCheck(const llvm::Value * V1, llvm::LocationSize V1Size, const llvm::Value * V2, llvm::LocationSize V2Size, llvm::AAQueryInfo & AAQI, const llvm::Instruction * CtxI) Line 1690 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\Analysis\BasicAliasAnalysis.cpp:1690)
BitwigAudioEngine-ARM64-NEON.exe!llvm::BasicAAResult::alias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB, llvm::AAQueryInfo & AAQI, const llvm::Instruction * CtxI) Line 900 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\Analysis\BasicAliasAnalysis.cpp:900)
BitwigAudioEngine-ARM64-NEON.exe!llvm::AAResults::Model<llvm::BasicAAResult>::alias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB, llvm::AAQueryInfo & AAQI, const llvm::Instruction * CtxI) Line 777 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\include\llvm\Analysis\AliasAnalysis.h:777)
BitwigAudioEngine-ARM64-NEON.exe!llvm::AAResults::alias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB, llvm::AAQueryInfo & AAQI, const llvm::Instruction * CtxI) Line 127 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\Analysis\AliasAnalysis.cpp:127)
BitwigAudioEngine-ARM64-NEON.exe!llvm::AAResults::alias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB) Line 110 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\Analysis\AliasAnalysis.cpp:110)
BitwigAudioEngine-ARM64-NEON.exe!llvm::AAResults::isNoAlias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB) Line 374 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\include\llvm\Analysis\AliasAnalysis.h:374)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::mayAlias(llvm::SDNode * Op0, llvm::SDNode * Op1) Line 28395 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:28395)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous-namespace'::DAGCombiner::GatherAllAliases::__l2::<lambda_1>::operator()(llvm::SDValue & C) Line 28435 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:28435)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::GatherAllAliases(llvm::SDNode * N, llvm::SDValue OriginalChain, llvm::SmallVectorImpl<llvm::SDValue> & Aliases) Line 28502 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:28502)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::FindBetterChain(llvm::SDNode * N, llvm::SDValue OldChain) Line 28524 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:28524)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::findBetterNeighborChains(llvm::StoreSDNode * St) Line 28692 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:28692)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::visitSTORE(llvm::SDNode * N) Line 21481 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:21481)
BitwigAudioEngine-ARM64-NEON.exe!`anonymous namespace'::DAGCombiner::visit(llvm::SDNode * N) Line 1952 (c:\j\workspace\ext-libs\src\vcpkg\buildtrees\llvm\src\org-19.1.3-a54b36719d.clean\llvm\lib\CodeGen\SelectionDAG\DAGCombiner.cpp:1952)

Exception thrown at 0x00007FF6C36EE4B8 in BitwigAudioEngine-ARM64-NEON.exe: 0xC0000005: Access violation writing location 0x0000000000000000

I've a JIT engine using LLVM-19.1.3 on Windows ARM64.

Do you have anyidea what the problem could be based upon the backtrace?

Thanks!

@abique
Copy link
Author

abique commented Nov 5, 2024

Could it be that llvm::LocationSize when default constructed doesn't initialize Value?
It also seems that PunnedPointer doesn't initialize memory with the default constructor.

@abique
Copy link
Author

abique commented Nov 5, 2024

image

@abique
Copy link
Author

abique commented Nov 5, 2024

I've tried linking with a larger stack: add_link_options("/stack:32000000") and the issue still occurs, so I don't think it is a stack size issue.

@abique
Copy link
Author

abique commented Nov 5, 2024

Enabling the global instruction selector seems to workaround this issue.
Unfortunately the global isel doesn't seem to be something that always works either.

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well and removed new issue labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

No branches or pull requests

2 participants