diff options
author | Christian Ulmann <christianulmann@gmail.com> | 2024-03-22 16:44:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 16:44:06 +0100 |
commit | cb300c33059c1d14f72392ce5dffcf050ad7567d (patch) | |
tree | 773687d6d7e4b13d7cec3229849d762b6117cecc /mlir/lib | |
parent | b0e23639c5b19030bee2b307173802914f64aad6 (diff) | |
download | llvm-cb300c33059c1d14f72392ce5dffcf050ad7567d.zip llvm-cb300c33059c1d14f72392ce5dffcf050ad7567d.tar.gz llvm-cb300c33059c1d14f72392ce5dffcf050ad7567d.tar.bz2 |
[MLIR][LLVM][SROA] Fix pointer escape through stores bug (#86291)
This commit resolves a SROA bug caused by not properly checking if a
llvm store operation writes the pointer to memory or not. Now, we do no
longer consider stores that use a slot pointer as a value to store as
fixable.
Diffstat (limited to 'mlir/lib')
-rw-r--r-- | mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp index 0ef1d10..f171bf7 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp @@ -251,6 +251,10 @@ bool LLVM::StoreOp::canRewire(const DestructurableMemorySlot &slot, if (getVolatile_()) return false; + // Storing the pointer to memory cannot be dealt with. + if (getValue() == slot.ptr) + return false; + // A store always accesses the first element of the destructured slot. auto index = IntegerAttr::get(IntegerType::get(getContext(), 32), 0); Type subslotType = getTypeAtIndex(slot, index); |