summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-03-26 23:23:29 +0000
committerCraig Topper <craig.topper@gmail.com>2017-03-26 23:23:29 +0000
commit224b19d626b2c8ac81499bb5c4f2d25f49d2d002 (patch)
tree464deb94b200d154b73b3b4c82aebde537c8a155
parenta2c4e4b9295357ec3bbc2f5366c3b41b5bb1b45c (diff)
downloadbcm5719-llvm-224b19d626b2c8ac81499bb5c4f2d25f49d2d002.tar.gz
bcm5719-llvm-224b19d626b2c8ac81499bb5c4f2d25f49d2d002.zip
[IR] Make Instruction::isAssociative method inline. Add LLVM_READONLY to the static version.
llvm-svn: 298826
-rw-r--r--llvm/include/llvm/IR/Instruction.h7
-rw-r--r--llvm/lib/IR/Instruction.cpp11
2 files changed, 5 insertions, 13 deletions
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index c1be9da498d..b0bb81e9de1 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -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:
///
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index fc8a0566ab5..8674342a88a 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -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))
OpenPOWER on IntegriCloud