1; RUN: llc -mtriple=armv7-linux-gnueabihf %s -o - | FileCheck %s 2 3; Check that we don't create an unpredictable STR instruction, 4; e.g. str r0, [r0], #4 5 6define ptr @earlyclobber-str-post(ptr %addr) nounwind { 7; CHECK-LABEL: earlyclobber-str-post 8; CHECK-NOT: str r[[REG:[0-9]+]], [r[[REG]]], #4 9 %val = ptrtoint ptr %addr to i32 10 store i32 %val, ptr %addr 11 %new = getelementptr i32, ptr %addr, i32 1 12 ret ptr %new 13} 14 15define ptr @earlyclobber-strh-post(ptr %addr) nounwind { 16; CHECK-LABEL: earlyclobber-strh-post 17; CHECK-NOT: strh r[[REG:[0-9]+]], [r[[REG]]], #2 18 %val = ptrtoint ptr %addr to i32 19 %tr = trunc i32 %val to i16 20 store i16 %tr, ptr %addr 21 %new = getelementptr i16, ptr %addr, i32 1 22 ret ptr %new 23} 24 25define ptr @earlyclobber-strb-post(ptr %addr) nounwind { 26; CHECK-LABEL: earlyclobber-strb-post 27; CHECK-NOT: strb r[[REG:[0-9]+]], [r[[REG]]], #1 28 %val = ptrtoint ptr %addr to i32 29 %tr = trunc i32 %val to i8 30 store i8 %tr, ptr %addr 31 %new = getelementptr i8, ptr %addr, i32 1 32 ret ptr %new 33} 34