[PATCH] D152765: [BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch()
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 12:21:01 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c4d306a10ab: [BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch() (authored by maksfb).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152765/new/
https://reviews.llvm.org/D152765
Files:
bolt/include/bolt/Core/MCPlusBuilder.h
bolt/lib/Core/BinaryFunction.cpp
bolt/lib/Passes/Instrumentation.cpp
bolt/lib/Target/X86/X86MCPlusBuilder.cpp
Index: bolt/lib/Target/X86/X86MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/X86/X86MCPlusBuilder.cpp
+++ bolt/lib/Target/X86/X86MCPlusBuilder.cpp
@@ -318,8 +318,8 @@
return false;
}
- bool isUnsupportedBranch(unsigned Opcode) const override {
- switch (Opcode) {
+ bool isUnsupportedBranch(const MCInst &Inst) const override {
+ switch (Inst.getOpcode()) {
default:
return false;
case X86::LOOP:
@@ -1860,8 +1860,7 @@
}
// Handle conditional branches and ignore indirect branches
- if (!isUnsupportedBranch(I->getOpcode()) &&
- getCondCode(*I) == X86::COND_INVALID) {
+ if (!isUnsupportedBranch(*I) && getCondCode(*I) == X86::COND_INVALID) {
// Indirect branch
return false;
}
Index: bolt/lib/Passes/Instrumentation.cpp
===================================================================
--- bolt/lib/Passes/Instrumentation.cpp
+++ bolt/lib/Passes/Instrumentation.cpp
@@ -381,7 +381,7 @@
else if (BC.MIB->isUnconditionalBranch(Inst))
HasUnconditionalBranch = true;
else if ((!BC.MIB->isCall(Inst) && !BC.MIB->isConditionalBranch(Inst)) ||
- BC.MIB->isUnsupportedBranch(Inst.getOpcode()))
+ BC.MIB->isUnsupportedBranch(Inst))
continue;
const uint32_t FromOffset = *BC.MIB->getOffset(Inst);
Index: bolt/lib/Core/BinaryFunction.cpp
===================================================================
--- bolt/lib/Core/BinaryFunction.cpp
+++ bolt/lib/Core/BinaryFunction.cpp
@@ -1250,7 +1250,7 @@
const bool IsCondBranch = MIB->isConditionalBranch(Instruction);
MCSymbol *TargetSymbol = nullptr;
- if (BC.MIB->isUnsupportedBranch(Instruction.getOpcode())) {
+ if (BC.MIB->isUnsupportedBranch(Instruction)) {
setIgnored();
if (BinaryFunction *TargetFunc =
BC.getBinaryFunctionContainingAddress(TargetAddress))
@@ -3262,8 +3262,7 @@
const BinaryBasicBlock *TSuccessor = BB->getConditionalSuccessor(true);
const BinaryBasicBlock *FSuccessor = BB->getConditionalSuccessor(false);
// Check whether we support reversing this branch direction
- const bool IsSupported =
- !MIB->isUnsupportedBranch(CondBranch->getOpcode());
+ const bool IsSupported = !MIB->isUnsupportedBranch(*CondBranch);
if (NextBB && NextBB == TSuccessor && IsSupported) {
std::swap(TSuccessor, FSuccessor);
{
Index: bolt/include/bolt/Core/MCPlusBuilder.h
===================================================================
--- bolt/include/bolt/Core/MCPlusBuilder.h
+++ bolt/include/bolt/Core/MCPlusBuilder.h
@@ -434,7 +434,7 @@
}
/// Check whether we support inverting this branch
- virtual bool isUnsupportedBranch(unsigned Opcode) const { return false; }
+ virtual bool isUnsupportedBranch(const MCInst &Inst) const { return false; }
/// Return true of the instruction is of pseudo kind.
bool isPseudo(const MCInst &Inst) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152765.531028.patch
Type: text/x-patch
Size: 3076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/5f7916e0/attachment.bin>
More information about the llvm-commits
mailing list