diff options
author | Dylan McKay <me@dylanmckay.io> | 2019-01-20 03:41:08 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2019-01-20 03:41:08 +0000 |
commit | 6afef286d92eb37798928d01bfe6139f005e5c38 (patch) | |
tree | 89280f554f8286967baa5b339dc391027778657f /llvm/test/CodeGen/AVR/load.ll | |
parent | 52846ab09a02280f8e79aa56bac557ae36255e5d (diff) | |
download | bcm5719-llvm-6afef286d92eb37798928d01bfe6139f005e5c38.tar.gz bcm5719-llvm-6afef286d92eb37798928d01bfe6139f005e5c38.zip |
[AVR] Fix codegen bug in 16-bit loads
Prior to this patch, the AVR::LDWRdPtr instruction was always lowered to
instructions of this pattern:
ld $GPR8, [PTR:XYZ]+
ld $GPR8, [PTR]+1
This has a problem; the [PTR] is incremented in-place once, but never
decremented.
Future uses of the same pointer will use the now clobbered value,
leading to the pointer being incorrect by an offset of one.
This patch modifies the expansion code of the LDWRdPtr pseudo
instruction so that the pointer variable is not silently clobbered in
future uses in the same live range.
Bug first reported by Keshav Kini.
Patch by Kaushik Phatak.
llvm-svn: 351673
Diffstat (limited to 'llvm/test/CodeGen/AVR/load.ll')
-rw-r--r-- | llvm/test/CodeGen/AVR/load.ll | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/AVR/load.ll b/llvm/test/CodeGen/AVR/load.ll index 73568b54096..f58edeb425a 100644 --- a/llvm/test/CodeGen/AVR/load.ll +++ b/llvm/test/CodeGen/AVR/load.ll @@ -9,8 +9,8 @@ define i8 @load8(i8* %x) { define i16 @load16(i16* %x) { ; CHECK-LABEL: load16: -; CHECK: ld r24, {{[XYZ]}}+ -; CHECK: ld r25, {{[XYZ]}} +; CHECK: ld r24, [[PTR:[XYZ]]] +; CHECK: ldd r25, [[PTR]]+1 %1 = load i16, i16* %x ret i16 %1 } @@ -36,8 +36,8 @@ define i8 @load8nodisp(i8* %x) { define i16 @load16disp(i16* %x) { ; CHECK-LABEL: load16disp: -; CHECK: ldd r24, {{[YZ]}}+62 -; CHECK: ldd r25, {{[YZ]}}+63 +; CHECK: ldd r24, [[PTR:[YZ]]]+62 +; CHECK: ldd r25, [[PTR]]+63 %1 = getelementptr inbounds i16, i16* %x, i64 31 %2 = load i16, i16* %1 ret i16 %2 @@ -48,8 +48,8 @@ define i16 @load16nodisp(i16* %x) { ; CHECK: movw r26, r24 ; CHECK: subi r26, 192 ; CHECK: sbci r27, 255 -; CHECK: ld r24, {{[XYZ]}}+ -; CHECK: ld r25, {{[XYZ]}} +; CHECK: ld r24, [[PTR:[XYZ]]] +; CHECK: ldd r25, [[PTR]]+1 %1 = getelementptr inbounds i16, i16* %x, i64 32 %2 = load i16, i16* %1 ret i16 %2 |