summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-09-13 20:50:54 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-09-13 20:50:54 +0000
commitf1518216fd3d524f5bbdab55c62fd216b4be55b5 (patch)
tree5c2dc04b13bb4fffaca63f0c3a5de2937c816837 /llvm/lib
parent5be3e6ae9d6e8d5e35033bc4dd42d75c8e44b3de (diff)
downloadbcm5719-llvm-f1518216fd3d524f5bbdab55c62fd216b4be55b5.tar.gz
bcm5719-llvm-f1518216fd3d524f5bbdab55c62fd216b4be55b5.zip
Error out on CodeGen of unaligned load/store. Fix test so it isn't accidentally testing that case.
llvm-svn: 139641
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index e0c0fc255cc..4c58fe92266 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3402,6 +3402,9 @@ void SelectionDAGBuilder::visitAtomicLoad(const LoadInst &I) {
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 @@ void SelectionDAGBuilder::visitAtomicStore(const StoreInst &I) {
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()),
OpenPOWER on IntegriCloud