Files
llvm-project/clang/test/CIR/CodeGen/pointers.cpp
Andy Kaylor 689dc6c58c [CIR] Handle boolean expression as array indexes (#193814)
We were hitting a CIR verification error in some cases when a boolean
expression was used as an index to an array because the GetElementOp
verifier expected the index operand to be a fundamental integer type. To
fix this, I'm updating the emitArraySubscriptExpr to cast index values
to ptrDiffTy, which more closely matches what classic codegen does in
the corrsponding code.

The improved alignment with the classic codegen implementation caused
some minor changes in generated IR that required some tests to be
updated.

Assisted-by: Cursor / claude-4.7-opus-high
2026-04-23 15:32:21 -07:00

3.9 KiB