[llvm] r352563 - [IR] Use CallBase to reduce code duplication. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 29 15:31:55 PST 2019
Author: ctopper
Date: Tue Jan 29 15:31:54 2019
New Revision: 352563
URL: http://llvm.org/viewvc/llvm-project?rev=352563&view=rev
Log:
[IR] Use CallBase to reduce code duplication. NFC
Noticed in the asm-goto patch. Callbr needs to go here too. One cast and call is better than 3.
Differential Revision: https://reviews.llvm.org/D57295
Modified:
llvm/trunk/lib/IR/Instruction.cpp
Modified: llvm/trunk/lib/IR/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instruction.cpp?rev=352563&r1=352562&r2=352563&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instruction.cpp (original)
+++ llvm/trunk/lib/IR/Instruction.cpp Tue Jan 29 15:31:54 2019
@@ -515,9 +515,8 @@ bool Instruction::mayReadFromMemory() co
case Instruction::CatchRet:
return true;
case Instruction::Call:
- return !cast<CallInst>(this)->doesNotAccessMemory();
case Instruction::Invoke:
- return !cast<InvokeInst>(this)->doesNotAccessMemory();
+ return !cast<CallBase>(this)->doesNotAccessMemory();
case Instruction::Store:
return !cast<StoreInst>(this)->isUnordered();
}
@@ -535,9 +534,8 @@ bool Instruction::mayWriteToMemory() con
case Instruction::CatchRet:
return true;
case Instruction::Call:
- return !cast<CallInst>(this)->onlyReadsMemory();
case Instruction::Invoke:
- return !cast<InvokeInst>(this)->onlyReadsMemory();
+ return !cast<CallBase>(this)->onlyReadsMemory();
case Instruction::Load:
return !cast<LoadInst>(this)->isUnordered();
}
More information about the llvm-commits
mailing list