Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2019 16:16:31 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r489257 - in branches/2019Q1/devel/llvm70: . files files/clang
Message-ID:  <201901041616.x04GGVlh001182@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Fri Jan  4 16:16:31 2019
New Revision: 489257
URL: https://svnweb.freebsd.org/changeset/ports/489257

Log:
  MFH: r489195 (reliability fix blanket)
  
  Backport two Objective-C bug fixes (D18672)
  
  Add patches for head rS342592 and rS342593 (D18691)
  
  Add patch files for head rS342592 and rS342593, which correspond to the
  following upstream revisions:
  
  https://reviews.llvm.org/rL342397
  https://reviews.llvm.org/rL342397
  
  These fix an 'Assertion failed: ((VT.getVectorNumElements() +
  N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
  "Extract subvector overflow!"), function getNode' when building the
  multimedia/aom port (with AVX2 enabled).
  
  PR:		234480
  Submitted by:	theraven, dim
  Differential Revision:	https://reviews.freebsd.org/D18672
  Differential Revision:	https://reviews.freebsd.org/D18691
  Approved by:	ports-secteam (reliability fix blanket)

Added:
  branches/2019Q1/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp
     - copied unchanged from r489195, head/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp
  branches/2019Q1/devel/llvm70/files/patch-head-r342592.diff
     - copied unchanged from r489195, head/devel/llvm70/files/patch-head-r342592.diff
  branches/2019Q1/devel/llvm70/files/patch-head-r342593.diff
     - copied unchanged from r489195, head/devel/llvm70/files/patch-head-r342593.diff
Modified:
  branches/2019Q1/devel/llvm70/Makefile
Directory Properties:
  branches/2019Q1/   (props changed)

Modified: branches/2019Q1/devel/llvm70/Makefile
==============================================================================
--- branches/2019Q1/devel/llvm70/Makefile	Fri Jan  4 15:15:04 2019	(r489256)
+++ branches/2019Q1/devel/llvm70/Makefile	Fri Jan  4 16:16:31 2019	(r489257)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	7.0.1
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 MASTER_SITES=	http://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
 PKGNAMESUFFIX=	${LLVM_SUFFIX}

Copied: branches/2019Q1/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp (from r489195, head/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2019Q1/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp	Fri Jan  4 16:16:31 2019	(r489257, copy of r489195, head/devel/llvm70/files/clang/patch-tools_clang_lib_CodeGen_CGObjCGNU.cpp)
@@ -0,0 +1,72 @@
+--- tools/clang/lib/CodeGen/CGObjCGNU.cpp.orig	2018-12-28 16:37:45 UTC
++++ tools/clang/lib/CodeGen/CGObjCGNU.cpp
+@@ -277,6 +277,8 @@ protected:
+     Fields.addInt(Int8Ty, 0);
+   }
+ 
++  virtual llvm::Constant *GenerateCategoryProtocolList(const
++      ObjCCategoryDecl *OCD);
+   virtual ConstantArrayBuilder PushPropertyListHeader(ConstantStructBuilder &Fields,
+       int count) {
+       // int count;
+@@ -1164,6 +1166,15 @@ class CGObjCGNUstep2 : public CGObjCGNUs
+     return MethodList.finishAndCreateGlobal(".objc_protocol_method_list",
+                                             CGM.getPointerAlign());
+   }
++  llvm::Constant *GenerateCategoryProtocolList(const ObjCCategoryDecl *OCD)
++    override {
++    SmallVector<llvm::Constant*, 16> Protocols;
++    for (const auto *PI : OCD->getReferencedProtocols())
++      Protocols.push_back(
++          llvm::ConstantExpr::getBitCast(GenerateProtocolRef(PI),
++            ProtocolPtrTy));
++    return GenerateProtocolList(Protocols);
++  }
+ 
+   llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, Address ObjCSuper,
+                               llvm::Value *cmd, MessageSendInfo &MSI) override {
+@@ -1547,7 +1558,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
+             sectionName<CategorySection>());
+       if (!EmittedClass) {
+         createNullGlobal(".objc_null_cls_init_ref", NULLPtr,
+-            sectionName<ClassReferenceSection>());
++            sectionName<ClassSection>());
+         createNullGlobal(".objc_null_class_ref", { NULLPtr, NULLPtr },
+             sectionName<ClassReferenceSection>());
+       }
+@@ -3099,18 +3110,21 @@ llvm::Constant *CGObjCGNU::MakeBitField(
+   return ptr;
+ }
+ 
++llvm::Constant *CGObjCGNU::GenerateCategoryProtocolList(const
++    ObjCCategoryDecl *OCD) {
++  SmallVector<std::string, 16> Protocols;
++  for (const auto *PD : OCD->getReferencedProtocols())
++    Protocols.push_back(PD->getNameAsString());
++  return GenerateProtocolList(Protocols);
++}
++
+ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
+   const ObjCInterfaceDecl *Class = OCD->getClassInterface();
+   std::string ClassName = Class->getNameAsString();
+   std::string CategoryName = OCD->getNameAsString();
+ 
+   // Collect the names of referenced protocols
+-  SmallVector<std::string, 16> Protocols;
+   const ObjCCategoryDecl *CatDecl = OCD->getCategoryDecl();
+-  const ObjCList<ObjCProtocolDecl> &Protos = CatDecl->getReferencedProtocols();
+-  for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(),
+-       E = Protos.end(); I != E; ++I)
+-    Protocols.push_back((*I)->getNameAsString());
+ 
+   ConstantInitBuilder Builder(CGM);
+   auto Elements = Builder.beginStruct();
+@@ -3132,7 +3146,7 @@ void CGObjCGNU::GenerateCategory(const O
+           GenerateMethodList(ClassName, CategoryName, ClassMethods, true),
+           PtrTy);
+   // Protocol list
+-  Elements.addBitCast(GenerateProtocolList(Protocols), PtrTy);
++  Elements.addBitCast(GenerateCategoryProtocolList(CatDecl), PtrTy);
+   if (isRuntime(ObjCRuntime::GNUstep, 2)) {
+     const ObjCCategoryDecl *Category =
+       Class->FindCategoryDeclaration(OCD->getIdentifier());

Copied: branches/2019Q1/devel/llvm70/files/patch-head-r342592.diff (from r489195, head/devel/llvm70/files/patch-head-r342592.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2019Q1/devel/llvm70/files/patch-head-r342592.diff	Fri Jan  4 16:16:31 2019	(r489257, copy of r489195, head/devel/llvm70/files/patch-head-r342592.diff)
@@ -0,0 +1,106 @@
+r342592 | dim | 2018-12-29 16:13:49 +0100 (Sat, 29 Dec 2018) | 19 lines
+
+Pull in r342397 from upstream llvm trunk (by Amara Emerson):
+
+  Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
+  created an extract_subvector with invalid index.""
+
+  Fixed the assertion failure.
+
+  Differential Revision: https://reviews.llvm.org/D51831
+
+This fixes 'Assertion failed: ((VT.getVectorNumElements() +
+N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
+"Extract subvector overflow!"), function getNode' when building the
+multimedia/aom port (with AVX2 enabled).
+
+Reported by:	jbeich
+PR:		234480
+
+Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+===================================================================
+--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp	(revision 342591)
++++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp	(revision 342592)
+@@ -13727,10 +13727,19 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts(
+              Val.getOpcode() == ISD::EXTRACT_SUBVECTOR)) {
+           SDValue Vec = Val.getOperand(0);
+           EVT MemVTScalarTy = MemVT.getScalarType();
++          SDValue Idx = Val.getOperand(1);
+           // We may need to add a bitcast here to get types to line up.
+           if (MemVTScalarTy != Vec.getValueType()) {
+             unsigned Elts = Vec.getValueType().getSizeInBits() /
+                             MemVTScalarTy.getSizeInBits();
++            if (Val.getValueType().isVector() && MemVT.isVector()) {
++              unsigned IdxC = cast<ConstantSDNode>(Idx)->getZExtValue();
++              unsigned NewIdx =
++                  ((uint64_t)IdxC * MemVT.getVectorNumElements()) / Elts;
++              Idx = DAG.getConstant(NewIdx, SDLoc(Val), Idx.getValueType());
++            }
++            if (!MemVT.isVector() && Val.getValueType().isVector())
++              dbgs() << "hit!\n";
+             EVT NewVecTy =
+                 EVT::getVectorVT(*DAG.getContext(), MemVTScalarTy, Elts);
+             Vec = DAG.getBitcast(NewVecTy, Vec);
+@@ -13737,7 +13746,7 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts(
+           }
+           auto OpC = (MemVT.isVector()) ? ISD::EXTRACT_SUBVECTOR
+                                         : ISD::EXTRACT_VECTOR_ELT;
+-          Val = DAG.getNode(OpC, SDLoc(Val), MemVT, Vec, Val.getOperand(1));
++          Val = DAG.getNode(OpC, SDLoc(Val), MemVT, Vec, Idx);
+         }
+         Ops.push_back(Val);
+       }
+Index: test/CodeGen/X86/merge-vector-stores-scale-idx-crash.ll
+===================================================================
+--- test/CodeGen/X86/merge-vector-stores-scale-idx-crash.ll	(nonexistent)
++++ test/CodeGen/X86/merge-vector-stores-scale-idx-crash.ll	(revision 342592)
+@@ -0,0 +1,49 @@
++; RUN: llc < %s  -mtriple=x86_64-apple-osx10.14 -mattr=+avx2 | FileCheck %s
++
++; Check that we don't crash due creating invalid extract_subvector indices in store merging.
++; CHECK-LABEL: testfn
++; CHECK: retq
++define void @testfn(i32* nocapture %p) {
++  %v0 = getelementptr i32, i32* %p, i64 12
++  %1 = bitcast i32* %v0 to <2 x i64>*
++  %2 = bitcast i32* %v0 to <4 x i32>*
++  %3 = getelementptr <2 x i64>, <2 x i64>* %1, i64 -3
++  store <2 x i64> undef, <2 x i64>* %3, align 16
++  %4 = shufflevector <4 x i64> zeroinitializer, <4 x i64> undef, <2 x i32> <i32 0, i32 1>
++  %5 = getelementptr <2 x i64>, <2 x i64>* %1, i64 -2
++  store <2 x i64> %4, <2 x i64>* %5, align 16
++  %6 = shufflevector <8 x i32> zeroinitializer, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
++  %7 = getelementptr <4 x i32>, <4 x i32>* %2, i64 -1
++  store <4 x i32> %6, <4 x i32>* %7, align 16
++  ret void
++}
++
++%struct.o.1.5.7.9.13.15.17.19.57 = type { [0 x %struct.d.0.4.6.8.12.14.16.18.56] }
++%struct.d.0.4.6.8.12.14.16.18.56 = type { float, float }
++
++; CHECK-LABEL: testfn_scalar
++; CHECK: retq
++define void @testfn_scalar(%struct.o.1.5.7.9.13.15.17.19.57* nocapture %j) local_unnamed_addr #0 align 2 {
++entry:
++  %0 = bitcast i64 undef to <2 x float>
++  br i1 undef, label %if.end, label %if.then
++
++if.then:                                          ; preds = %entry
++  unreachable
++
++if.end:                                           ; preds = %entry
++  %call.i.i17 = tail call <4 x float> @_Z1bv()
++  %1 = bitcast <4 x float> %call.i.i17 to <2 x i64>
++  %extract.i.i15 = extractelement <2 x i64> %1, i64 0
++  %arrayidx6 = getelementptr inbounds %struct.o.1.5.7.9.13.15.17.19.57, %struct.o.1.5.7.9.13.15.17.19.57* %j, i64 0, i32 0, i64 1
++  %2 = bitcast %struct.d.0.4.6.8.12.14.16.18.56* %arrayidx6 to i64*
++  store i64 %extract.i.i15, i64* %2, align 4
++  %r.sroa.0.0..sroa_cast12 = bitcast %struct.o.1.5.7.9.13.15.17.19.57* %j to <2 x float>*
++  store <2 x float> %0, <2 x float>* %r.sroa.0.0..sroa_cast12, align 4
++  ret void
++}
++
++declare <4 x float> @_Z1bv() local_unnamed_addr 
++
++attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="128" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
++

Copied: branches/2019Q1/devel/llvm70/files/patch-head-r342593.diff (from r489195, head/devel/llvm70/files/patch-head-r342593.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2019Q1/devel/llvm70/files/patch-head-r342593.diff	Fri Jan  4 16:16:31 2019	(r489257, copy of r489195, head/devel/llvm70/files/patch-head-r342593.diff)
@@ -0,0 +1,21 @@
+r342593 | dim | 2018-12-29 16:21:51 +0100 (Sat, 29 Dec 2018) | 8 lines
+
+Pull in r342863 from upstream llvm trunk (by Hans Wennborg):
+
+  Remove debug printf leftover from r342397
+
+PR:		234480
+
+Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+===================================================================
+--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp	(revision 342592)
++++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp	(revision 342593)
+@@ -13738,8 +13738,6 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts(
+                   ((uint64_t)IdxC * MemVT.getVectorNumElements()) / Elts;
+               Idx = DAG.getConstant(NewIdx, SDLoc(Val), Idx.getValueType());
+             }
+-            if (!MemVT.isVector() && Val.getValueType().isVector())
+-              dbgs() << "hit!\n";
+             EVT NewVecTy =
+                 EVT::getVectorVT(*DAG.getContext(), MemVTScalarTy, Elts);
+             Vec = DAG.getBitcast(NewVecTy, Vec);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901041616.x04GGVlh001182>