clangir
clangir copied to clipboard
CIR generated LLVM code for pointer arithmetic misses inbounds
sample code
void foo(int *iptr) { iptr + 2; }
Clang generated code:
https://godbolt.org/z/8Yjnhxhz4
where we have
getelementptr inbounds i32, ptr %0, i64 2
CIR generated LLVM code is like
https://godbolt.org/z/Wzdcvea46
where we see
getelementptr i32, ptr %3, i64 2,
We are missing inbounds here.
up for take. If nobody picks it up, I'll fix it next week
I can work on it to learn ClangIR.
@liusy58 welcome aboard! The website has some useful resources, and the Discord channel (use this link to join the LLVM Discord server if you haven't already) is a great place to ask questions (as is this issue). The general idea here would be to find the code in clang/lib/CodeGen that adds the appropriate attributes and then make the corresponding change under clang/lib/CIR/CodeGen.
Thank you! I know that ClangIR is good for analysis and can make c++ safer. Apart from this, can we do something else?
Thank you! I know that ClangIR is good for analysis and can make c++ safer. Apart from this, can we do something else?
Thanks for willing to help out! Along this line of IR differences, depending on your interests, there are a couple of issues in my mind that we could use help.
- Support for elementwise builtins . Those could be really useful for vector intensive programs that use those builtins. And since relevant Ops are already defined in CIR and support vector type now, this should be a relatively starter rampup work.
- Comparing to classic clang codegen, CIR codegen still misses function call site and parameter attributes in the generated LLVM IR.
I'll create issues for above 2 issues by next Monday.
Interesting topics. I love this!
Interesting topics. I love this! First issue: elementwise builtins https://github.com/llvm/clangir/issues/1192 The second issue already filed https://github.com/llvm/clangir/issues/1039
Ok, thank you!