[PATCH] D46326: ThinLTO+CFI: short-circuit direct calls to jump table entries

Dmitry Mikulin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 15:42:05 PDT 2018


dmikulin added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/LowerTypeTests.cpp:1221
                        GlobalValue::ExternalWeakLinkage, "", &M);
-  F->replaceAllUsesWith(PlaceholderFn);
+  replaceCfiUses(F, PlaceholderFn);
 
----------------
vlad.tsyrklevich wrote:
> This logic is slightly different because it skips block addresses. Is it possible that a local weak function would exist that would cause an exception by not being replaced here?
We had to special case blockaddr before and I felt that since they don't refer to function entry points (correct?), they should not be routed through jump tables and should be skipped here as well. Or, if this case never occurs,  at least it should be safe to skip.


================
Comment at: llvm/lib/Transforms/IPO/LowerTypeTests.cpp:1451
       else
-        F->replaceAllUsesWith(CombinedGlobalElemPtr);
+        replaceCfiUses(F, CombinedGlobalElemPtr);
     } else {
----------------
vlad.tsyrklevich wrote:
> Ditto the above. Because of !IsDefinition I can't think of a case where a blockaddress would be valid though, so this might be fine.
Same here.


https://reviews.llvm.org/D46326





More information about the llvm-commits mailing list