-
Notifications
You must be signed in to change notification settings - Fork 95
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.bool
lowering differs from original clang CodeGen.
#480
Comments
Hi, I'm new to open source and llvm, and I want start contributing with this issue. To my understanding, the codegen for CIR produces the return value with extra bits, which is redundant since it requires extra casting for other operations. One thing I'm confused is the comment mentioned that the problem might be generated from LowerExpectIntrinsicPass, which is the infrastructure from llvm. Do you have any suggestions where to look at to get started? Thanks! |
@wolfcomos nice, welcome! You can ignore the
|
After discussions with @sitio-couto this will be solved by his ABI work that is work in progress, so assigning to him. |
I believe the root problem here is that CIR lowers
!cir.bool
in a different way than the original clang CodeGen.In the original CodeGen,
bool
glvalues are lowered to LLVMi8
values, andbool
prvalues are lowered to LLVMi1
values, as illustrated in the following example:However, in CIRGen, all
!cir.bool
values are lowered to LLVMi8
values. The example above would be lowered to LLVMIR through CIR as:This divergence leads to the redundancy illustrated in the PR description. The result of a
cir.cmp
operation is currently expected to be lowered to ani8
value although it's a prvalue. After emitting anllvm.icmp
operation, you have to insert anllvm.zext
operation to extend thei1
toi8
. Thus the redundancy.Originally posted by @Lancern in #478 (comment)
The text was updated successfully, but these errors were encountered: