[PATCH] D69018: [AArch64] Fix offset calculation

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 22:25:31 PDT 2019


smeenai created this revision.
smeenai added reviewers: sdesmalen, greened, cameron.mcinally, efriedma, rengolin, thegameg, rovka.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls.
Herald added a project: LLVM.

r374772 changed Offset to be an int64_t but left NewOffset as an int,
which led to integer promotion issues in this calculation and resulted
in bad offset values. Promote NewOffset to int64_t as well to fix this.
This manifested as an out-of-memory when building the Swift standard
library for Android aarch64.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69018

Files:
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp


Index: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -3430,7 +3430,7 @@
          "Cannot have remainder when using unscaled op");
 
   assert(MinOff < MaxOff && "Unexpected Min/Max offsets");
-  int NewOffset = Offset / Scale;
+  int64_t NewOffset = Offset / Scale;
   if (MinOff <= NewOffset && NewOffset <= MaxOff)
     Offset = Remainder;
   else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69018.225160.patch
Type: text/x-patch
Size: 521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191016/656ce339/attachment.bin>


More information about the llvm-commits mailing list