[llvm-dev] Possible soundness issue with available_externally (split from "RFC: Add guard intrinsics")
Sanjoy Das via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 24 22:36:30 PST 2016
Mehdi Amini via llvm-dev wrote:
>> Take Sanjoy's example with the two atomic loads, but outline the body of the function into some private function.
The same restrictions need apply.
>
> Do you mean like:
>
> static void bar() {
> %t0 = load atomic %ptr
> %t1 = load atomic %ptr
> if (%t0 != %t1) print("X");
> }
> void foo() available_externally {
> bar();
> }
> void main() {
> foo();
> print("Y");
> }
> ```
>
> Sorry, I still fail to understand why you can't optimize bar(),
> including deducing attributes on it. Any reference to bar() is
> "final": bar() can't be interposed by the linker.
>
> I think you should be able to infer attributes (and do IPA in
> general on any function that matches
> GlobalValue::isStrongDefinitionForLinker()).
>
I suppose you could have one instance of foo() inline bar() _before_
any optimization, and another instance of foo() call a refined
readnone bar. Then replacing the latter with the former will be
a problem.
-- Sanjoy
More information about the llvm-dev
mailing list