[PATCH] D147761: [AVR] Disable post increment load from program memory space
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 20:47:11 PDT 2023
benshi001 created this revision.
benshi001 added a reviewer: aykevl.
Herald added subscribers: Jim, hiraditya, dylanmckay.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Herald added a project: LLVM.
We temporarily only allow post increment load/store from/to data memory,
and disable post increment load from program memory.
Updates https://github.com/llvm/llvm-project/issues/59914
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147761
Files:
llvm/lib/Target/AVR/AVRISelLowering.cpp
llvm/test/CodeGen/AVR/load.ll
Index: llvm/test/CodeGen/AVR/load.ll
===================================================================
--- llvm/test/CodeGen/AVR/load.ll
+++ llvm/test/CodeGen/AVR/load.ll
@@ -140,3 +140,18 @@
%r.0.lcssa = phi i16 [ 0, %entry ], [ %add, %while.body ]
ret i16 %r.0.lcssa
}
+
+define ptr addrspace(1) @load16_postinc_progmem(ptr addrspace(1) readonly %0) {
+; CHECK-LABEL: load16_postinc_progmem:
+; CHECK: movw r30, [[REG0:r[0-9]+]]
+; CHECK: lpm [[REG1:r[0-9]+]], Z+
+; CHECK: lpm [[REG1:r[0-9]+]], Z
+; CHECK: call foo
+; CHECK: adiw [[REG0:r[0-9]+]], 2
+ %2 = load i16, ptr addrspace(1) %0, align 1
+ tail call addrspace(1) void @foo(i16 %2)
+ %3 = getelementptr inbounds i16, ptr addrspace(1) %0, i16 1
+ ret ptr addrspace(1) %3
+}
+
+declare void @foo(i16)
Index: llvm/lib/Target/AVR/AVRISelLowering.cpp
===================================================================
--- llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ llvm/lib/Target/AVR/AVRISelLowering.cpp
@@ -1151,6 +1151,12 @@
return false;
}
+ // FIXME: We temporarily disable post-increment load from program memory,
+ // due to bug https://github.com/llvm/llvm-project/issues/59914.
+ if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(N))
+ if (AVR::isProgramMemoryAccess(LD))
+ return false;
+
Base = Op->getOperand(0);
Offset = DAG.getConstant(RHSC, DL, MVT::i8);
AM = ISD::POST_INC;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147761.511601.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230407/2e1c7c74/attachment.bin>
More information about the llvm-commits
mailing list