[PATCH] D87985: fix bug when adrp_imm < 0

陈俊 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 20 18:56:40 PDT 2020


JuunChen updated this revision to Diff 293048.
JuunChen added a comment.

Reformat Code


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87985/new/

https://reviews.llvm.org/D87985

Files:
  llvm/tools/llvm-objdump/MachODump.cpp


Index: llvm/tools/llvm-objdump/MachODump.cpp
===================================================================
--- llvm/tools/llvm-objdump/MachODump.cpp
+++ llvm/tools/llvm-objdump/MachODump.cpp
@@ -7083,8 +7083,8 @@
 
     adrp_imm =
         ((info->adrp_inst & 0x00ffffe0) >> 3) | ((info->adrp_inst >> 29) & 0x3);
-    if (info->adrp_inst & 0x0200000)
-      adrp_imm |= 0xfffffffffc000000LL;
+    if (adrp_imm & (1 << (21 - 1)))
+      adrp_imm |= ~((1LL << 21) - 1);
 
     addxri_inst = ReferenceValue;
     addxri_imm = (addxri_inst >> 10) & 0xfff;
@@ -7113,8 +7113,8 @@
 
     adrp_imm =
         ((info->adrp_inst & 0x00ffffe0) >> 3) | ((info->adrp_inst >> 29) & 0x3);
-    if (info->adrp_inst & 0x0200000)
-      adrp_imm |= 0xfffffffffc000000LL;
+    if (adrp_imm & (1 << (21 - 1)))
+      adrp_imm |= ~((1LL << 21) - 1);
 
     ldrxui_inst = ReferenceValue;
     ldrxui_imm = (ldrxui_inst >> 10) & 0xfff;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87985.293048.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200921/28830ab0/attachment-0001.bin>


More information about the llvm-commits mailing list