[PATCH] D81106: [PowerPC][NFC] Don't need to and instruction with inverse of mask.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 09:18:52 PDT 2020


sfertile created this revision.
sfertile added reviewers: stefanp, MaskRay.
sfertile added a project: PowerPC.
Herald added subscribers: shchenz, kbarton, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

The bits to be relocated should already contain all zeros, no need to and the call instructions with the inverse mask before relocating.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81106

Files:
  lld/ELF/Arch/PPC64.cpp


Index: lld/ELF/Arch/PPC64.cpp
===================================================================
--- lld/ELF/Arch/PPC64.cpp
+++ lld/ELF/Arch/PPC64.cpp
@@ -973,14 +973,14 @@
     uint32_t mask = 0x0000FFFC;
     checkInt(loc, val, 16, rel);
     checkAlignment(loc, val, 4, rel);
-    write32(loc, (read32(loc) & ~mask) | (val & mask));
+    write32(loc, read32(loc) | (val & mask));
     break;
   }
   case R_PPC64_REL24: {
     uint32_t mask = 0x03FFFFFC;
     checkInt(loc, val, 26, rel);
     checkAlignment(loc, val, 4, rel);
-    write32(loc, (read32(loc) & ~mask) | (val & mask));
+    write32(loc, read32(loc) | (val & mask));
     break;
   }
   case R_PPC64_DTPREL64:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81106.268224.patch
Type: text/x-patch
Size: 679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200603/52bfa9f2/attachment.bin>


More information about the llvm-commits mailing list