1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Continue counting intrinsics as instructions (except when they aren't, such as

debug info) and for being vector operations. Fixes regression from r147037.

llvm-svn: 147093
This commit is contained in:
Nick Lewycky 2011-12-21 20:26:03 +00:00
parent f147ddb0e6
commit cedb6b6ec4

View File

@ -63,8 +63,22 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
// Special handling for calls.
if (isa<CallInst>(II) || isa<InvokeInst>(II)) {
if (isa<IntrinsicInst>(II))
continue; // Intrinsics have no argument setup and can't be inlined.
if (const IntrinsicInst *IntrinsicI = dyn_cast<IntrinsicInst>(II)) {
switch (IntrinsicI->getIntrinsicID()) {
default: break;
case Intrinsic::dbg_declare:
case Intrinsic::dbg_value:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
case Intrinsic::objectsize:
case Intrinsic::ptr_annotation:
case Intrinsic::var_annotation:
// These intrinsics don't count as size.
continue;
}
}
ImmutableCallSite CS(cast<Instruction>(II));
@ -83,7 +97,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
isRecursive = true;
}
if (!callIsSmall(CS.getCalledFunction())) {
if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction())) {
// Each argument to a call takes on average one instruction to set up.
NumInsts += CS.arg_size();