[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
Fri Feb 26 20:18:36 PST 2016


On Fri, Feb 26, 2016 at 7:59 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> I'm *extremely* uncomfortable fixing this at all unless it can be done
> without causing performance regressions. The underlying basic use case
> (linking together code compiled with different optimization levels), is
> certainly something I'd like to work properly, but is definitely a far lower
> priority than optimized code quality and size.

You don't need different optimization levels to trigger this.  The
original example could have been

  void foo() available_externally {
    %t0 = load atomic %ptr
    %t1 = call i32 @bar()
    if (%t0 != %t1) print("X");
  }
  void main() {
    foo();
    print("Y");
  }

with @bar (just atomic_loads from %ptr and returns the value loaded)
being a declaration in one TU and a definition in another TU.  The TU
with the defn. could then inline @bar into @foo() while the one with
the decl. would not; leading to the same problem.

-- Sanjoy


More information about the llvm-dev mailing list