diff options
author | Luke Drummond <luke.drummond@codeplay.com> | 2022-10-13 16:57:43 +0100 |
---|---|---|
committer | Luke Drummond <luke.drummond@codeplay.com> | 2025-07-23 12:14:51 +0100 |
commit | f992ae4fd16357116b341a1c8291b970787dc462 (patch) | |
tree | 230e5a065d89df9461c9ff95abe7c7840203fe05 /llvm/unittests/IR/ModuleTest.cpp | |
parent | 283fd3f09a3d1fac283a991d2d0f3f9cfbd69e1d (diff) | |
download | llvm-f992ae4fd16357116b341a1c8291b970787dc462.zip llvm-f992ae4fd16357116b341a1c8291b970787dc462.tar.gz llvm-f992ae4fd16357116b341a1c8291b970787dc462.tar.bz2 |
Slightly improve the getenv("bar") linking problem
There's been a variation of the following in the code since 2005:
if (unoptimizable_true)
return;
use_this_symbol_to_force_linking(); // unreachable but never removed
Way back in 00d5508496c it was the win32 call `GetCurrentProcess`
but switched to `getenv("bar")` fairly soon after in 63e504ff43. While
that pulled in fewer dependencies and made the code portable, it's a
bit of a weird construct. The environment variable used for the `getenv`
call is "bar", which is particularly weird to see fly past when you run
`ltrace` on a binary linked against LLVM.
In this patch I don't try to replace this construct wholesale - it's
still required for architectural reasons I'm not able to tackle right
now, but I did try and make it slightly less weird and opaque:
- It gives the construct a name
- The environment variable hints where this comes from and that its
value is ignored
Combined, this should be a bit of improvement for the next person who
wonders what LLVM is up to when they trace their process or see
smatterings of `getenv("bar")` dotted around the source.
Diffstat (limited to 'llvm/unittests/IR/ModuleTest.cpp')
0 files changed, 0 insertions, 0 deletions