[all-commits] [llvm/llvm-project] c5b3fa: Reland "[clang-repl] Keep the first llvm::Module e...
Vassil Vassilev via All-commits
all-commits at lists.llvm.org
Mon May 13 17:29:17 PDT 2024
Branch: refs/heads/release/18.x
Home: https://github.com/llvm/llvm-project
Commit: c5b3fa491f001e06bca9a2f0754937d3614fd9e8
https://github.com/llvm/llvm-project/commit/c5b3fa491f001e06bca9a2f0754937d3614fd9e8
Author: Vassil Vassilev <v.g.vassilev at gmail.com>
Date: 2024-05-13 (Mon, 13 May 2024)
Changed paths:
M clang/lib/Interpreter/IncrementalParser.cpp
M clang/lib/Interpreter/IncrementalParser.h
Log Message:
-----------
Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)"
Original commit message: "
Clang's CodeGen is designed to work with a single llvm::Module. In many cases
for convenience various CodeGen parts have a reference to the llvm::Module
(TheModule or Module) which does not change when a new module is pushed.
However, the execution engine wants to take ownership of the module which does
not map well to CodeGen's design. To work this around we clone the module and
pass it down.
With some effort it is possible to teach CodeGen to ask the CodeGenModule for
its current module and that would have an overall positive impact on CodeGen
improving the encapsulation of various parts but that's not resilient to future
regression.
This patch takes a more conservative approach and keeps the first llvm::Module
empty intentionally and does not pass it to the Jit. That's also not bullet
proof because we have to guarantee that CodeGen does not write on the
blueprint. However, we have inserted some assertions to catch accidental
additions to that canary module.
This change will fixes a long-standing invalid memory access reported by
valgrind when we enable the TBAA optimization passes. It also unblock progress
on https://github.com/llvm/llvm-project/pull/84758.
"
This patch reverts adc4f6233df734fbe3793118ecc89d3584e0c90f and removes
the check of `named_metadata_empty` of the first llvm::Module because on darwin
clang inserts some harmless metadata which we can ignore.
(cherry picked from commit a3f07d36cbc9e3a0d004609d140474c1d8a25bb6)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list