================
@@ -2350,6 +2343,52 @@ are listed below.
pure ThinLTO, as all split regular LTO modules are merged and LTO linked
with regular LTO.
+.. option:: -fdevirtualize-speculatively
+
+ Enable speculative devirtualization optimization where a virtual call
+ can be transformed into a direct call under the assumption that its
+ object is of a particular type. A runtime check is inserted to validate
+ the assumption before making the direct call, and if the check fails,
+ the original virtual call is made instead. This optimization can enable
+ more inlining opportunities and better optimization of the direct call.
+ This is different from other whole program devirtualization optimizations
+ that rely on global analysis and hidden visibility of the objects to prove
+ that the object is always of a particular type at a virtual call site.
+ This optimization doesn't require global analysis or hidden visibility.
+ This optimization doesn't devirtualize all virtual calls, but only
+ when there's a single implementation of the virtual function.
+ There could be a single implementaiton of the virtual function
+ either because the function is not overridden in any derived class,
+ or because there is a sinlge instantiated object that is using the funciton.
----------------
hassnaaHamdi wrote:
I'm explaining the cases at which the devirtualization will be able to
devirtualize.
https://github.com/llvm/llvm-project/pull/159685
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits