[PATCH] D51678: ARM: fix Thumb2 CodeGen for ldrex with folded frame-index

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 03:44:39 PDT 2018


t.p.northover created this revision.
t.p.northover added a reviewer: eli.friedman.
Herald added subscribers: chrib, hiraditya, kristof.beyls, mcrosier.
Herald added a reviewer: javed.absar.

As reported in https://llvm.org/PR38828, Thumb2 ldrex instructions accessing local variables are not being handled correctly. In release builds this results in bad code, in debug builds an assertion.

The issue is that the t2LDREX and t2STREX instructions are marked with `AddrModeNone`, but rewriteT2FrameIndex relies on knowing the addressing-mode so that it can fold a stack offset into the instruction. This patch adds a new addressing-mode to handle the situation and applies it to the relevant instructions.

Neither the byte/half/dword forms, nor any ARM variant is affected because they do not allow an offset to the base register.


Repository:
  rL LLVM

https://reviews.llvm.org/D51678

Files:
  llvm/lib/Target/ARM/ARMInstrFormats.td
  llvm/lib/Target/ARM/ARMInstrThumb2.td
  llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
  llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
  llvm/test/CodeGen/ARM/ldstrex.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51678.164005.patch
Type: text/x-patch
Size: 6464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180905/7d7ce33b/attachment.bin>


More information about the llvm-commits mailing list