[PATCH] D107249: [GlobalOpt] Don't optimize out non-preemptible alias if aliasee may be preemptible
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 1 23:00:43 PDT 2021
MaskRay created this revision.
MaskRay added reviewers: aeubanks, rnk.
Herald added subscribers: ormris, jeroen.dobbelaere, hiraditya.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Generalize D99629 <https://reviews.llvm.org/D99629> for ELF.
- A non-preemptible call can save a PLT entry.
- A PC-relative relocation referencing a preemptible symbol is disallowed for -shared links, so replacing a non-preemptible alias with the preemptible aliasee can introduce a linker error.
(Note: `isInterposable` is mostly correct for interprocedural
optimizations but not suitable for variable behaviors on ELF.)
We should suppress alias removal for the case.
I think canonicalization for the changed case has little advantage, so I don't
bother to add the `Triple(M.getTargetTriple()).isOSBinFormatELF()` or
`getPICLevel/getPIELevel` complexity.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107249
Files:
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
llvm/test/Transforms/GlobalOpt/alias-resolve.ll
llvm/test/Transforms/GlobalOpt/alias-used-address-space.ll
llvm/test/Transforms/GlobalOpt/alias-used.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107249.363377.patch
Type: text/x-patch
Size: 3919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210802/b1fbba14/attachment.bin>
More information about the llvm-commits
mailing list