[PATCH] D95969: [WPD] Add an optional checking mode for debugging devirtualization

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 14:27:21 PST 2021


tejohnson added a comment.

@pcc You mentioned over chat that you were ok with this patch, but did you have any specific comments?

@davidxl response to your suggestion below.



================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1065
+        // devirtualized. The original call can be replaced with the trap.
+        CallBase &NewInst = versionCallSite(VCallSite.CB, TheFn);
+        NewInst.setCalledOperand(ConstantExpr::getBitCast(
----------------
davidxl wrote:
> is versioning necessary here? Can it just be:
> 
> if (target != direct_target)
>   trap();
> direct_target();
It could, but invoking versionCallSite was very convenient so I didn't need to replicate a bunch of the necessary code. With versionCallSite we currently get:

if (target == direct_target)
   direct_target()
else
  trap()

I'm not sure it matters much given that this is for debugging. Wdyt?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95969



More information about the llvm-commits mailing list