[PATCH] D90275: [clang][IR] Add support for leaf attribute

Juneyoung Lee via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 05:47:27 PST 2020


aqjune added a comment.

In D90275#2371813 <https://reviews.llvm.org/D90275#2371813>, @jdoerfert wrote:

> As noted by the GCC docs, it doesn't mean anything on a definition so that you can safely merge TUs. I want us to forbid `leaf` on IR function definitions for that reason, it would not mean anything and be only confusing.

Okay, I see.
I agree that having this attribute at definitions is slightly dangerous..!

But I am not still 100% sure about the safety of merging... I see that it is okay when `leaf` is on a definition, but what about declaration?

  // a.ll
  define void f1() { f2(); }
  define void g() { x = 3; }
  // b.ll
  define void f2() { leaf(); }
  declare leaf void @leaf() ; If @leaf() was actually calling @g(), is merging a.ll and b.ll valid?



> It is not a memory thing. However, the "almost" matching memory property is called `inaccesiblememonly` so that is why I wanted to call this `inaccessiblecodeonly`.

Eh, actually my question was more like a question to gcc people about why `leaf` was defined that way. Maybe my question is not relevant in this thread. Thank you for answering though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90275/new/

https://reviews.llvm.org/D90275



More information about the cfe-commits mailing list