adams381 wrote:

@andykaylor It does happen for the unscoped `enum : bool`, which gets the same 
`IntegralCast` to `int` as a plain `bool`.  Integral promotion is only defined 
for unscoped enumerations, so in `enum class E : bool` there's nothing to 
promote and both operands of `a == b` stay at type `E`.

CIRGenTypes converts an enum through its underlying type, so that operand 
arrives as `!cir.bool`, and classic CodeGen compares these values as i1 (`icmp 
eq i1`, `icmp ult i1` for `<`).  That makes `!cir.bool` look right to me and 
`cir.cmp`'s operand constraint the thing that was out of step.  If enums do get 
their own CIR type later, this is one entry to drop from `CIR_ComparableType`.

https://github.com/llvm/llvm-project/pull/206846
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to