[PATCH] D156445: [BPF] Avoid repeating MI->getOperand(NumDefs) x3
Tamir Duberstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 07:56:23 PDT 2023
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf2bd78415fd8: [BPF] Avoid repeating MI->getOperand(NumDefs) x3 (authored by tamird).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156445/new/
https://reviews.llvm.org/D156445
Files:
llvm/lib/Target/BPF/BTFDebug.cpp
Index: llvm/lib/Target/BPF/BTFDebug.cpp
===================================================================
--- llvm/lib/Target/BPF/BTFDebug.cpp
+++ llvm/lib/Target/BPF/BTFDebug.cpp
@@ -17,6 +17,7 @@
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionELF.h"
@@ -1318,14 +1319,18 @@
if (MI->isInlineAsm()) {
// Count the number of register definitions to find the asm string.
unsigned NumDefs = 0;
- for (; MI->getOperand(NumDefs).isReg() && MI->getOperand(NumDefs).isDef();
- ++NumDefs)
- ;
-
- // Skip this inline asm instruction if the asmstr is empty.
- const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
- if (AsmStr[0] == 0)
- return;
+ while (true) {
+ const MachineOperand &MO = MI->getOperand(NumDefs);
+ if (MO.isReg() && MO.isDef()) {
+ ++NumDefs;
+ continue;
+ }
+ // Skip this inline asm instruction if the asmstr is empty.
+ const char *AsmStr = MO.getSymbolName();
+ if (AsmStr[0] == 0)
+ return;
+ break;
+ }
}
if (MI->getOpcode() == BPF::LD_imm64) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156445.546480.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230802/5054ef6c/attachment-0001.bin>
More information about the llvm-commits
mailing list