mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-02 10:33:53 +00:00
There is no need for isAssociative to take the type as an argument anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8e4f4390bc
commit
0d7ce5ffa4
@ -200,11 +200,10 @@ public:
|
||||
///
|
||||
/// 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, when
|
||||
/// not applied to floating point types.
|
||||
/// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
|
||||
///
|
||||
bool isAssociative() const { return isAssociative(getOpcode(), getType()); }
|
||||
static bool isAssociative(unsigned op, const Type *Ty);
|
||||
bool isAssociative() const { return isAssociative(getOpcode()); }
|
||||
static bool isAssociative(unsigned op);
|
||||
|
||||
/// isCommutative - Return true if the instruction is commutative:
|
||||
///
|
||||
|
@ -1338,8 +1338,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
||||
|
||||
// Given ((a + b) + c), if (b + c) folds to something interesting, return
|
||||
// (a + (b + c)).
|
||||
if (Instruction::isAssociative(Opcode, C1->getType()) &&
|
||||
CE1->getOpcode() == Opcode) {
|
||||
if (Instruction::isAssociative(Opcode) && CE1->getOpcode() == Opcode) {
|
||||
Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2);
|
||||
if (!isa<ConstantExpr>(T) || cast<ConstantExpr>(T)->getOpcode() != Opcode)
|
||||
return ConstantExpr::get(Opcode, CE1->getOperand(0), T);
|
||||
|
@ -348,7 +348,7 @@ bool Instruction::mayThrow() const {
|
||||
///
|
||||
/// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
|
||||
///
|
||||
bool Instruction::isAssociative(unsigned Opcode, const Type *Ty) {
|
||||
bool Instruction::isAssociative(unsigned Opcode) {
|
||||
return Opcode == And || Opcode == Or || Opcode == Xor ||
|
||||
Opcode == Add || Opcode == Mul;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user