[llvm-branch-commits] [llvm] 5ad2592 - [X86] Fix cpu name typos

2020-11-02 Thread Tom Stellard via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-11-02T23:33:22-05:00
New Revision: 5ad2592b5dc039608eab8a07ce3bd0d8923f0516

URL: 
https://github.com/llvm/llvm-project/commit/5ad2592b5dc039608eab8a07ce3bd0d8923f0516
DIFF: 
https://github.com/llvm/llvm-project/commit/5ad2592b5dc039608eab8a07ce3bd0d8923f0516.diff

LOG: [X86] Fix cpu name typos

As discussed on PR26418 rGea84dc9500df incorrectly set the knl cpuname to 
tremont (and missed out the tremont cpuname entirely).

(cherry picked from commit 0d17dc2e75428885e37e53a1524ce7b607501cfa)

Added: 


Modified: 
llvm/lib/Support/Host.cpp

Removed: 




diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 658c1ee74cfe..36cecf9b2a16 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -760,14 +760,15 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned 
Model,
   *Type = X86::INTEL_GOLDMONT_PLUS;
   break;
 case 0x86:
+  CPU = "tremont";
   *Type = X86::INTEL_TREMONT;
   break;
 
+// Xeon Phi (Knights Landing + Knights Mill):
 case 0x57:
-  CPU = "tremont";
+  CPU = "knl";
   *Type = X86::INTEL_KNL;
   break;
-
 case 0x85:
   CPU = "knm";
   *Type = X86::INTEL_KNM;



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 701addf - [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

2020-11-02 Thread Tom Stellard via llvm-branch-commits

Author: Hubert Tong
Date: 2020-11-02T23:48:28-05:00
New Revision: 701addff1b713ee13d85daa0e3f7a0504d84b1af

URL: 
https://github.com/llvm/llvm-project/commit/701addff1b713ee13d85daa0e3f7a0504d84b1af
DIFF: 
https://github.com/llvm/llvm-project/commit/701addff1b713ee13d85daa0e3f7a0504d84b1af.diff

LOG: [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

Fix premature decision in the presence of type-dependent expression
operands on whether AltiVec vector initializations from single
expressions are "splat" operations.

Verify that the instantiation is able to determine the correct cast
semantics for both the scalar type and the vector type case.

Note that, because the change only affects the single-expression
case (and the target type is an AltiVec-style vector type), the
replacement of a parenthesized list with a parenthesized expression
does not change the semantics of the program in a program-observable
manner.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D88526

(cherry picked from commit 35ecc7fe49ba881a77e8146b51870a60a52b211f)

Added: 
clang/test/SemaTemplate/pr47676.cpp

Modified: 
clang/lib/Sema/SemaExpr.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ccae79636f32..0b80ee613077 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7401,7 +7401,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
 }
 if (PE || PLE->getNumExprs() == 1) {
   Expr *E = (PE ? PE->getSubExpr() : PLE->getExpr(0));
-  if (!E->getType()->isVectorType())
+  if (!E->isTypeDependent() && !E->getType()->isVectorType())
 isVectorLiteral = true;
 }
 else

diff  --git a/clang/test/SemaTemplate/pr47676.cpp 
b/clang/test/SemaTemplate/pr47676.cpp
new file mode 100644
index ..428607097c96
--- /dev/null
+++ b/clang/test/SemaTemplate/pr47676.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu \
+// RUN:-target-feature +altivec -fsyntax-only -ast-dump \
+// RUN:-xc++ < %s 2>&1 \
+// RUN:   | FileCheck %s
+
+// Ensures that casts to AltiVec type with a dependent expression operand does
+// not hit the assertion failure reported in PR47676. Further checks that casts
+// to AltiVec type with a dependent expression operand is, on instantiation,
+// able to correctly 
diff erentiate between a splat case and a bitcast case.
+template  void f(T *tp) {
+  extern void g(int, ...);
+  g(0, (__vector int)(*tp));
+  g(0, (__vector int)*tp);
+}
+
+void g(void) {
+  f<__vector float>(nullptr);
+//  CHECK: | |-FunctionDecl {{.*}} f 'void (__vector float *)'
+
+//  CHECK: |   | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   |   `-ImplicitCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   | `-ImplicitCastExpr {{.*}}'__vector float' 

+
+//  CHECK: | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   `-ImplicitCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'__vector float' 

+
+  f(nullptr);
+//  CHECK: | `-FunctionDecl {{.*}} f 'void (double *)'
+
+//  CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | |   `-ImplicitCastExpr {{.*}} 'int' 
+// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'double' 
+
+//  CHECK: |   `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'int' 
+// CHECK-NEXT: |   `-ImplicitCastExpr {{.*}}:'double' 
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 3c68767 - DeferredDiagnosticsEmitter crashes

2020-11-02 Thread Tom Stellard via llvm-branch-commits

Author: Geoff Levner
Date: 2020-11-03T00:03:20-05:00
New Revision: 3c687677678c382e8d13d6583c3f8cdf3fd301dd

URL: 
https://github.com/llvm/llvm-project/commit/3c687677678c382e8d13d6583c3f8cdf3fd301dd
DIFF: 
https://github.com/llvm/llvm-project/commit/3c687677678c382e8d13d6583c3f8cdf3fd301dd.diff

LOG: DeferredDiagnosticsEmitter crashes

Patch VisitCXXDeleteExpr() in clang::UsedDeclVisitor to avoid it crashing
when the expression's destroyed type is null. According to the comments
in CXXDeleteExpr::getDestroyedType(), this can happen when the type to
delete is a dependent type.

Patch by Geoff Levner.

Differential Revision: https://reviews.llvm.org/D88949

(cherry picked from commit b9225543e844bee5091aa16108e0c54bd2abe485)

Added: 


Modified: 
clang/lib/Sema/UsedDeclVisitor.h

Removed: 




diff  --git a/clang/lib/Sema/UsedDeclVisitor.h 
b/clang/lib/Sema/UsedDeclVisitor.h
index d207e07f451a..c33d30478e2a 100644
--- a/clang/lib/Sema/UsedDeclVisitor.h
+++ b/clang/lib/Sema/UsedDeclVisitor.h
@@ -67,10 +67,13 @@ class UsedDeclVisitor : public 
EvaluatedExprVisitor {
   void VisitCXXDeleteExpr(CXXDeleteExpr *E) {
 if (E->getOperatorDelete())
   asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorDelete());
-QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType());
-if (const RecordType *DestroyedRec = Destroyed->getAs()) {
-  CXXRecordDecl *Record = cast(DestroyedRec->getDecl());
-  asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
+QualType DestroyedOrNull = E->getDestroyedType();
+if (!DestroyedOrNull.isNull()) {
+  QualType Destroyed = S.Context.getBaseElementType(DestroyedOrNull);
+  if (const RecordType *DestroyedRec = Destroyed->getAs()) {
+CXXRecordDecl *Record = cast(DestroyedRec->getDecl());
+asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
+  }
 }
 
 Inherited::VisitCXXDeleteExpr(E);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ef4ffca - [DAE] MarkLive in MarkValue(MaybeLive) if any use is live

2020-11-02 Thread Tom Stellard via llvm-branch-commits

Author: Arthur Eubanks
Date: 2020-11-03T00:11:56-05:00
New Revision: ef4ffcafbb2deeb30ccc30ebcdf9a5a843a27ec1

URL: 
https://github.com/llvm/llvm-project/commit/ef4ffcafbb2deeb30ccc30ebcdf9a5a843a27ec1
DIFF: 
https://github.com/llvm/llvm-project/commit/ef4ffcafbb2deeb30ccc30ebcdf9a5a843a27ec1.diff

LOG: [DAE] MarkLive in MarkValue(MaybeLive) if any use is live

While looping through all args or all return values, we may mark a use
of a later iteration as live. Previously when we got to that later value
it would ignore that and continue adding to Uses instead of marking it
live. For example, when looping through arg#0 and arg#1,
MarkValue(arg#0, Live) may cause some use of arg#1 to be live, but
MarkValue(arg#1, MaybeLive) will not notice that and continue adding
into Uses.

Now MarkValue(RA, MaybeLive) will MarkLive(RA) if any use is live.

Fixes PR47444.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D88529

(cherry picked from commit 7468afe9ca135228f4c5a48f1b061ca57786fad6)

Added: 
llvm/test/Transforms/DeadArgElim/preserve-used-ret.ll

Modified: 
llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Removed: 




diff  --git a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h 
b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
index 73797bc10017..496ceea12bc9 100644
--- a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
+++ b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h
@@ -128,6 +128,7 @@ class DeadArgumentEliminationPass
   Liveness SurveyUses(const Value *V, UseVector &MaybeLiveUses);
 
   void SurveyFunction(const Function &F);
+  bool IsLive(const RetOrArg &RA);
   void MarkValue(const RetOrArg &RA, Liveness L,
  const UseVector &MaybeLiveUses);
   void MarkLive(const RetOrArg &RA);

diff  --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp 
b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 54c51b6e7161..f2588938d964 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -357,7 +357,7 @@ DeadArgumentEliminationPass::Liveness
 DeadArgumentEliminationPass::MarkIfNotLive(RetOrArg Use,
UseVector &MaybeLiveUses) {
   // We're live if our use or its Function is already marked as live.
-  if (LiveFunctions.count(Use.F) || LiveValues.count(Use))
+  if (IsLive(Use))
 return Live;
 
   // We're maybe live otherwise, but remember that we must become live if
@@ -657,10 +657,18 @@ void DeadArgumentEliminationPass::MarkValue(const 
RetOrArg &RA, Liveness L,
   MarkLive(RA);
   break;
 case MaybeLive:
-  // Note any uses of this value, so this return value can be
-  // marked live whenever one of the uses becomes live.
-  for (const auto &MaybeLiveUse : MaybeLiveUses)
-Uses.insert(std::make_pair(MaybeLiveUse, RA));
+  assert(!IsLive(RA) && "Use is already live!");
+  for (const auto &MaybeLiveUse : MaybeLiveUses) {
+if (IsLive(MaybeLiveUse)) {
+  // A use is live, so this value is live.
+  MarkLive(RA);
+  break;
+} else {
+  // Note any uses of this value, so this value can be
+  // marked live whenever one of the uses becomes live.
+  Uses.insert(std::make_pair(MaybeLiveUse, RA));
+}
+  }
   break;
   }
 }
@@ -686,17 +694,20 @@ void DeadArgumentEliminationPass::MarkLive(const Function 
&F) {
 /// mark any values that are used by this value (according to Uses) live as
 /// well.
 void DeadArgumentEliminationPass::MarkLive(const RetOrArg &RA) {
-  if (LiveFunctions.count(RA.F))
-return; // Function was already marked Live.
+  if (IsLive(RA))
+return; // Already marked Live.
 
-  if (!LiveValues.insert(RA).second)
-return; // We were already marked Live.
+  LiveValues.insert(RA);
 
   LLVM_DEBUG(dbgs() << "DeadArgumentEliminationPass - Marking "
 << RA.getDescription() << " live\n");
   PropagateLiveness(RA);
 }
 
+bool DeadArgumentEliminationPass::IsLive(const RetOrArg &RA) {
+  return LiveFunctions.count(RA.F) || LiveValues.count(RA);
+}
+
 /// PropagateLiveness - Given that RA is a live value, propagate it's liveness
 /// to any other values it uses (according to Uses).
 void DeadArgumentEliminationPass::PropagateLiveness(const RetOrArg &RA) {

diff  --git a/llvm/test/Transforms/DeadArgElim/preserve-used-ret.ll 
b/llvm/test/Transforms/DeadArgElim/preserve-used-ret.ll
new file mode 100644
index ..f0c2649fdb39
--- /dev/null
+++ b/llvm/test/Transforms/DeadArgElim/preserve-used-ret.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -deadargelim %s | FileCheck %s
+
+define internal { i64, i64 } @f(i64 %a, i64 %b) {
+start:
+  %0 = insertvalue { i64, i64 } undef, i64 %a, 0
+  %1 = insertvalue { i64, i64 } %0