[llvm] [BOLT][AArch64] Exclude JT pattern matching under assert failure (PR #122298)
Pavel Iliin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 01:10:59 PST 2025
================
@@ -753,45 +809,77 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
// Match ADD that calculates the JumpTable Base Address (not the offset)
SmallVector<MCInst *, 4> &UsesLoad = UDChain[DefLoad];
- const MCInst *DefJTBaseAdd = UsesLoad[1];
+ const MCInst *DefJTPageBias = UsesLoad[1];
MCPhysReg From, To;
- if (DefJTBaseAdd == nullptr || isLoadFromStack(*DefJTBaseAdd) ||
- isRegToRegMove(*DefJTBaseAdd, From, To)) {
+ JumpTable = nullptr;
+ if (DefJTPageBias == nullptr || isLoadFromStack(*DefJTPageBias) ||
+ isRegToRegMove(*DefJTPageBias, From, To)) {
// Sometimes base address may have been defined in another basic block
// (hoisted). Return with no jump table info.
- JumpTable = nullptr;
return true;
}
- if (DefJTBaseAdd->getOpcode() == AArch64::ADR) {
+ if (isAddXri(*DefJTPageBias)) {
+ if (DefJTPageBias->getOperand(2).isImm())
+ Offset = DefJTPageBias->getOperand(2).getImm();
+ SmallVector<MCInst *, 4> &UsesJTBaseAdd = UDChain[DefJTPageBias];
+ const MCInst *DefJTBasePage = UsesJTBaseAdd[1];
+ if (DefJTBasePage == nullptr || isLoadFromStack(*DefJTBasePage)) {
+ return true;
+ }
+ assert(DefJTBasePage->getOpcode() == AArch64::ADRP &&
----------------
ilinpv wrote:
Assertions was removed by https://github.com/llvm/llvm-project/pull/124372
https://github.com/llvm/llvm-project/pull/122298
More information about the llvm-commits
mailing list