forked from OSchip/llvm-project
[IR] Make Instruction::isAssociative method inline. Add LLVM_READONLY to the static version.
llvm-svn: 298826
This commit is contained in:
parent
a2c4e4b929
commit
224b19d626
|
@ -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:
|
||||
///
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue