mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Remove always-true comparison, NFC.
Summary: Looking at r241279, I noticed that UpgradedIntrinsics only gets written to in the following code: if (UpgradeIntrinsicFunction(&F, NewFn)) UpgradedIntrinsics[&F] = NewFn; Looking through UpgradeIntrinsicFunction, we always return false OR NewFn will be set to a different function from our source. This patch pulls the F != NewFn into UpgradeIntrinsicFunction as an assert, and removes the check from callers of UpgradeIntrinsicFunction. Reviewers: rafael, chandlerc Subscribers: llvm-commits-list Differential Revision: http://reviews.llvm.org/D10915 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241369 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -229,6 +229,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
|
||||
bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
|
||||
NewFn = nullptr;
|
||||
bool Upgraded = UpgradeIntrinsicFunction1(F, NewFn);
|
||||
assert(F != NewFn && "Intrinsic function upgraded to the same function");
|
||||
|
||||
// Upgrade intrinsic attributes. This does not change the function.
|
||||
if (NewFn)
|
||||
@@ -710,16 +711,14 @@ void llvm::UpgradeCallsToIntrinsic(Function* F) {
|
||||
// Upgrade the function and check if it is a totaly new function.
|
||||
Function *NewFn;
|
||||
if (UpgradeIntrinsicFunction(F, NewFn)) {
|
||||
if (NewFn != F) {
|
||||
// Replace all uses to the old function with the new one if necessary.
|
||||
for (Value::user_iterator UI = F->user_begin(), UE = F->user_end();
|
||||
UI != UE; ) {
|
||||
if (CallInst *CI = dyn_cast<CallInst>(*UI++))
|
||||
UpgradeIntrinsicCall(CI, NewFn);
|
||||
}
|
||||
// Remove old function, no longer used, from the module.
|
||||
F->eraseFromParent();
|
||||
// Replace all uses to the old function with the new one if necessary.
|
||||
for (Value::user_iterator UI = F->user_begin(), UE = F->user_end();
|
||||
UI != UE;) {
|
||||
if (CallInst *CI = dyn_cast<CallInst>(*UI++))
|
||||
UpgradeIntrinsicCall(CI, NewFn);
|
||||
}
|
||||
// Remove old function, no longer used, from the module.
|
||||
F->eraseFromParent();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user