Skip to content

Codegen emits non-bool cir.cmp operations #1108

@orbiri

Description

@orbiri

When looking at some C generated code I noticed that most cir.cmp operations that were generated were of type s32i, and then immediately converted to bool before used in if statements etc.

I found the root cause in CIRGenScalarExpr, will publish a fix over the coming week that simplifies the generated code for most cases.

———

I will note that a lot of tests rely on 1:1 generated CIR/LLVMIR, even without using file check variables, which makes such changes a lot harder than they could have been! For example, tests of lowering of complicated scopes and control flow should not check for the way that conditions are evaluated.

Metadata

Metadata

Assignees

Labels

IR differenceA difference in ClangIR-generated LLVM IR that could complicate reusing original CodeGen tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions