llvmbot wrote:
@llvm/pr-subscribers-bolt
Author: Amir Ayupov (aaupov)
Changes
Simplify mutually exclusive sanity checks in analyzeIndirectBranch,
where an UNKNOWN IndirectBranchType is to be returned. Reduces confusion
and code duplication when adding a new IndirectBranchType (to be added
in a follow-up diff).
Test Plan: NFC
---
Full diff: https://github.com/llvm/llvm-project/pull/91662.diff
1 Files Affected:
- (modified) bolt/lib/Target/X86/X86MCPlusBuilder.cpp (+9-7)
``diff
diff --git a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp
b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp
index e7cabdabce90..86e7d4dfaed8 100644
--- a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp
+++ b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp
@@ -2115,13 +2115,15 @@ class X86MCPlusBuilder : public MCPlusBuilder {
return IndirectBranchType::POSSIBLE_FIXED_BRANCH;
}
-if (Type == IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE &&
-(MO->ScaleImm != 1 || MO->BaseRegNum != RIPRegister))
- return IndirectBranchType::UNKNOWN;
-
-if (Type != IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE &&
-MO->ScaleImm != PtrSize)
- return IndirectBranchType::UNKNOWN;
+switch (Type) {
+case IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE:
+ if (MO->ScaleImm != 1 || MO->BaseRegNum != RIPRegister)
+return IndirectBranchType::UNKNOWN;
+ break;
+default:
+ if (MO->ScaleImm != PtrSize)
+return IndirectBranchType::UNKNOWN;
+}
MemLocInstrOut = MemLocInstr;
``
https://github.com/llvm/llvm-project/pull/91662
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits