#64 Apply upstream patch for rhbz#1862012
Merged 3 years ago by sergesanspaille. Opened 3 years ago by sergesanspaille.
rpms/ sergesanspaille/llvm f33  into  f33

@@ -0,0 +1,99 @@ 

+ From cbea17568f4301582c1d5d43990f089ca6cff522 Mon Sep 17 00:00:00 2001

+ From: Kai Luo <lkail@cn.ibm.com>

+ Date: Fri, 28 Aug 2020 01:56:12 +0000

+ Subject: [PATCH] [PowerPC] PPCBoolRetToInt: Don't translate Constant's

+  operands

+ 

+ When collecting `i1` values via `findAllDefs`, ignore Constant's

+ operands, since Constant's operands might not be `i1`.

+ 

+ Fixes https://bugs.llvm.org/show_bug.cgi?id=46923 which causes ICE

+ ```

+ llvm-project/llvm/lib/IR/Constants.cpp:1924: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&& "SrcTy must be smaller than DestTy for ZExt!"' failed.

+ ```

+ 

+ Differential Revision: https://reviews.llvm.org/D85007

+ ---

+  llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | 15 ++++++-----

+  llvm/test/CodeGen/PowerPC/pr46923.ll        | 29 +++++++++++++++++++++

+  2 files changed, 38 insertions(+), 6 deletions(-)

+  create mode 100644 llvm/test/CodeGen/PowerPC/pr46923.ll

+ 

+ diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp

+ index acc8b317a22..172f1346c50 100644

+ --- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp

+ +++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp

+ @@ -78,9 +78,9 @@ class PPCBoolRetToInt : public FunctionPass {

+        Value *Curr = WorkList.back();

+        WorkList.pop_back();

+        auto *CurrUser = dyn_cast<User>(Curr);

+ -      // Operands of CallInst are skipped because they may not be Bool type,

+ -      // and their positions are defined by ABI.

+ -      if (CurrUser && !isa<CallInst>(Curr))

+ +      // Operands of CallInst/Constant are skipped because they may not be Bool

+ +      // type. For CallInst, their positions are defined by ABI.

+ +      if (CurrUser && !isa<CallInst>(Curr) && !isa<Constant>(Curr))

+          for (auto &Op : CurrUser->operands())

+            if (Defs.insert(Op).second)

+              WorkList.push_back(Op);

+ @@ -90,6 +90,9 @@ class PPCBoolRetToInt : public FunctionPass {

+  

+    // Translate a i1 value to an equivalent i32/i64 value:

+    Value *translate(Value *V) {

+ +    assert(V->getType() == Type::getInt1Ty(V->getContext()) &&

+ +           "Expect an i1 value");

+ +

+      Type *IntTy = ST->isPPC64() ? Type::getInt64Ty(V->getContext())

+                                  : Type::getInt32Ty(V->getContext());

+  

+ @@ -252,9 +255,9 @@ class PPCBoolRetToInt : public FunctionPass {

+        auto *First = dyn_cast<User>(Pair.first);

+        auto *Second = dyn_cast<User>(Pair.second);

+        assert((!First || Second) && "translated from user to non-user!?");

+ -      // Operands of CallInst are skipped because they may not be Bool type,

+ -      // and their positions are defined by ABI.

+ -      if (First && !isa<CallInst>(First))

+ +      // Operands of CallInst/Constant are skipped because they may not be Bool

+ +      // type. For CallInst, their positions are defined by ABI.

+ +      if (First && !isa<CallInst>(First) && !isa<Constant>(First))

+          for (unsigned i = 0; i < First->getNumOperands(); ++i)

+            Second->setOperand(i, BoolToIntMap[First->getOperand(i)]);

+      }

+ diff --git a/llvm/test/CodeGen/PowerPC/pr46923.ll b/llvm/test/CodeGen/PowerPC/pr46923.ll

+ new file mode 100644

+ index 00000000000..3e9faa60422

+ --- /dev/null

+ +++ b/llvm/test/CodeGen/PowerPC/pr46923.ll

+ @@ -0,0 +1,29 @@

+ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py

+ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \

+ +; RUN:   -ppc-asm-full-reg-names < %s | FileCheck %s

+ +

+ +@bar = external constant i64, align 8

+ +

+ +define i1 @foo() {

+ +; CHECK-LABEL: foo:

+ +; CHECK:       # %bb.0: # %entry

+ +; CHECK-NEXT:    li r3, 0

+ +; CHECK-NEXT:    isel r3, 0, r3, 4*cr5+lt

+ +; CHECK-NEXT:    blr

+ +entry:

+ +  br label %next

+ +

+ +next:

+ +  br i1 undef, label %true, label %false

+ +

+ +true:

+ +  br label %end

+ +

+ +false:

+ +  br label %end

+ +

+ +end:

+ +  %a = phi i1 [ icmp ugt (i64 0, i64 ptrtoint (i64* @bar to i64)), %true ],

+ +              [ icmp ugt (i64 0, i64 2), %false ]

+ +  ret i1 %a

+ +}

+ -- 

+ 2.25.2

+ 

file modified
+1
@@ -1,5 +1,6 @@ 

  

  config.llvm_tools_dir = '/usr/bin'

+ config.llvm_src_root = '/usr/share/llvm/src'

  config.llvm_shlib_dir = '%(llvm_shlib_dir)s' % lit_config.params

  

  if hasattr(config, 'host_triple'):

file modified
+17 -5
@@ -11,7 +11,7 @@ 

  %global llvm_libdir %{_libdir}/%{name}

  %global build_llvm_libdir %{buildroot}%{llvm_libdir}

  %global rc_ver 1

- %global baserelease 0.2

+ %global baserelease 0.3

  %global llvm_srcdir llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src

  %global maj_ver 11

  %global min_ver 0
@@ -57,6 +57,7 @@ 

  %endif

  Source4:	https://prereleases.llvm.org/%{version}/hans-gpg-key.asc

  

+ Patch0:		0001-PowerPC-PPCBoolRetToInt-Don-t-translate-Constant-s-o.patch

  

  BuildRequires:	gcc

  BuildRequires:	gcc-c++
@@ -316,13 +317,20 @@ 

  cp -R utils/unittest %{install_srcdir}/utils/

  

  # Clang needs these for running lit tests.

- cp utils/update_cc_test_checks.py %{install_srcdir}/utils/

+ for f in utils/*.py; do

+ 	sed '1 s|^.*$|#!/usr/bin/env python3|' $f > %{install_srcdir}/$f

+ done

  cp -R utils/UpdateTestChecks %{install_srcdir}/utils/

  

- # Generate lit config files.  Strip off the last line that initiates the

+ 

+ # One of the lit tests references this file

+ install -d %{install_srcdir}/docs/CommandGuide/

+ install -m 0644 docs/CommandGuide/dsymutil.rst %{install_srcdir}/docs/CommandGuide/

+ 

+ # Generate lit config files.  Strip off the last lines that initiates the

  # test run, so we can customize the configuration.

- head -n -1 %{_vpath_builddir}/test/lit.site.cfg.py >> %{lit_cfg}

- head -n -1 %{_vpath_builddir}/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}

+ head -n -2 %{_vpath_builddir}/test/lit.site.cfg.py >> %{lit_cfg}

+ head -n -2 %{_vpath_builddir}/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg}

  

  # Install custom fedora config file

  cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg}
@@ -515,6 +523,7 @@ 

  %{_datadir}/llvm/src/%{_arch}.site.cfg.py

  %{_datadir}/llvm/src/%{_arch}.Unit.site.cfg.py

  %{_datadir}/llvm/lit.fedora.cfg.py

+ %{_datadir}/llvm/src/docs/CommandGuide/dsymutil.rst

  %{_bindir}/not

  %{_bindir}/count

  %{_bindir}/yaml-bench
@@ -532,6 +541,9 @@ 

  %endif

  

  %changelog

+ * Fri Sep 04 2020 sguelton@redhat.com - 11.0.0-0.3.rc1

+ - Apply upstream patch for rhbz#1862012

+ 

  * Tue Aug 11 2020 Tom Stellard <tstellar@redhat.com> - 11.0.0-0.2.rc1

  - Install update_cc_test_checks.py script

  

file modified
+1
@@ -48,6 +48,7 @@ 

  

  cd $(mktemp -d)

  ln -s /usr/include include

+ ln -s /usr/share/llvm/src/docs docs

  tar -xzf /usr/share/llvm/src/test.tar.gz

  ln -s /usr/share/llvm/src/$ARCH.site.cfg.py test/lit.site.cfg.py

  ln -s /usr/share/llvm/src/$ARCH.Unit.site.cfg.py test/Unit/lit.site.cfg.py

@@ -0,0 +1,5 @@ 

+ #!/bin/bash

+ 

+ set -ex

+ 

+ test `stat -L -c %s /usr/lib64/libLLVM.so` -lt 100000000

file modified
+1 -1
@@ -2,4 +2,4 @@ 

  

  standard-inventory-qcow2:

    qemu:

-     m: 2G

+     m: 4G

@@ -0,0 +1,16 @@ 

+ #!/bin/bash

+ 

+ set -ex

+ 

+ cmd='/usr/libexec/tests/llvm/run-lit-tests --threads 1'

+ if [ `id -u` -eq 0 ]; then

+   # lit tests can't be run as root, so we need to run as a different user

+   user='llvm-regression-tests'

+   if ! id -u $user; then

+     useradd $user

+   fi

+   su $user -c "$cmd"

+   cmd="su $user -c $cmd"

+ else

+   exec $cmd

+ fi

file modified
+2 -6
@@ -13,9 +13,7 @@ 

        - repo: "https://src.fedoraproject.org/tests/llvm.git"

          dest: "llvm"

      tests:

-       - regression-tests:

-           dir: ./

-           run: /usr/libexec/tests/llvm/run-lit-tests --threads 1

+       - regression-tests

        - rust-sanity:

            dir: ./

            run: cargo new hello && cd hello && cargo run
@@ -25,9 +23,7 @@ 

        # which breaks the nightly compose.  So this test checks that libLLVM.so

        # is less than 100MB to ensure it was successfully stripped.

        # https://bugzilla.redhat.com/show_bug.cgi?id=1793250

-       - libllvm-size:

-           dir: ./

-           run: test `stat -L -c %s /usr/lib64/libLLVM.so` -lt 100000000

+       - libllvm-size

        # This test ensures that the spec file still builds correctly with

        # %global compat_build 1

        # FIXME: This fails, because the CI system has a hard-coded timeout of 4

no initial comment

rebased onto f8c2575

3 years ago

1 new commit added

  • Fix broken CI
3 years ago

1 new commit added

  • Increase the number of threads assigned to the regression test
3 years ago

4 new commits added

  • [test] verbose output
  • Fix broken CI
  • Apply upstream patch for rhbz#1862012
  • Update lit config extraction to match 11.0.0
3 years ago

4 new commits added

  • [test] verbose output
  • Fix broken CI
  • Apply upstream patch for rhbz#1862012
  • Update lit config extraction to match 11.0.0
3 years ago

4 new commits added

  • [test] verbose output
  • Fix broken CI
  • Apply upstream patch for rhbz#1862012
  • Update lit config extraction to match 11.0.0
3 years ago

3 new commits added

  • Fix broken CI
  • Apply upstream patch for rhbz#1862012
  • Update lit config extraction to match 11.0.0
3 years ago

1 new commit added

  • More ram
3 years ago

Pull-Request has been merged by sergesanspaille

3 years ago