From 2153c4b8281c1e5f25887ef9183947198c50a9d2 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 19 Mar 2019 17:20:49 +0000 Subject: [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 --- llvm/lib/CodeGen/AtomicExpandPass.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/CodeGen') 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(Addr->getType())->getElementType(); Constant *DummyVal = Constant::getNullValue(Ty); -- cgit v1.2.3