[llvm-commits] [llvm] r139641 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/atomic-load-store-wide.ll
Eli Friedman
eli.friedman at gmail.com
Tue Sep 13 13:50:55 PDT 2011
Author: efriedma
Date: Tue Sep 13 15:50:54 2011
New Revision: 139641
URL: http://llvm.org/viewvc/llvm-project?rev=139641&view=rev
Log:
Error out on CodeGen of unaligned load/store. Fix test so it isn't accidentally testing that case.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/test/CodeGen/X86/atomic-load-store-wide.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=139641&r1=139640&r2=139641&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Sep 13 15:50:54 2011
@@ -3402,6 +3402,9 @@
EVT VT = EVT::getEVT(I.getType());
+ if (I.getAlignment() * 8 != VT.getSizeInBits())
+ report_fatal_error("Cannot generate unaligned atomic load");
+
SDValue L =
DAG.getAtomic(ISD::ATOMIC_LOAD, dl, VT, VT, InChain,
getValue(I.getPointerOperand()),
@@ -3427,13 +3430,17 @@
SDValue InChain = getRoot();
+ EVT VT = EVT::getEVT(I.getValueOperand()->getType());
+
+ if (I.getAlignment() * 8 != VT.getSizeInBits())
+ report_fatal_error("Cannot generate unaligned atomic store");
+
if (TLI.getInsertFencesForAtomic())
InChain = InsertFenceForAtomic(InChain, Order, Scope, true, dl,
DAG, TLI);
SDValue OutChain =
- DAG.getAtomic(ISD::ATOMIC_STORE, dl,
- getValue(I.getValueOperand()).getValueType().getSimpleVT(),
+ DAG.getAtomic(ISD::ATOMIC_STORE, dl, VT,
InChain,
getValue(I.getPointerOperand()),
getValue(I.getValueOperand()),
Modified: llvm/trunk/test/CodeGen/X86/atomic-load-store-wide.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/atomic-load-store-wide.ll?rev=139641&r1=139640&r2=139641&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/atomic-load-store-wide.ll (original)
+++ llvm/trunk/test/CodeGen/X86/atomic-load-store-wide.ll Tue Sep 13 15:50:54 2011
@@ -7,13 +7,13 @@
; CHECK: test1
; CHECK: cmpxchg8b
; CHECK-NEXT: jne
- store atomic i64 %val1, i64* %ptr seq_cst, align 4
+ store atomic i64 %val1, i64* %ptr seq_cst, align 8
ret void
}
define i64 @test2(i64* %ptr) {
; CHECK: test2
; CHECK: cmpxchg8b
- %val = load atomic i64* %ptr seq_cst, align 4
+ %val = load atomic i64* %ptr seq_cst, align 8
ret i64 %val
}
More information about the llvm-commits
mailing list