-
Notifications
You must be signed in to change notification settings - Fork 90
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
[CIR][Lowering] Fix lowering for multi dimensional array #851
[CIR][Lowering] Fix lowering for multi dimensional array #851
Conversation
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 with some minor changes needed.
I just made a small change to |
…rceboy/clangir into multi-dim-array-lowering
…rceboy/clangir into multi-dim-array-lowering
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!
While here, extra question: if one of these arrays has more elements than what's used in the written initialization, is it getting proper zeros at the end? Perhaps add more tests for that in a following up PR?
This PR fixes the lowering for multi dimensional arrays.
Consider the following code snippet
test.c
:When ran with
bin/clang test.c -Xclang -fclangir -Xclang -emit-llvm -S -o -
, It produces the following error:The bug can be traced back to
LoweringHelpers.cpp
. It considers the values in the array as integer types, and this causes an error in this case.This PR updates
convertToDenseElementsAttrImpl
when the array contains string attributes. I have also added one more similar test. Note that in the tests I used a literal match to avoid matching as regex, so!dbg
is useful.