mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
WholeProgramDevirt: print remarks with devirtualized method names.
Summary: Chrome on Linux uses WholeProgramDevirt for speed ups, and it's important to detect regressions on both sides: the toolchain, if fewer methods get devirtualized after an update, and Chrome, if an innocently looking change caused many hot methods become virtual again. The need to track devirtualized methods is not Chrome-specific, but it's probably the only user of the pass at this time. Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23219 llvm-svn: 277856
This commit is contained in:
parent
066bd5eb0e
commit
2c83cdacf1
@ -35,6 +35,7 @@
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
@ -610,6 +611,16 @@ bool DevirtModule::tryVirtualConstProp(
|
||||
return true;
|
||||
}
|
||||
|
||||
static void emitTargetsRemarks(const std::vector<VirtualCallTarget> &TargetsForSlot) {
|
||||
for (const VirtualCallTarget &Target : TargetsForSlot) {
|
||||
Function *F = Target.Fn;
|
||||
DISubprogram *SP = F->getSubprogram();
|
||||
DebugLoc DL = SP ? DebugLoc::get(SP->getScopeLine(), 0, SP) : DebugLoc();
|
||||
emitOptimizationRemark(F->getContext(), DEBUG_TYPE, *F, DL,
|
||||
std::string("devirtualized ") + F->getName().str());
|
||||
}
|
||||
}
|
||||
|
||||
void DevirtModule::rebuildGlobal(VTableBits &B) {
|
||||
if (B.Before.Bytes.empty() && B.After.Bytes.empty())
|
||||
return;
|
||||
@ -815,10 +826,15 @@ bool DevirtModule::run() {
|
||||
S.first.ByteOffset))
|
||||
continue;
|
||||
|
||||
if (trySingleImplDevirt(TargetsForSlot, S.second))
|
||||
if (trySingleImplDevirt(TargetsForSlot, S.second)) {
|
||||
emitTargetsRemarks(TargetsForSlot);
|
||||
continue;
|
||||
}
|
||||
|
||||
DidVirtualConstProp |= tryVirtualConstProp(TargetsForSlot, S.second);
|
||||
if (tryVirtualConstProp(TargetsForSlot, S.second)) {
|
||||
emitTargetsRemarks(TargetsForSlot);
|
||||
DidVirtualConstProp = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we were able to eliminate all unsafe uses for a type checked load,
|
||||
|
@ -1,8 +1,12 @@
|
||||
; RUN: opt -S -wholeprogramdevirt %s | FileCheck %s
|
||||
; RUN: opt -S -wholeprogramdevirt -pass-remarks=wholeprogramdevirt %s 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized call
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf
|
||||
|
||||
@vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
|
||||
@vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
|
||||
|
||||
|
@ -4,8 +4,20 @@ target datalayout = "e-p:64:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized call
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf1i32
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf2i32
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf3i32
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf4i32
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized call
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf1i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf0i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf1i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf0i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized call
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf0i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf1i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf0i1
|
||||
; CHECK: remark: <unknown>:0:0: devirtualized vf1i1
|
||||
; CHECK-NOT: devirtualized call
|
||||
|
||||
; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\01\01\00\00\00", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf1i32 to i8*)], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user