[PATCH] D57295: [IR] Use CallBase to reduce code duplication. NFC

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 26 15:21:52 PST 2019


craig.topper created this revision.
craig.topper added a reviewer: chandlerc.

Noticed in the asm-goto patch. Callbr needs to go here too. One cast and call is better than 3.


Repository:
  rL LLVM

https://reviews.llvm.org/D57295

Files:
  lib/IR/Instruction.cpp


Index: lib/IR/Instruction.cpp
===================================================================
--- lib/IR/Instruction.cpp
+++ lib/IR/Instruction.cpp
@@ -515,9 +515,8 @@
   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 @@
   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();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57295.183734.patch
Type: text/x-patch
Size: 908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190126/8dee0868/attachment.bin>


More information about the llvm-commits mailing list