llvm-6502/test/CodeGen/ARM/2014-07-18-earlyclobber-str-post.ll
Tilmann Scheller 7cd0201f02 [ARM] Add earlyclobber constraint to pre/post-indexed ARM STR instructions.
The post-indexed instructions were missing the constraint, causing unpredictable STR instructions to be emitted.

The earlyclobber constraint on the pre-indexed STR instructions is not strictly necessary, as the instruction selection for pre-indexed STR instructions goes through an additional layer of pseudo instructions which have the constraint defined, however it doesn't hurt to specify the constraint directly on the pre-indexed instructions as well, since at some point someone might create instances of them programmatically and then the constraint is definitely needed.

This fixes PR20323.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213369 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 12:05:49 +00:00

14 lines
416 B
LLVM

; RUN: llc -mtriple=armv7-linux-gnueabihf %s -o - | FileCheck %s
; Check that we don't create an unpredictable STR instruction,
; e.g. str r0, [r0], #4
define i32* @earlyclobber-str-post(i32* %addr) nounwind {
; CHECK: earlyclobber-str-post
; CHECK-NOT: str r[[REG:[0-9]+]], [r[[REG]]], #4
%val = ptrtoint i32* %addr to i32
store i32 %val, i32* %addr
%new = getelementptr i32* %addr, i32 1
ret i32* %new
}