mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
DCE intrinsic instructions without side effects.
llvm-svn: 21719
This commit is contained in:
parent
4f7bba1106
commit
b953e27f85
@ -373,7 +373,26 @@ Constant *llvm::ConstantFoldCall(Function *F,
|
||||
//
|
||||
|
||||
bool llvm::isInstructionTriviallyDead(Instruction *I) {
|
||||
return I->use_empty() && !I->mayWriteToMemory() && !isa<TerminatorInst>(I);
|
||||
if (!I->use_empty() || isa<TerminatorInst>(I)) return false;
|
||||
|
||||
if (!I->mayWriteToMemory()) return true;
|
||||
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||
if (Function *F = CI->getCalledFunction())
|
||||
switch (F->getIntrinsicID()) {
|
||||
default: break;
|
||||
case Intrinsic::vastart:
|
||||
case Intrinsic::vacopy:
|
||||
case Intrinsic::returnaddress:
|
||||
case Intrinsic::frameaddress:
|
||||
case Intrinsic::isunordered:
|
||||
case Intrinsic::ctpop:
|
||||
case Intrinsic::ctlz:
|
||||
case Intrinsic::cttz:
|
||||
case Intrinsic::sqrt:
|
||||
return true; // These intrinsics have no side effects.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// dceInstruction - Inspect the instruction at *BBI and figure out if it's
|
||||
|
Loading…
Reference in New Issue
Block a user