llvm-project/mlir/test/Conversion
Alex Zinenko 8c2ea32072 Emit LLVM IR equivalent of sizeof when lowering alloc operations
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
2019-10-11 06:33:26 -07:00
..
GPUToCUDA Use llvm.func to define functions with wrapped LLVM IR function type 2019-10-10 01:34:06 -07:00
GPUToNVVM Add AllReduceOp to GPU dialect with lowering to NVVM. 2019-09-26 00:17:50 -07:00
GPUToROCDL [ROCm] Adding pass to lower GPU Dialect to ROCDL Dialect. 2019-10-02 01:50:30 -07:00
GPUToSPIRV Make SPIR-V lowering infrastructure follow Vulkan SPIR-V validation. 2019-10-09 11:25:58 -07:00
LoopsToGPU Replace linalg.for by loop.for 2019-07-16 13:44:57 -07:00
StandardToLLVM Emit LLVM IR equivalent of sizeof when lowering alloc operations 2019-10-11 06:33:26 -07:00
StandardToSPIRV Add lowering of constant ops to SPIR-V. 2019-10-10 17:19:57 -07:00
VectorToLLVM LLVM dialect: prefix auxiliary operations with "mlir." 2019-09-03 09:10:56 -07:00
convert-to-cfg.mlir NFC: rename Conversion/ControlFlowToCFG to Conversion/LoopToStandard 2019-10-03 01:35:03 -07:00