From 8d148401cba6a45e948aa26656b73714bd777b5f Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 8 Oct 2024 20:07:55 +0200 Subject: [PATCH] aco/ir: rework Operand equality to return true for equal fixed non-temp ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_ir.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 9fe200f5977..7542c1e0db1 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -850,20 +850,23 @@ public: constexpr bool operator==(Operand other) const noexcept { - if (other.size() != size()) + if (other.bytes() != bytes()) return false; if (isFixed() != other.isFixed() || isKillBeforeDef() != other.isKillBeforeDef()) return false; - if (isFixed() && other.isFixed() && physReg() != other.physReg()) + if (isFixed() && physReg() != other.physReg()) return false; - if (isLiteral()) - return other.isLiteral() && other.constantValue() == constantValue(); - else if (isConstant()) - return other.isConstant() && other.physReg() == physReg(); + if (hasRegClass() && (!other.hasRegClass() || other.regClass() != regClass())) + return false; + + if (isConstant()) + return other.isConstant() && other.constantValue64() == constantValue64(); else if (isUndefined()) - return other.isUndefined() && other.regClass() == regClass(); - else + return other.isUndefined(); + else if (isTemp()) return other.isTemp() && other.getTemp() == getTemp(); + else + return true; } constexpr bool operator!=(Operand other) const noexcept { return !operator==(other); }