about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-10 15:01:45 +0100
committerGitHub <noreply@github.com>2022-12-10 15:01:45 +0100
commitab505298ea4cf338403eeaa94c4458b5ad9530db (patch)
tree01e3cb591184e40a8068f5ff4d9cfc34ab27e05a /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent62160cba7b00e84e92e2e64dc8fa6ba906823585 (diff)
parent7253057887b6de77e6847844311da517d2ada1eb (diff)
downloadrust-ab505298ea4cf338403eeaa94c4458b5ad9530db.tar.gz
rust-ab505298ea4cf338403eeaa94c4458b5ad9530db.zip
Rollup merge of #105482 - wesleywiser:fix_debuginfo_ub, r=tmiasko
Fix invalid codegen during debuginfo lowering

In order for LLVM to correctly generate debuginfo for msvc, we sometimes need to spill arguments to the stack and perform some direct & indirect offsets into the value. Previously, this code always performed those actions, even when not required as LLVM would clean it up during optimization.

However, when MIR inlining is enabled, this can cause problems as the operations occur prior to the spilled value being initialized. To solve this, we first calculate the necessary offsets using just the type which is side-effect free and does not alter the LLVM IR. Then, if we are in a situation which requires us to generate the LLVM IR (and this situation only occurs for arguments, not local variables) then we perform the same calculation again, this time generating the appropriate LLVM IR as we go.

r? `@tmiasko` but feel free to reassign if you want 🙂

Fixes #105386
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions