llvm-project
ade4eeb3 - [mlir][cf] Reject duplicate case values in cf.switch (#245483)

Commit
11 hours ago
[mlir][cf] Reject duplicate case values in cf.switch (#245483) The verifier of cf.switch accepted case values that compare equal as integers of the flag's width, such as 255 and -1 for an i8 flag. Such an op has no single destination for that value, and it converts to an llvm.switch whose translation is rejected by the LLVM IR verifier ("Duplicate integer as switch case"). Report the first repeated value instead, with its signed and, when different, unsigned spelling and the indices of both cases. Add an invalid test where 255 and -1 collide for i8, and a test that 1 and -1 remain distinct cases. AI-assisted: this patch was prepared with Claude Code; I have reviewed and tested the change and take responsibility for it.
Author
Parents
Loading