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

Why does the cir::BoolType got lowered to mlir::i8? #962

Closed
ChuanqiXu9 opened this issue Oct 11, 2024 · 3 comments
Closed

Why does the cir::BoolType got lowered to mlir::i8? #962

ChuanqiXu9 opened this issue Oct 11, 2024 · 3 comments

Comments

@ChuanqiXu9
Copy link
Member

ChuanqiXu9 commented Oct 11, 2024

I found this in:

converter.addConversion([&](mlir::cir::BoolType type) -> mlir::Type {
return mlir::IntegerType::get(type.getContext(), 8,
mlir::IntegerType::Signless);
});

this is pretty a surprise to me. What is the concern here?

@Lancern
Copy link
Member

Lancern commented Oct 11, 2024

This is a known issue for quite a long time, see #32 .

The problem with bool is that its LLVM type depends on the value category. Clang lowers prvalue bool to i1 and lvalue bool to i8. But CIR does not yet have stuff to track this, so CIR lowers !cir.bool to i8 unconditionally.

@smeenai
Copy link
Collaborator

smeenai commented Oct 11, 2024

There's also #480, which mentions this was supposed to be fixed by the ABI work. I guess that part hasn't landed yet?

@smeenai
Copy link
Collaborator

smeenai commented Oct 11, 2024

I'm going to close this to centralize discussion on #480 instead. It's unfortunate GitHub issues defaults to sorting by issue creation time instead of last comment time though.

@smeenai smeenai closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
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

No branches or pull requests

3 participants