[PATCH] D120781: [IRLinker] materialize Functions before moving any
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 12:32:43 PDT 2022
dexonsmith added a comment.
That case with `@x` reminded me of my concern about miscompiles due to `blockaddress` to a de-refinable function.
I was wondering if we could make those illegal in the verifier. In particular, reject a reference `blockaddress(@f, ...)` if:
- it's not a self-reference (it appears outside the body of `@f`) AND
- `@f` is de-refinable (linkage is `available_externally` or `{weak,linkonce}{,_odr}`) AND
- the reference is NOT in the same `comdat` as `@f`.
But I think we probably can't disallow it. Clang will generate IR that violates that for:
void sink(...);
inline void f1() {
static void *Label = &&label;
sink(Label);
label:
return;
}
void f2() { f1(); }
Maybe it'd be desirable to change Clang to put `Label` in the same `comdat` as `f1()`, but that won't solve object formats (like Mach-O) that don't have comdats.
For this case, the linker probably *in practice* probably selects them from the same object file.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120781/new/
https://reviews.llvm.org/D120781
More information about the llvm-commits
mailing list