cherry-pick fix to build rust 1.41.0

This commit is contained in:
Mikhail Novosyolov 2020-02-01 23:13:18 +03:00
parent dfa7710c87
commit 44b794ab9f
2 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,33 @@
From 2153c4b8281c1e5f25887ef9183947198c50a9d2 Mon Sep 17 00:00:00 2001
From: Philip Reames <listmail@philipreames.com>
Date: Tue, 19 Mar 2019 17:20:49 +0000
Subject: [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
################################################################
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1797127
https://github.com/rust-lang/compiler-builtins/issues/338
[ mikhailnov: backported to llvm8, removed tests ]
################################################################
---
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index 10dd21d1ef9d..7a8013abccfb 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -431,6 +431,9 @@
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);

View file

@ -27,7 +27,7 @@
Summary: Low Level Virtual Machine (LLVM)
Name: llvm
Version: %{major_ver}.%{minor_ver}
Release: 1
Release: 2
License: NCSA
Group: Development/Other
Url: http://llvm.org/
@ -46,6 +46,7 @@ Source1011: clang-gcc-wrapper.sh
#Patch1: clang-rosa.patch
#
Patch2: cfe-7.0.0-i586-unknown-linux-gnu.patch
Patch3: 2153c4b8281c1e5f25887ef9183947198c50a9d2.patch
BuildRequires: binutils-devel
BuildRequires: bison
@ -348,7 +349,7 @@ cd tools/clang
%patch2 -p1 -b .gnu~
cd -
%endif
%patch3 -p2
%build
# Build with gcc/g++, not clang if it happens to be installed