circt
circt copied to clipboard
[HWToLLVM] ArrayGet lowering produces out-of-bounds memory access
Array get/slice lowering patterns in HW-to-LLVM generate unguarded loads, potentially loading values from invalid memory locations:
https://github.com/llvm/circt/blob/ce9877c55544937aec68b2a5b099ccef788168ba/lib/Conversion/HWToLLVM/HWToLLVM.cpp#L136-L176
In case the index is not a power of two, we should probably add an scf.if here to only perform the load if it is within the range of the array.