[PATCH] D20260: [wip] IR: Introduce local_unnamed_addr attribute.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 13:50:14 PDT 2016


pcc added a comment.

> Should the verifier check if this the property is invalidly set?


I discussed this a little with @majnemer on IRC. I think we cannot do this because passes should be allowed to introduce benign address comparisons. One example of this is speculative comparison of vtable addresses for devirtualization (vtables are unnamed_addr in C++, but imagine some other language where they weren't). If globalopt were to mark globals local_unnamed_addr, that would cause any speculative comparison to fail to verify.

One way to solve the problem could be to teach the devirtualizer to clear the local_unnamed_addr attribute, but imagine some case where some pass that runs after the devirtualizer uncovers the comparison (for example, if a constructor is inlined into a devirtualized call site, that might cause both sides of the comparison to become constant). This means that any number of passes would need to protect against this situation.


http://reviews.llvm.org/D20260





More information about the llvm-commits mailing list