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

Fix late gc lowering pass for vector intrinsics #55864

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gbaraldi
Copy link
Member

No description provided.

if (auto VTy = dyn_cast<VectorType>(II->getType())) {
if (hasLoadedTy(VTy->getElementType())) {
// TODO: For now, only support constant index.
auto IdxOp = cast<ConstantInt>(II->getOperand(1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(auto IdxOp = dyn_cast<ConstantInt>...? Otherwise, this would assert for non ConstantInt?
Also add a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an assertion. This argument is a immarg argument in llvm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I don't understand the todo?

Zentrik added a commit to Zentrik/llvm_julia_tester that referenced this pull request Sep 28, 2024
@Zentrik
Copy link
Member

Zentrik commented Sep 28, 2024

JULIA_CPU_TARGET="sandybridge,-xsaveopt,clone_all;x86-64-v4,-rdrnd" is a more minimal reproducer for the build failure.

Looking at the coredump I get locally, I see its indexing out of bounds at

Numbers.push_back(BaseNumbers[i]);
but
assert(Tracked.size() == BaseNumbers.size());
should make sure that can't happen so I don't understand what's going on. I added a if statement to check if i >= BaseNumbers.size() and it never got hit.

Here's part of the backtrace form the core dump.

#12 0x0000730004148a26 in llvm::SmallVectorTemplateCommon<int, void>::operator[] (idx=<optimised out>, this=<optimised out>) at /home/rag/Documents/Code/julia/usr/include/llvm/ADT/SmallVector.h:291
#13 LateLowerGCFrame::NumberAllBase (this=this@entry=0x72ffe3ffd500, S=..., CurrentV=<optimised out>, CurrentV@entry=0x72ffad005810) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:567
#14 0x000073000414cc17 in LateLowerGCFrame::NumberAll (this=this@entry=0x72ffe3ffd500, S=..., V=<optimised out>, V@entry=0x72ffad005810) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:630
#15 0x000073000414d381 in LateLowerGCFrame::NoteUse (this=this@entry=0x72ffe3ffd500, S=..., V=0x72ffad005810, Uses=..., F=..., BBS=...) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:739

#16 0x000073000414d524 in LateLowerGCFrame::NoteUse (BBS=..., F=..., Uses=..., V=<optimised out>, S=..., this=0x72ffe3ffd500) at /home/rag/Documents/Code/julia/usr/include/llvm/IR/Value.h:533
#17 LateLowerGCFrame::NoteUse (F=..., V=<optimised out>, BBS=..., S=..., this=0x72ffe3ffd500) at /home/rag/Documents/Code/julia/src/llvm-gc-interface-passes.h:336
#18 LateLowerGCFrame::NoteOperandUses (this=this@entry=0x72ffe3ffd500, S=..., BBS=..., UI=...) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:751
#19 0x000073000414f611 in LateLowerGCFrame::LocalScan (this=this@entry=0x72ffe3ffd500, F=...) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:1419
#20 0x000073000414fc2d in LateLowerGCFrame::runOnFunction (this=0x72ffe3ffd500, F=..., CFGModified=0x72ffe3ffd4ef) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:2490
#21 0x000073000415015e in LateLowerGCPass::run (this=<optimised out>, F=..., AM=...) at /home/rag/Documents/Code/julia/src/llvm-late-gc-lowering.cpp:2506

@giordano
Copy link
Contributor

Note that this is necessary to upgrade to LLVM 20: #57352.

@gbaraldi gbaraldi force-pushed the gb/vector-intrinsic branch from 28f9e83 to b58834a Compare February 25, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LateLowerGCFrame infinite loops in presence of @llvm.vector.insert in IR
4 participants