[PATCH] D61721: SelectionDAG: accommodate atomic floating stores
Tim Northover via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 02:45:30 PDT 2019
t.p.northover created this revision.
t.p.northover added a reviewer: sanjoy.
Herald added subscribers: jfb, hiraditya, mcrosier, jholewinski.
Herald added a project: LLVM.
We were applying a pointer truncation to floating types after r359676, which crashed LLVM. That is Not A Good Thing(TM).
Repository:
rL LLVM
https://reviews.llvm.org/D61721
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/NVPTX/load-store.ll
Index: llvm/test/CodeGen/NVPTX/load-store.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/load-store.ll
+++ llvm/test/CodeGen/NVPTX/load-store.ll
@@ -59,7 +59,7 @@
}
; CHECK-LABEL: monotonic
-define void @monotonic(i8* %a, i16* %b, i32* %c, i64* %d) local_unnamed_addr {
+define void @monotonic(i8* %a, i16* %b, i32* %c, i64* %d, float* %e) local_unnamed_addr {
; CHECK: ld.volatile.u8 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
%a.load = load atomic i8, i8* %a monotonic, align 1
%a.add = add i8 %a.load, 1
@@ -84,5 +84,11 @@
; CHECK: st.volatile.u64 [%rd{{[0-9]+}}], %rd{{[0-9]+}}
store atomic i64 %d.add, i64* %d monotonic, align 8
+ ; CHECK: ld.volatile.f32 %f{{[0-9]+}}, [%rd{{[0-9]+}}]
+ %e.load = load atomic float, float* %e monotonic, align 4
+ %e.add = fadd float %e.load, 1.0
+ ; CHECK: st.volatile.f32 [%rd{{[0-9]+}}], %f{{[0-9]+}}
+ store atomic float %e.add, float* %e monotonic, align 4
+
ret void
}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4717,7 +4717,10 @@
MemVT.getStoreSize(), I.getAlignment(), AAMDNodes(),
nullptr, SSID, Ordering);
- SDValue Val = DAG.getPtrExtOrTrunc(getValue(I.getValueOperand()), dl, MemVT);
+ SDValue Val = getValue(I.getValueOperand());
+ if (Val.getValueType() != MemVT)
+ Val = DAG.getPtrExtOrTrunc(Val, dl, MemVT);
+
SDValue OutChain = DAG.getAtomic(ISD::ATOMIC_STORE, dl, MemVT, InChain,
getValue(I.getPointerOperand()), Val, MMO);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61721.198777.patch
Type: text/x-patch
Size: 1764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/992f3385/attachment.bin>
More information about the llvm-commits
mailing list