[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

llvm-svn: 352563
This commit is contained in:
Craig Topper 2019-01-29 23:31:54 +00:00
parent d45b03bb81
commit 0b5e6b11c3
1 changed files with 2 additions and 4 deletions

View File

@ -515,9 +515,8 @@ bool Instruction::mayReadFromMemory() const {
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() const {
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();
}