[IR] Make Instruction::isAssociative method inline. Add LLVM_READONLY to the static...
authorCraig Topper <craig.topper@gmail.com>
Sun, 26 Mar 2017 23:23:29 +0000 (23:23 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 26 Mar 2017 23:23:29 +0000 (23:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298826 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Instruction.h
lib/IR/Instruction.cpp

index c1be9da498d2f5e8c8248e2e82072367dc455555..b0bb81e9de156fc9ea1bfe9e836e74a8c9bbd42c 100644 (file)
@@ -382,8 +382,11 @@ public:
   ///
   /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
   ///
-  bool isAssociative() const;
-  static bool isAssociative(unsigned op);
+  bool isAssociative() const LLVM_READONLY;
+  static bool isAssociative(unsigned Opcode) {
+    return Opcode == And || Opcode == Or || Opcode == Xor ||
+           Opcode == Add || Opcode == Mul;
+  }
 
   /// Return true if the instruction is commutative:
   ///
index fc8a0566ab533d8242a8480c6fa4a3d2452ae74a..8674342a88ae2d96f8c26a9ea1a5b21dee64a2dd 100644 (file)
@@ -545,17 +545,6 @@ bool Instruction::mayThrow() const {
   return isa<ResumeInst>(this);
 }
 
-/// Return true if the instruction is associative:
-///
-///   Associative operators satisfy:  x op (y op z) === (x op y) op z
-///
-/// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
-///
-bool Instruction::isAssociative(unsigned Opcode) {
-  return Opcode == And || Opcode == Or || Opcode == Xor ||
-         Opcode == Add || Opcode == Mul;
-}
-
 bool Instruction::isAssociative() const {
   unsigned Opcode = getOpcode();
   if (isAssociative(Opcode))