aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-01-30 13:45:47 -0800
committerGitHub <noreply@github.com>2024-01-30 13:45:47 -0800
commit9b91c54d9bd3227a49e146c055fb0165567f7f8d (patch)
tree9a1362ec3908ec6a5b3c1ec2a076fcf22ce3b800 /llvm/lib/Support/VirtualFileSystem.cpp
parentd9423398ea129e229b20ba42dfe4326e620129b5 (diff)
downloadllvm-9b91c54d9bd3227a49e146c055fb0165567f7f8d.zip
llvm-9b91c54d9bd3227a49e146c055fb0165567f7f8d.tar.gz
llvm-9b91c54d9bd3227a49e146c055fb0165567f7f8d.tar.bz2
[msan] Unpoison indirect outputs for userspace using memset for large operands (#79924)
Modify #77393 to clear shadow memory using `llvm.memset.*` when the size is large, similar to `shouldUseBZeroPlusStoresToInitialize` in clang for `-ftrivial-auto-var-init=`. The intrinsic, if lowered to libcall, will use the msan interceptor. The instruction selector lowers a `StoreInst` to multiple stores, not utilizing `memset`. When the size is large (e.g. `store { [100 x i32] } zeroinitializer, ptr %12, align 1`), the generated code will be long (and `CodeGenPrepare::optimizeInst` will even crash for a huge size). ``` // Test stack size template <class T> void DoNotOptimize(const T& var) { // deprecated by https://github.com/google/benchmark/pull/1493 asm volatile("" : "+m"(const_cast<T&>(var))); } int main() { using LargeArray = std::array<int, 1000000>; auto large_stack = []() { DoNotOptimize(LargeArray()); }; /////// CodeGenPrepare::optimizeInst triggers an assertion failure when creating an integer type with a bit width>2**23 large_stack(); } ```
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
0 files changed, 0 insertions, 0 deletions