[PATCH] D62775: [SelectionDAG] Skip addrspacecast expansion when casting undef values
Dylan McKay via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 1 06:59:36 PDT 2019
dylanmckay updated this revision to Diff 202550.
dylanmckay added a comment.
Remove junk comment line
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62775/new/
https://reviews.llvm.org/D62775
Files:
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/CodeGen/AVR/undef-addrspacecast.ll
Index: test/CodeGen/AVR/undef-addrspacecast.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AVR/undef-addrspacecast.ll
@@ -0,0 +1,10 @@
+; RUN: llc -mattr=avr6 < %s -march=avr | FileCheck %s
+
+; CHECK-LABEL: foo
+define void @foo() addrspace(1) {
+start:
+ %a = addrspacecast {} addrspace(1)* undef to {}*
+ store {}* %a, {}** undef, align 1
+ ret void
+}
+
Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3534,7 +3534,11 @@
unsigned SrcAS = SV->getType()->getPointerAddressSpace();
unsigned DestAS = I.getType()->getPointerAddressSpace();
- if (!TLI.isNoopAddrSpaceCast(SrcAS, DestAS))
+ // Do not insert address space conversion code when the target doesn't
+ // require it. Also skip cast expansion when casting an undefined
+ // value, as a casted undefined value is still an undefined value.
+ if (!TLI.isNoopAddrSpaceCast(SrcAS, DestAS) &&
+ !isa<UndefValue>(SV))
N = DAG.getAddrSpaceCast(getCurSDLoc(), DestVT, N, SrcAS, DestAS);
setValue(&I, N);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62775.202550.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190601/02d83313/attachment.bin>
More information about the llvm-commits
mailing list