Skip to content

Commit cdd0a6c

Browse files
committed
BOLT: Replace MCTargetExpr with MCSpecifierExpr to fix bolt-icf.test on aarch64 host
1 parent 4a6b4d3 commit cdd0a6c

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ class MCPlusBuilder {
405405

406406
bool equals(const MCExpr &A, const MCExpr &B, CompFuncTy Comp) const;
407407

408-
virtual bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
408+
virtual bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
409409
CompFuncTy Comp) const;
410410

411411
virtual bool isBranch(const MCInst &Inst) const {

bolt/lib/Core/HashUtilities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ std::string hashExpr(BinaryContext &BC, const MCExpr &Expr) {
6767
.append(hashInteger(BinaryExpr.getOpcode()))
6868
.append(hashExpr(BC, *BinaryExpr.getRHS()));
6969
}
70+
case MCExpr::Specifier:
7071
case MCExpr::Target:
7172
return std::string();
7273
}

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,19 @@ bool MCPlusBuilder::equals(const MCExpr &A, const MCExpr &B,
114114
equals(*BinaryA.getRHS(), *BinaryB.getRHS(), Comp);
115115
}
116116

117-
case MCExpr::Target: {
118-
const auto &TargetExprA = cast<MCTargetExpr>(A);
119-
const auto &TargetExprB = cast<MCTargetExpr>(B);
117+
case MCExpr::Specifier: {
118+
const auto &TargetExprA = cast<MCSpecifierExpr>(A);
119+
const auto &TargetExprB = cast<MCSpecifierExpr>(B);
120120
return equals(TargetExprA, TargetExprB, Comp);
121121
}
122+
case MCExpr::Target:
123+
llvm_unreachable("Not implemented");
122124
}
123125

124126
llvm_unreachable("Invalid expression kind!");
125127
}
126128

127-
bool MCPlusBuilder::equals(const MCTargetExpr &A, const MCTargetExpr &B,
129+
bool MCPlusBuilder::equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
128130
CompFuncTy Comp) const {
129131
llvm_unreachable("target-specific expressions are unsupported");
130132
}

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
177177
return true;
178178
}
179179

180-
bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
180+
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
181181
CompFuncTy Comp) const override {
182182
const auto &AArch64ExprA = cast<AArch64MCExpr>(A);
183183
const auto &AArch64ExprB = cast<AArch64MCExpr>(B);

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
3131
public:
3232
using MCPlusBuilder::MCPlusBuilder;
3333

34-
bool equals(const MCTargetExpr &A, const MCTargetExpr &B,
34+
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
3535
CompFuncTy Comp) const override {
3636
const auto &RISCVExprA = cast<RISCVMCExpr>(A);
3737
const auto &RISCVExprB = cast<RISCVMCExpr>(B);

0 commit comments

Comments
 (0)