devel/llvm: Fix a crash bug when lowering unordered loads to cmpxchg

backport of 2153c4b828

needs for upcoming lang/rust 1.41.0 which trigger the bug on i386

ok jca@
This commit is contained in:
semarie 2020-02-09 06:14:21 +00:00
parent 55f6d1d4e8
commit 07b38a5196
2 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.240 2020/01/07 22:59:43 jca Exp $
# $OpenBSD: Makefile,v 1.241 2020/02/09 06:14:21 semarie Exp $
# XXX If broken on an architecture, remove the arch from LLVM_ARCHS.
ONLY_FOR_ARCHS = ${LLVM_ARCHS}
@ -18,7 +18,7 @@ PKGSPEC-main = llvm-=${LLVM_V}
PKGNAME-main = llvm-${LLVM_V}
PKGNAME-python = py-llvm-${LLVM_V}
PKGNAME-lldb = lldb-${LLVM_V}
REVISION-main = 5
REVISION-main = 6
REVISION-lldb= 0
CATEGORIES = devel

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-lib_CodeGen_AtomicExpandPass_cpp,v 1.1 2020/02/09 06:14:21 semarie Exp $
Fix a crash bug when lowering unordered loads to cmpxchg
https://github.com/llvm/llvm-project/commit/2153c4b8281c1e5f25887ef9183947198c50a9d2
Index: lib/CodeGen/AtomicExpandPass.cpp
--- lib/CodeGen/AtomicExpandPass.cpp.orig
+++ lib/CodeGen/AtomicExpandPass.cpp
@@ -431,6 +431,8 @@ 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);