summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-03-19 17:20:49 +0000
committerPhilip Reames <listmail@philipreames.com>2019-03-19 17:20:49 +0000
commit2153c4b8281c1e5f25887ef9183947198c50a9d2 (patch)
tree37661d78ace54e1333616815cc9f1e8571dd2fb7 /llvm/lib/CodeGen
parentae211ece6a90c367ef0cdbabad3110aba3fcda67 (diff)
downloadbcm5719-llvm-2153c4b8281c1e5f25887ef9183947198c50a9d2.tar.gz
bcm5719-llvm-2153c4b8281c1e5f25887ef9183947198c50a9d2.zip
[AtomicExpand] Fix a crash bug when lowering unordered loads to cmpxchg
Add tests for wider atomic loads and stores. In the process, fix a crasher where we appearently handled unorder stores, but not loads, when lowering to cmpxchg idioms. llvm-svn: 356482
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AtomicExpandPass.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index 10dd21d1ef9..7a8013abccf 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -430,6 +430,9 @@ bool AtomicExpand::expandAtomicLoadToLL(LoadInst *LI) {
bool AtomicExpand::expandAtomicLoadToCmpXchg(LoadInst *LI) {
IRBuilder<> Builder(LI);
AtomicOrdering Order = LI->getOrdering();
+ if (Order == AtomicOrdering::Unordered)
+ Order = AtomicOrdering::Monotonic;
+
Value *Addr = LI->getPointerOperand();
Type *Ty = cast<PointerType>(Addr->getType())->getElementType();
Constant *DummyVal = Constant::getNullValue(Ty);
OpenPOWER on IntegriCloud