Mehdi Amini 8ac00ba7f9
[mlir][SCFToEmitC] Fix crash when scf.while carries a memref loop variable (#183944)
When a scf.while op has a loop-carried value whose type converts to
emitc::ArrayType (e.g. memref<1xf64>), the WhileLowering pattern
unconditionally called emitc::LValueType::get(arrayType), which
triggered an assertion because LValueType cannot wrap an array type.

Fix by returning a match failure in createVariablesForResults and
createVariablesForLoopCarriedValues when the converted type is an
emitc::ArrayType. This converts the crash into a proper legalization
failure.

Fixes #182649
2026-03-04 12:03:46 +01:00
..