BOLT: Replace MCTargetExpr with MCSpecifierExpr to fix bolt-icf.test on aarch64 host
This commit is contained in:
@@ -405,7 +405,7 @@ public:
|
||||
|
||||
bool equals(const MCExpr &A, const MCExpr &B, CompFuncTy Comp) const;
|
||||
|
||||
virtual bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
|
||||
virtual bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
|
||||
CompFuncTy Comp) const;
|
||||
|
||||
virtual bool isBranch(const MCInst &Inst) const {
|
||||
|
||||
@@ -67,6 +67,7 @@ std::string hashExpr(BinaryContext &BC, const MCExpr &Expr) {
|
||||
.append(hashInteger(BinaryExpr.getOpcode()))
|
||||
.append(hashExpr(BC, *BinaryExpr.getRHS()));
|
||||
}
|
||||
case MCExpr::Specifier:
|
||||
case MCExpr::Target:
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -114,17 +114,19 @@ bool MCPlusBuilder::equals(const MCExpr &A, const MCExpr &B,
|
||||
equals(*BinaryA.getRHS(), *BinaryB.getRHS(), Comp);
|
||||
}
|
||||
|
||||
case MCExpr::Target: {
|
||||
const auto &TargetExprA = cast<MCTargetExpr>(A);
|
||||
const auto &TargetExprB = cast<MCTargetExpr>(B);
|
||||
case MCExpr::Specifier: {
|
||||
const auto &TargetExprA = cast<MCSpecifierExpr>(A);
|
||||
const auto &TargetExprB = cast<MCSpecifierExpr>(B);
|
||||
return equals(TargetExprA, TargetExprB, Comp);
|
||||
}
|
||||
case MCExpr::Target:
|
||||
llvm_unreachable("Not implemented");
|
||||
}
|
||||
|
||||
llvm_unreachable("Invalid expression kind!");
|
||||
}
|
||||
|
||||
bool MCPlusBuilder::equals(const MCTargetExpr &A, const MCTargetExpr &B,
|
||||
bool MCPlusBuilder::equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
|
||||
CompFuncTy Comp) const {
|
||||
llvm_unreachable("target-specific expressions are unsupported");
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
|
||||
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
|
||||
CompFuncTy Comp) const override {
|
||||
const auto &AArch64ExprA = cast<AArch64MCExpr>(A);
|
||||
const auto &AArch64ExprB = cast<AArch64MCExpr>(B);
|
||||
|
||||
@@ -31,7 +31,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
|
||||
public:
|
||||
using MCPlusBuilder::MCPlusBuilder;
|
||||
|
||||
bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
|
||||
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
|
||||
CompFuncTy Comp) const override {
|
||||
const auto &RISCVExprA = cast<RISCVMCExpr>(A);
|
||||
const auto &RISCVExprB = cast<RISCVMCExpr>(B);
|
||||
|
||||
Reference in New Issue
Block a user