From: Philip Reames Date: Tue, 19 Mar 2019 17:20:49 +0000 (+0000) Subject: [PATCH] [AtomicExpand] Fix a crash bug when lowering unordered loads to cmpxchg X-Git-Tag: archive/raspbian/1%7.0.1-8+rpi3+deb10u2^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9c032c5c3b64b18087742a350f38e19302a3d91d;p=llvm-toolchain-7.git [PATCH] [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 Gbp-Pq: Name AtomicExpand-Fix-a-crash-bug-when-lowering-unordered-loads.patch --- diff --git a/lib/CodeGen/AtomicExpandPass.cpp b/lib/CodeGen/AtomicExpandPass.cpp index e28fc6fb9..b58490f1e 100644 --- a/lib/CodeGen/AtomicExpandPass.cpp +++ b/lib/CodeGen/AtomicExpandPass.cpp @@ -423,6 +423,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);