[PATCH] D52514: [WPD] Fix incorrect devirtualization after indirect call promotion

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 12:31:02 PDT 2018


tejohnson created this revision.
tejohnson added reviewers: pcc, vitalybuka.
Herald added subscribers: dexonsmith, steven_wu, eraman, Prazek, mehdi_amini.

Add a dominance check to ensure that the possible devirtualizable
call is actually dominated by the type test/checked load intrinsic being
analyzed. With PGO, after indirect call promotion is performed during
the compile step, followed by inlining, we may have a type test in the
promoted and inlined sequence that allows an indirect call in that
sequence to be devirtualized. That indirect call (inserted by inlining
after promotion) will share the same vtable pointer as the fallback
indirect call that cannot be devirtualized.

Before this patch the code was incorrectly devirtualizing the fallback
indirect call.

See the new test and the example described there for more details.


Repository:
  rL LLVM

https://reviews.llvm.org/D52514

Files:
  include/llvm/Analysis/TypeMetadataUtils.h
  lib/Analysis/ModuleSummaryAnalysis.cpp
  lib/Analysis/TypeMetadataUtils.cpp
  lib/Transforms/IPO/WholeProgramDevirt.cpp
  test/ThinLTO/X86/devirt-after-icp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52514.166973.patch
Type: text/x-patch
Size: 23153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180925/0d98e84e/attachment-0001.bin>


More information about the llvm-commits mailing list