forked from OSchip/llvm-project
8c2ea32072
Originally, the lowering of `alloc` operations has been computing the number of bytes to allocate when lowering based on the properties of MLIR type. This does not take into account type legalization that happens when compiling LLVM IR down to target assembly. This legalization can widen the type, potentially leading to out-of-bounds accesses to `alloc`ed data due to mismatches between address computation that takes the widening into account and allocation that does not. Use the LLVM IR's equivalent of `sizeof` to compute the number of bytes to be allocated: %0 = getelementptr %type* null, %indexType 0 %1 = ptrtoint %type* %0 to %indexType adapted from http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt PiperOrigin-RevId: 274159900 |
||
---|---|---|
.. | ||
GPUToCUDA | ||
GPUToNVVM | ||
GPUToROCDL | ||
GPUToSPIRV | ||
LoopsToGPU | ||
StandardToLLVM | ||
StandardToSPIRV | ||
VectorToLLVM | ||
convert-to-cfg.mlir |