-
Notifications
You must be signed in to change notification settings - Fork 35
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
Prevent InvalidBitWidth Errors #963
Conversation
775f39d
to
15a1bf9
Compare
15a1bf9
to
c470576
Compare
5e3d475
to
d0fe9e6
Compare
682255c
to
c1d5a97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, run git-clang-format on the changes.
e62dca7
to
85f5553
Compare
@linehill I spent a fair amount of looking already but to confirm: there is no way to instruct LLVM to NOT generate illegal integer types? |
Did you look into the pass responsible for spawning the non-standard integers? It might have a command line option for it. |
I did but I can't find my notes on which one it was but iirc it was quite early and deals with general loop optimizations so disabling is not desired. |
1. Upgrade non-standard sizes 2. Remove redundant trunc instructions
c2ca7e2
to
9fe898d
Compare
When you find it again, check if it has an option that could stop it to generate non-standard integers - not to disable the whole pass. |
It's |
llvm_passes/HipPromoteInts.cpp
Outdated
for (auto It = Replacements.rbegin(); It != Replacements.rend(); | ||
++It) { | ||
It->Old->eraseFromParent(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to iterate the container in reverse order?
for (auto It = Replacements.rbegin(); It != Replacements.rend(); | |
++It) { | |
It->Old->eraseFromParent(); | |
} | |
for (auto &R : Replacements) | |
R.Old->eraseFromParent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To preserve iterators traversing instructions from leaf to root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? I'm thinking you encountered restriction on the Instruction::eraseFromParent()
that does not allow instructions with users to be erased and the reverse iteration order works-around it. I guess that explains it.
092cbf2
to
cd8b100
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
During optimization of loops, LLVM generates non-standard integer types such as i33 or i56.
Tried to find which LLVM pass does this but it seems to happen quite early.