This patch introduce new intrinsic -
strip.invariant.group that was described in the
RFC: Devirtualization v2
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang/include/clang/AST/DeclCXX.h | ||
---|---|---|
778 ↗ | (On Diff #147683) | maybeDynamicClass? https://github.com/llvm-mirror/llvm/search?utf8=%E2%9C%93&q=maybe&type= |
clang/include/clang/AST/DeclCXX.h | ||
---|---|---|
778 ↗ | (On Diff #147683) | I think mayBe is more appropriate, because it grammatically consists of 'may' and 'be'. In this form it appears in multiple places in the codebase, too. A few examples: https://github.com/llvm-mirror/llvm/blob/0b24b74655b976aaba01b2f726659b8c745a16de/include/llvm/IR/GlobalValue.h#L131 |
The changes to Clang generally seem reasonable, but I think you should split them into a separate commit from the commit that adds the intrinsic itself.
clang/lib/CodeGen/CGExpr.cpp | ||
---|---|---|
3858 ↗ | (On Diff #147691) | Please add a comment explaining why this is necessary. (I'm actually not sure why it is, because surely the invariant groups we generate don't contain assumptions about memory from fields, right?) |
clang/lib/CodeGen/CGExprScalar.cpp | ||
1626 ↗ | (On Diff #147691) | Again, comment. |
1767 ↗ | (On Diff #147691) | I think assigning to IntToPtr would be clearer here. You're changing the value returned, not introducing a reason to early-exit. And a comment, please, on all of these cases. |
Slitted commit into defining and using intrinsic
clang/lib/CodeGen/CGExpr.cpp | ||
---|---|---|
3858 ↗ | (On Diff #147691) | Short answer: you can only make virtual calls on a dynamic pointer that carries invariant.group and you can't do anything other because it could leak the information about this pointer (which when used with comparison could break devirtualization). |
clang/lib/CodeGen/CGExpr.cpp | ||
---|---|---|
3858 ↗ | (On Diff #147691) | Alright, sure. |
llvm/docs/LangRef.rst | ||
---|---|---|
12928 ↗ | (On Diff #148313) | does carries -> carries |