mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[AutoUpgrade] Simplify code
No need to set the name on an instruction that's going away, just move it from the old instruction to the new one.
This commit is contained in:
parent
76e22108d4
commit
5279174413
@ -3720,11 +3720,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
// Replace the original call result with the first result of the new call.
|
||||
Value *TSC = Builder.CreateExtractValue(NewCall, 0);
|
||||
|
||||
std::string Name = std::string(CI->getName());
|
||||
if (!Name.empty()) {
|
||||
CI->setName(Name + ".old");
|
||||
NewCall->setName(Name);
|
||||
}
|
||||
NewCall->takeName(CI);
|
||||
CI->replaceAllUsesWith(TSC);
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
@ -3761,11 +3757,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
NewCall = Builder.CreateCall(NewFn, Args);
|
||||
Value *Res = ApplyX86MaskOn1BitsVec(Builder, NewCall, nullptr);
|
||||
|
||||
std::string Name(CI->getName());
|
||||
if (!Name.empty()) {
|
||||
CI->setName(Name + ".old");
|
||||
NewCall->setName(Name);
|
||||
}
|
||||
NewCall->takeName(CI);
|
||||
CI->replaceAllUsesWith(Res);
|
||||
CI->eraseFromParent();
|
||||
return;
|
||||
@ -3819,11 +3811,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
}
|
||||
assert(NewCall && "Should have either set this variable or returned through "
|
||||
"the default case");
|
||||
std::string Name = std::string(CI->getName());
|
||||
if (!Name.empty()) {
|
||||
CI->setName(Name + ".old");
|
||||
NewCall->setName(Name);
|
||||
}
|
||||
NewCall->takeName(CI);
|
||||
CI->replaceAllUsesWith(NewCall);
|
||||
CI->eraseFromParent();
|
||||
}
|
||||
@ -4016,7 +4004,7 @@ void llvm::UpgradeARCRuntime(Module &M) {
|
||||
// Create a call instruction that calls the new function.
|
||||
CallInst *NewCall = Builder.CreateCall(NewFuncTy, NewFn, Args);
|
||||
NewCall->setTailCallKind(cast<CallInst>(CI)->getTailCallKind());
|
||||
NewCall->setName(CI->getName());
|
||||
NewCall->takeName(CI);
|
||||
|
||||
// Bitcast the return value back to the type of the old call.
|
||||
Value *NewRetVal = Builder.CreateBitCast(NewCall, CI->getType());
|
||||
|
Loading…
Reference in New Issue
Block a user