[PATCH] D92936: [Sema] Fix deleted function problem in implicitly movable test

2020-12-31 Thread Yang Fan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG89b0972aa2f5: [Sema] Fix deleted function problem in 
implicitly movable test (authored by nullptr.cpp).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92936/new/

https://reviews.llvm.org/D92936

Files:
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- /dev/null
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify=expected %s
+
+namespace test_delete_function {
+struct A1 {
+  A1();
+  A1(const A1 &);
+  A1(A1 &&) = delete; // expected-note {{'A1' has been explicitly marked deleted here}}
+};
+A1 test1() {
+  A1 a;
+  return a; // expected-error {{call to deleted constructor of 'test_delete_function::A1'}}
+}
+
+struct A2 {
+  A2();
+  A2(const A2 &);
+
+private:
+  A2(A2 &&); // expected-note {{declared private here}}
+};
+A2 test2() {
+  A2 a;
+  return a; // expected-error {{calling a private constructor of class 'test_delete_function::A2'}}
+}
+
+struct C {};
+
+struct B1 {
+  B1(C &);
+  B1(C &&) = delete; // expected-note {{'B1' has been explicitly marked deleted here}}
+};
+B1 test3() {
+  C c;
+  return c; // expected-error {{conversion function from 'test_delete_function::C' to 'test_delete_function::B1' invokes a deleted function}}
+}
+
+struct B2 {
+  B2(C &);
+
+private:
+  B2(C &&); // expected-note {{declared private here}}
+};
+B2 test4() {
+  C c;
+  return c; // expected-error {{calling a private constructor of class 'test_delete_function::B2'}}
+}
+} // namespace test_delete_function
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3118,11 +3118,14 @@
 /// If move-initialization is not possible, such that we must fall back to
 /// treating the operand as an lvalue, we will leave Res in its original
 /// invalid state.
-static void TryMoveInitialization(Sema& S,
-  const InitializedEntity ,
+///
+/// \returns Whether we need to do the second overload resolution. If the first
+/// overload resolution fails, or if the first overload resolution succeeds but
+/// the selected constructor/operator doesn't match the additional criteria, we
+/// need to do the second overload resolution.
+static bool TryMoveInitialization(Sema , const InitializedEntity ,
   const VarDecl *NRVOCandidate,
-  QualType ResultType,
-  Expr *,
+  QualType ResultType, Expr *,
   bool ConvertingConstructorsOnly,
   ExprResult ) {
   ImplicitCastExpr AsRvalue(ImplicitCastExpr::OnStack, Value->getType(),
@@ -3135,8 +3138,10 @@
 
   InitializationSequence Seq(S, Entity, Kind, InitExpr);
 
-  if (!Seq)
-return;
+  bool NeedSecondOverloadResolution = true;
+  if (!Seq && Seq.getFailedOverloadResult() != OR_Deleted) {
+return NeedSecondOverloadResolution;
+  }
 
   for (const InitializationSequence::Step  : Seq.steps()) {
 if (Step.Kind != InitializationSequence::SK_ConstructorInitialization &&
@@ -3179,6 +3184,7 @@
   }
 }
 
+NeedSecondOverloadResolution = false;
 // Promote "AsRvalue" to the heap, since we now need this
 // expression node to persist.
 Value =
@@ -3189,6 +3195,8 @@
 // using the constructor we found.
 Res = Seq.Perform(S, Entity, Kind, Value);
   }
+
+  return NeedSecondOverloadResolution;
 }
 
 /// Perform the initialization of a potentially-movable value, which
@@ -3213,6 +3221,7 @@
   // select the constructor for the copy is first performed as if the object
   // were designated by an rvalue.
   ExprResult Res = ExprError();
+  bool NeedSecondOverloadResolution = true;
 
   if (AllowNRVO) {
 bool AffectedByCWG1579 = false;
@@ -3229,11 +3238,11 @@
 }
 
 if (NRVOCandidate) {
-  TryMoveInitialization(*this, Entity, NRVOCandidate, ResultType, Value,
-true, Res);
+  NeedSecondOverloadResolution = TryMoveInitialization(
+  *this, Entity, NRVOCandidate, ResultType, Value, true, Res);
 }
 
-if (!Res.isInvalid() && AffectedByCWG1579) {
+if (!NeedSecondOverloadResolution && AffectedByCWG1579) {
   QualType QT = NRVOCandidate->getType();
   if (QT.getNonReferenceType()
   

[clang] 89b0972 - [Sema] Fix deleted function problem in implicitly movable test

2020-12-31 Thread Yang Fan via cfe-commits

Author: Yang Fan
Date: 2021-01-01T15:47:49+08:00
New Revision: 89b0972aa2f58f927633c63570b36550a17f4e63

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

LOG: [Sema] Fix deleted function problem in implicitly movable test

In implicitly movable test, a two-stage overload resolution is performed.
If the first overload resolution selects a deleted function, Clang directly
performs the second overload resolution, without checking whether the
deleted function matches the additional criteria.

This patch fixes the above problem.

Reviewed By: Quuxplusone

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

Added: 
clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

Modified: 
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaStmt.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 6d2e6094e79c..4a965c60c74e 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -4119,7 +4119,9 @@ static void TryConstructorInitialization(Sema ,
   InitializationSequence::FK_ListConstructorOverloadFailed 
:
   InitializationSequence::FK_ConstructorOverloadFailed,
 Result);
-return;
+
+if (Result != OR_Deleted)
+  return;
   }
 
   bool HadMultipleCandidates = (CandidateSet.size() > 1);
@@ -4140,31 +4142,45 @@ static void TryConstructorInitialization(Sema ,
 return;
   }
 
-  // C++11 [dcl.init]p6:
-  //   If a program calls for the default initialization of an object
-  //   of a const-qualified type T, T shall be a class type with a
-  //   user-provided default constructor.
-  // C++ core issue 253 proposal:
-  //   If the implicit default constructor initializes all subobjects, no
-  //   initializer should be required.
-  // The 253 proposal is for example needed to process libstdc++ headers in 
5.x.
   CXXConstructorDecl *CtorDecl = cast(Best->Function);
-  if (Kind.getKind() == InitializationKind::IK_Default &&
-  Entity.getType().isConstQualified()) {
-if (!CtorDecl->getParent()->allowConstDefaultInit()) {
-  if (!maybeRecoverWithZeroInitialization(S, Sequence, Entity))
-Sequence.SetFailed(InitializationSequence::FK_DefaultInitOfConst);
+  if (Result != OR_Deleted) { // TODO: Support for more than one failure.
+// C++11 [dcl.init]p6:
+//   If a program calls for the default initialization of an object
+//   of a const-qualified type T, T shall be a class type with a
+//   user-provided default constructor.
+// C++ core issue 253 proposal:
+//   If the implicit default constructor initializes all subobjects, no
+//   initializer should be required.
+// The 253 proposal is for example needed to process libstdc++ headers
+// in 5.x.
+if (Kind.getKind() == InitializationKind::IK_Default &&
+Entity.getType().isConstQualified()) {
+  if (!CtorDecl->getParent()->allowConstDefaultInit()) {
+if (!maybeRecoverWithZeroInitialization(S, Sequence, Entity))
+  Sequence.SetFailed(InitializationSequence::FK_DefaultInitOfConst);
+return;
+  }
+}
+
+// C++11 [over.match.list]p1:
+//   In copy-list-initialization, if an explicit constructor is chosen, the
+//   initializer is ill-formed.
+if (IsListInit && !Kind.AllowExplicit() && CtorDecl->isExplicit()) {
+  Sequence.SetFailed(InitializationSequence::FK_ExplicitConstructor);
   return;
 }
   }
 
-  // C++11 [over.match.list]p1:
-  //   In copy-list-initialization, if an explicit constructor is chosen, the
-  //   initializer is ill-formed.
-  if (IsListInit && !Kind.AllowExplicit() && CtorDecl->isExplicit()) {
-Sequence.SetFailed(InitializationSequence::FK_ExplicitConstructor);
+  // [class.copy.elision]p3:
+  // In some copy-initialization contexts, a two-stage overload resolution
+  // is performed.
+  // If the first overload resolution selects a deleted function, we also
+  // need the initialization sequence to decide whether to perform the second
+  // overload resolution.
+  // For deleted functions in other contexts, there is no need to get the
+  // initialization sequence.
+  if (Result == OR_Deleted && Kind.getKind() != InitializationKind::IK_Copy)
 return;
-  }
 
   // Add the constructor initialization step. Any cv-qualification conversion 
is
   // subsumed by the initialization.
@@ -5260,7 +5276,16 @@ static void TryUserDefinedConversion(Sema ,
 Sequence.SetOverloadFailure(
 
InitializationSequence::FK_UserConversionOverloadFailed,
 Result);
-return;
+
+// [class.copy.elision]p3:
+// In some copy-initialization contexts, a two-stage overload resolution
+// is performed.

[PATCH] D93961: [clang-tidy][NFC] Fix a build warning due to an extra semicolon

2020-12-31 Thread Yang Fan via Phabricator via cfe-commits
nullptr.cpp created this revision.
Herald added a subscriber: xazax.hun.
nullptr.cpp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93961

Files:
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp


Index: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -392,7 +392,7 @@
 
 static void diagHandlerImpl(const llvm::SMDiagnostic , void *Ctx) {
   (*reinterpret_cast(Ctx))(Diag);
-};
+}
 
 llvm::ErrorOr
 parseConfigurationWithDiags(llvm::MemoryBufferRef Config,


Index: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
@@ -392,7 +392,7 @@
 
 static void diagHandlerImpl(const llvm::SMDiagnostic , void *Ctx) {
   (*reinterpret_cast(Ctx))(Diag);
-};
+}
 
 llvm::ErrorOr
 parseConfigurationWithDiags(llvm::MemoryBufferRef Config,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92936: [Sema] Fix deleted function problem in implicitly movable test

2020-12-31 Thread Yang Fan via Phabricator via cfe-commits
nullptr.cpp updated this revision to Diff 314208.
nullptr.cpp added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92936/new/

https://reviews.llvm.org/D92936

Files:
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- /dev/null
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -verify=expected %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify=expected %s
+
+namespace test_delete_function {
+struct A1 {
+  A1();
+  A1(const A1 &);
+  A1(A1 &&) = delete; // expected-note {{'A1' has been explicitly marked deleted here}}
+};
+A1 test1() {
+  A1 a;
+  return a; // expected-error {{call to deleted constructor of 'test_delete_function::A1'}}
+}
+
+struct A2 {
+  A2();
+  A2(const A2 &);
+
+private:
+  A2(A2 &&); // expected-note {{declared private here}}
+};
+A2 test2() {
+  A2 a;
+  return a; // expected-error {{calling a private constructor of class 'test_delete_function::A2'}}
+}
+
+struct C {};
+
+struct B1 {
+  B1(C &);
+  B1(C &&) = delete; // expected-note {{'B1' has been explicitly marked deleted here}}
+};
+B1 test3() {
+  C c;
+  return c; // expected-error {{conversion function from 'test_delete_function::C' to 'test_delete_function::B1' invokes a deleted function}}
+}
+
+struct B2 {
+  B2(C &);
+
+private:
+  B2(C &&); // expected-note {{declared private here}}
+};
+B2 test4() {
+  C c;
+  return c; // expected-error {{calling a private constructor of class 'test_delete_function::B2'}}
+}
+} // namespace test_delete_function
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3118,11 +3118,14 @@
 /// If move-initialization is not possible, such that we must fall back to
 /// treating the operand as an lvalue, we will leave Res in its original
 /// invalid state.
-static void TryMoveInitialization(Sema& S,
-  const InitializedEntity ,
+///
+/// \returns Whether we need to do the second overload resolution. If the first
+/// overload resolution fails, or if the first overload resolution succeeds but
+/// the selected constructor/operator doesn't match the additional criteria, we
+/// need to do the second overload resolution.
+static bool TryMoveInitialization(Sema , const InitializedEntity ,
   const VarDecl *NRVOCandidate,
-  QualType ResultType,
-  Expr *,
+  QualType ResultType, Expr *,
   bool ConvertingConstructorsOnly,
   ExprResult ) {
   ImplicitCastExpr AsRvalue(ImplicitCastExpr::OnStack, Value->getType(),
@@ -3135,8 +3138,10 @@
 
   InitializationSequence Seq(S, Entity, Kind, InitExpr);
 
-  if (!Seq)
-return;
+  bool NeedSecondOverloadResolution = true;
+  if (!Seq && Seq.getFailedOverloadResult() != OR_Deleted) {
+return NeedSecondOverloadResolution;
+  }
 
   for (const InitializationSequence::Step  : Seq.steps()) {
 if (Step.Kind != InitializationSequence::SK_ConstructorInitialization &&
@@ -3179,6 +3184,7 @@
   }
 }
 
+NeedSecondOverloadResolution = false;
 // Promote "AsRvalue" to the heap, since we now need this
 // expression node to persist.
 Value =
@@ -3189,6 +3195,8 @@
 // using the constructor we found.
 Res = Seq.Perform(S, Entity, Kind, Value);
   }
+
+  return NeedSecondOverloadResolution;
 }
 
 /// Perform the initialization of a potentially-movable value, which
@@ -3213,6 +3221,7 @@
   // select the constructor for the copy is first performed as if the object
   // were designated by an rvalue.
   ExprResult Res = ExprError();
+  bool NeedSecondOverloadResolution = true;
 
   if (AllowNRVO) {
 bool AffectedByCWG1579 = false;
@@ -3229,11 +3238,11 @@
 }
 
 if (NRVOCandidate) {
-  TryMoveInitialization(*this, Entity, NRVOCandidate, ResultType, Value,
-true, Res);
+  NeedSecondOverloadResolution = TryMoveInitialization(
+  *this, Entity, NRVOCandidate, ResultType, Value, true, Res);
 }
 
-if (!Res.isInvalid() && AffectedByCWG1579) {
+if (!NeedSecondOverloadResolution && AffectedByCWG1579) {
   QualType QT = NRVOCandidate->getType();
   if (QT.getNonReferenceType()
  .getUnqualifiedType()
@@ -3256,7 +3265,7 @@
 Diag(Value->getExprLoc(), 

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2020-12-31 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.

Looks good - test cases might benefit from some descriptive comments 
(explaining why the pseudo probe pass needs to be enabled to test the unique 
linkage name pass - I guess to check that it appears in just the right place in 
the pass pipeline?)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93656/new/

https://reviews.llvm.org/D93656

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


[PATCH] D93747: Rename debug linkage name with -funique-internal-linkage-names

2020-12-31 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added subscribers: AndrewLitteken, bbn, JDevlieghere, jdoerfert, 
aprantl.
dblaikie added a comment.

In D93747#2470504 , @hoy wrote:

> In D93747#2470387 , @dblaikie wrote:
>
>> Please remove the clang test change - if this is an LLVM change with LLVM 
>> test coverage, that's enough. (we don't generally test every LLVM change 
>> from both LLVM and Clang)
>
> Sounds good.
>
>> I'd still be curious if you could look around to see whether there are other 
>> cases of function splitting/cloning/etc to see how they deal with updating 
>> the DISubprograms, to see if there's some prior art that should be used here.
>
> To the best of my knowledge, existing code does not change the linkage name 
> field of a DISubprogram once created. You can create a new DISubprogram 
> record with any linkage name you want but bear in mind how the debugger will 
> consume the record. Looks like we are the first one to change existing record 
> which will confuse the debugger.

Sure enough - do any other transforms have similar requirements (of creating a 
record for something that looks like the same function but isn't quite) but 
take a different approach? Be good to know if other approaches were 
chosen/how/why they are applicable there but not here, etc. (conversely perhaps 
other passes worked around the issue in less than ideal ways and could benefit 
from using this new approach).

Looks like some places that could use this functionality aren't quite there yet 
- 
The Attributor has an internalizing feature (added in 
87a85f3d57f55f5652ec44f77816c7c9457545fa 
 ) that 
produces invalid IR (ends up with two !dbg attachments of the same 
DISubprogram) if the function it's internalizing has a DISubprogram - but if it 
succeeded it'd have the same problem that the linkage name on the DISubprogram 
wouldn't match the actual symbol/function name. (@jdoerfert @bbn).
The IR Outliner (@AndrewLitteken ) seems to be only a few months old and 
appears to have no debug info handling - probably results in the same problem.
The Partial Inliner does clone a function into a new name & so would have an 
invalid DISubprogram, though it only uses the clone for inlining (this probably 
then goes on to produce the desired debug info, where the inlining appears to 
come from the original function)
ThinLTO does some function cloning within a module for aliases, but it then 
renames the clone to the aliasees name so I think the name works out to match 
again.

If this is an invariant, that the linkage name on the DISubprogram should match 
the actual llvm::Function name (@aprantl @JDevlieghere - verifier check, 
perhaps?) - it'd be nice to make that more reliable, either by removing the 
name and relying on the llvm::Function name (perhaps with a boolean on the 
DISubprogram as to whether the linkage name should be emitted or not - I think 
currently Clang's IRGen makes choices about which DISubprograms will get 
linkage names) or a verifier and utilities to keep them in sync.

But I'll leave that alone for now/for this review, unless someone else wants to 
chime in on it.

In D93747#2470178 , @tmsriram wrote:

> In D93747#2469556 , @hoy wrote:
>
>>> In D93656 , @dblaikie wrote:
>>> Though the C case is interesting - it means you'll end up with C functions 
>>> with the same DWARF 'name' but different linkage name. I don't know what 
>>> that'll do to DWARF consumers - I guess they'll probably be OK-ish with it, 
>>> as much as they are with C++ overloading. I think there are some cases of C 
>>> name mangling so it's probably supported/OK-ish with DWARF Consumers. 
>>> Wouldn't hurt for you to take a look/see what happens in that case with a 
>>> debugger like gdb/check other cases of C name mangling to see what DWARF 
>>> they end up creating (with both GCC and Clang).
>>
>> I did a quick experiment with C name managing with GCC and -flto. It turns 
>> out the `DW_AT_linkage_name` field of `DW_TAG_subprogram` is never set for C 
>> programs. If set, the gdb debugger will use that field to match the user 
>> input and set breakpoints. Therefore, giving `DW_AT_linkage_name` a 
>> uniquefied name prevents the debugger from setting a breakpoint based on 
>> source names unless the user specifies a decorated name.
>>
>> Hence, this approach sounds like a workaround for us when the profile 
>> quality matters more than debugging experience. I'm inclined to have it 
>> under a switch. What do you think?
>
> Just a thought, we could always check if rawLinkageName is set and only set 
> it when it is not null.  That seems safe without needing the option. Not a 
> strong opinion.

Was this thread concluded? Doesn't look like any check was added?


Repository:
  rG LLVM Github 

[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-31 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

Additionally, this bug has already been reported: 
https://bugs.llvm.org/show_bug.cgi?id=46927


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-31 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

@MyDeveloperDay I expect to see exactly that. `clang-format` currently does not 
respect `AfterEnum`, treating it as always `true`. This is why I changed 
`UnwrappedLineParser.cpp`.

The unit test is incorrect as the style used for the `clang-format` C(++) unit 
tests uses `BreakBeforeBraces: Attach`, which should result in `AfterEnum` 
being treated as false, as indicated by the docs I quoted a few messages back. 
The unit test expects `AfterEnum: true` behaviour from a style that should 
result in `AfterEnum: false` behaviour. This is why I changed the unit test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938

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


[clang] d1fd723 - Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions

2020-12-31 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-12-31T13:59:45-08:00
New Revision: d1fd72343c6ff58a3b66bc0df56fed9ac21e4056

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

LOG: Refactor how -fno-semantic-interposition sets dso_local on default 
visibility external linkage definitions

The idea is that the CC1 default for ELF should set dso_local on default
visibility external linkage definitions in the default -mrelocation-model pic
mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar.

The refactoring is made available by 2820a2ca3a0e69c3f301845420e00672251b.

Currently only x86 supports local aliases. We move the decision to the driver.
There are three CC1 states:

* -fsemantic-interposition: make some linkages interposable and make default 
visibility external linkage definitions dso_preemptable.
* (default): selected if the target supports .Lfoo$local: make default 
visibility external linkage definitions dso_local
* -fhalf-no-semantic-interposition: if neither option is set or the target does 
not support .Lfoo$local: like -fno-semantic-interposition but local aliases are 
not used. So references can be interposed if not optimized out.

Add -fhalf-no-semantic-interposition to a few tests using the half-based 
semantic interposition behavior.

Added: 


Modified: 
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/attr-arm-sve-vector-bits-globals.c
clang/test/CodeGen/semantic-interposition.c

clang/test/CodeGenCXX/RelativeVTablesABI/child-inheritted-from-parent-in-comdat.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-1.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-2.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/diamond-virtual-inheritance.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/inheritted-virtual-function.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/inline-virtual-function.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/multiple-inheritance.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/no-alias-when-dso-local.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/override-pure-virtual-method.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/overriden-virtual-function.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-flag.cpp
clang/test/CodeGenCXX/RelativeVTablesABI/simple-vtable-definition.cpp
clang/test/Driver/fsemantic-interposition.c
llvm/include/llvm/IR/Module.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/IR/Module.cpp

Removed: 
clang/test/CodeGen/semantic-interposition-no.c



diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index cc5eb939dbd2..963fde5f3ad4 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -322,7 +322,8 @@ ENUM_LANGOPT(ExternDeclDLLImportVisibility, Visibility, 3, 
DefaultVisibility,
 ENUM_LANGOPT(ExternDeclNoDLLStorageClassVisibility, Visibility, 3, 
HiddenVisibility,
  "visibility for external declarations without an explicit DLL 
storage class [-fvisibility-from-dllstorageclass]")
 BENIGN_LANGOPT(SemanticInterposition, 1, 0, "semantic interposition")
-BENIGN_LANGOPT(ExplicitNoSemanticInterposition, 1, 0, "explicitly no semantic 
interposition")
+BENIGN_LANGOPT(HalfNoSemanticInterposition, 1, 0,
+   "Like -fno-semantic-interposition but don't use local aliases")
 ENUM_LANGOPT(StackProtector, StackProtectorMode, 2, SSPOff,
  "stack protector mode")
 ENUM_LANGOPT(TrivialAutoVarInit, TrivialAutoVarInitKind, 2, 
TrivialAutoVarInitKind::Uninitialized,

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index af209eb9089d..9a851f63a663 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3793,7 +3793,7 @@ defm ipa_cp : BooleanFFlag<"ipa-cp">,
 Group;
 defm ivopts : BooleanFFlag<"ivopts">, 
Group;
 def fsemantic_interposition : Flag<["-"], "fsemantic-interposition">, 
Group, Flags<[CC1Option]>;
-def fno_semantic_interposition: Flag<["-"], "fno-semantic-interposition">, 
Group, Flags<[CC1Option]>;
+def fno_semantic_interposition: Flag<["-"], "fno-semantic-interposition">, 
Group;
 defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, 
Group;
 defm peel_loops : BooleanFFlag<"peel-loops">, 
Group;
 defm permissive : BooleanFFlag<"permissive">, Group;
@@ -4722,6 +4722,8 @@ def pic_level : Separate<["-"], "pic-level">,
   HelpText<"Value for 

[clang] 219d00e - [test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences

2020-12-31 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-12-31T13:59:44-08:00
New Revision: 219d00e0d90941d3e54fc711ea1e7b5e4b5b4335

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

LOG: [test] Make ELF tests immune to dso_local/dso_preemptable/(none) 
differences

ELF -cc1 -mrelocation-model pic will default to no semantic interposition plus
setting dso_local on default visibility external linkage definitions, so that
COFF, Mach-O and ELF output will be similar.

This patch makes tests immune to the differences.

Added: 


Modified: 
clang/test/CodeGenCUDA/lambda-reference-var.cu
clang/test/CodeGenCXX/default_calling_conv.cpp
clang/test/Driver/hip-fpie-option.hip
clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp

Removed: 




diff  --git a/clang/test/CodeGenCUDA/lambda-reference-var.cu 
b/clang/test/CodeGenCUDA/lambda-reference-var.cu
index 44b012956507..2c62b0a94beb 100644
--- a/clang/test/CodeGenCUDA/lambda-reference-var.cu
+++ b/clang/test/CodeGenCUDA/lambda-reference-var.cu
@@ -47,7 +47,7 @@ __device__ void dev_capture_dev_ref_by_ref(int *out) {
   [&](){ ref++; *out = ref;}();
 }
 
-// DEV-LABEL: define void @_Z7dev_refPi(
+// DEV-LABEL: define{{.*}} void @_Z7dev_refPi(
 // DEV: %[[VAL:.*]] = load i32, i32* addrspacecast (i32 addrspace(1)* 
@global_device_var to i32*)
 // DEV: %[[VAL2:.*]] = add nsw i32 %[[VAL]], 1
 // DEV: store i32 %[[VAL2]], i32* addrspacecast (i32 addrspace(1)* 
@global_device_var to i32*)
@@ -94,7 +94,7 @@ void host_capture_host_ref_by_ref(int *out) {
   [&](){ ref++; *out = ref;}();
 }
 
-// HOST-LABEL: define void @_Z8host_refPi(
+// HOST-LABEL: define{{.*}} void @_Z8host_refPi(
 // HOST: %[[VAL:.*]] = load i32, i32* @global_host_var
 // HOST: %[[VAL2:.*]] = add nsw i32 %[[VAL]], 1
 // HOST: store i32 %[[VAL2]], i32* @global_host_var
@@ -120,7 +120,7 @@ void host_lambda_ref(int *out) {
   }();
 }
 
-// HOST-LABEL: define void @_Z28dev_capture_host_ref_by_copyPi(
+// HOST-LABEL: define{{.*}} void @_Z28dev_capture_host_ref_by_copyPi(
 // HOST: %[[CAP:.*]] = getelementptr inbounds %[[T3]], %[[T3]]* %{{.*}}, i32 
0, i32 1
 // HOST: %[[VAL:.*]] = load i32, i32* @global_host_var
 // HOST: store i32 %[[VAL]], i32* %[[CAP]]

diff  --git a/clang/test/CodeGenCXX/default_calling_conv.cpp 
b/clang/test/CodeGenCXX/default_calling_conv.cpp
index d1f9571e0d56..e3d7ac429a60 100644
--- a/clang/test/CodeGenCXX/default_calling_conv.cpp
+++ b/clang/test/CodeGenCXX/default_calling_conv.cpp
@@ -29,7 +29,7 @@ void __attribute__((fastcall)) test3() {}
 // ALL: define{{.*}} x86_stdcallcc void @_Z5test4v
 void __attribute__((stdcall)) test4() {}
 
-// ALL: define  x86_vectorcallcc void @_Z5test5v
+// ALL: define{{.*}} x86_vectorcallcc void @_Z5test5v
 void __attribute__((vectorcall)) test5() {}
 
 // ALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v

diff  --git a/clang/test/Driver/hip-fpie-option.hip 
b/clang/test/Driver/hip-fpie-option.hip
index 2b433cd5a2c2..2e296a099dea 100644
--- a/clang/test/Driver/hip-fpie-option.hip
+++ b/clang/test/Driver/hip-fpie-option.hip
@@ -31,8 +31,9 @@
 // RUN:   -fPIE \
 // RUN:   2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
 
-// DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* 
"-mrelocation-model" "pic" "-pic-level" "[1|2]" "-mframe-pointer=all"}}
+// DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* 
"-mrelocation-model" "pic" "-pic-level" "[1|2]".* "-mframe-pointer=all"}}
 // HOST-STATIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-mrelocation-model" "static"}}
-// HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=all"}}
+// HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-mrelocation-model" "pic" "-pic-level" "2"}}
+// HOST-PIC-NOT: "-pic-is-pie"
 // HOST-PIE-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"}}
 // DEV-NOT: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-pic-is-pie"}}

diff  --git a/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp 
b/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
index 91a9c2af73da..496ac07d9fa2 100644
--- a/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
@@ -18,7 +18,7 @@
 // DEVICE-DAG: [[C_ADDR:.+]] = internal global i32 0,
 // DEVICE-DAG: [[CD_ADDR:@.+]] ={{ hidden | }}global %struct.S zeroinitializer,
 // HOST-DAG: @[[C_ADDR:.+]] = internal global i32 0,
-// HOST-DAG: @[[CD_ADDR:.+]] ={{ hidden | }}global %struct.S zeroinitializer,
+// HOST-DAG: @[[CD_ADDR:.+]] ={{( hidden | dso_local)?}} global %struct.S 
zeroinitializer,
 
 #pragma omp declare target
 

[PATCH] D80421: [Mips] use correct ld.so for musl soft float

2020-12-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D80421#2081794 , @joewholden wrote:

> This is actually wrong anyway

If it is wrong, it should be abandoned. If it is correct, can you add some 
tests under clang/test/Driver and test with `ninja check-clang-driver`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80421/new/

https://reviews.llvm.org/D80421

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


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked 2 inline comments as done.
thezbyg added a comment.

After some updating, rebuilding and searching for differences in Objective-C++ 
formatting, I managed to find where the problem with these failing tests is. In 
**_verifyFormat** function C++ code formatting is tested for stability like 
this:

  EXPECT_EQ(Expected.str(), format(Expected, Style));
  EXPECT_EQ(Expected.str(), format(Code, Style));

, but Objective-C++ test, in the same function, looks like this:

  EXPECT_EQ(Expected.str(), format(test::messUp(Code), ObjCStyle));

**test::messUp** function removes all newlines and indentation, so test code:

  struct foo {
int i;
  
  private:
int j;
  }

turns into:

  struct foo { int i; private: int j; }

After running **format** on this code, we get incorrect result:

  struct foo {
int i;
  private:
int j;
  }

Running **format** again would produce the correct output:

  struct foo {
int i;
  
  private:
int j;
  }

So it seems that insertion of empty line fails when access modifier is in the 
same line as previous tokens. Unmodified clang-format produces the same output. 
As this behavior is not related to the changes in my patch, should we attempt 
to fix it here, or a separate bug report would be preferred?

The situation with tests containing comments is similar, because 
**test::messUp** single line output is formatted into:

  struct foo { /* comment */
  private:
int i;
int j;
  }

which is not the same as:

  struct foo {
/* comment */
  private:
int i;
int j;
  }

In my opinion, Objective-C++ **test::messUp** test incorrectly expects any code 
collapsed into a single line to format into the same code as formatted original 
code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93846/new/

https://reviews.llvm.org/D93846

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


[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2020-12-31 Thread Hongtao Yu via Phabricator via cfe-commits
hoy updated this revision to Diff 314200.
hoy marked an inline comment as done.
hoy added a comment.

Adding a test for the new pseudo probe test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93656/new/

https://reviews.llvm.org/D93656

Files:
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/test/Other/new-pm-pseudo-probe.ll
  llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -133,6 +133,13 @@
 static cl::opt DebugInfoForProfiling(
 "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden,
 cl::desc("Emit special debug info to enable PGO profile generation."));
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));
+static cl::opt UniqueInternalLinkageNames(
+"new-pm-unique-internal-linkage-names", cl::init(false), cl::Hidden,
+cl::desc("Uniqueify Internal Linkage Symbol Names by appending the MD5 "
+ "hash of the module path."));
 /// @}}
 
 template 
@@ -246,6 +253,9 @@
 if (DebugInfoForProfiling)
   P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
  true);
+else if (PseudoProbeForProfiling)
+  P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
+ false, true);
 else
   P = None;
   }
@@ -281,6 +291,7 @@
   // option has been enabled.
   PTO.LoopUnrolling = !DisableLoopUnrolling;
   PTO.Coroutines = Coroutines;
+  PTO.UniqueLinkageNames = UniqueInternalLinkageNames;
   PassBuilder PB(DebugPM, TM, PTO, P, );
   registerEPCallbacks(PB);
 
Index: llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
===
--- /dev/null
+++ llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
@@ -0,0 +1,23 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O0 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+
+define internal i32 @foo() {
+entry:
+  ret i32 0
+}
+
+define dso_local i32 (...)* @bar() {
+entry:
+  ret i32 (...)* bitcast (i32 ()* @foo to i32 (...)*)
+}
+
+; O0: Running pass: UniqueInternalLinkageNamesPass
+
+; O2: Running pass: UniqueInternalLinkageNamesPass
+; O2: Running pass: SampleProfileProbePass
+
+; UNIQUE: define internal i32 @foo.__uniq.{{[0-9a-f]+}}()
+; UNIQUE: ret {{.*}} @foo.__uniq.{{[0-9a-f]+}} {{.*}}
Index: llvm/test/Other/new-pm-pseudo-probe.ll
===
--- /dev/null
+++ llvm/test/Other/new-pm-pseudo-probe.ll
@@ -0,0 +1,10 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+
+define void @foo() {
+  ret void
+}
+
+; CHECK: Running pass: SampleProfileProbePass
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -284,6 +284,7 @@
   LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
   CallGraphProfile = true;
   MergeFunctions = false;
+  UniqueLinkageNames = false;
 }
 
 extern cl::opt EnableConstraintElimination;
@@ -1001,6 +1002,11 @@
ThinLTOPhase Phase) {
   ModulePassManager MPM(DebugLogging);
 
+  // Add UniqueInternalLinkageNames Pass which renames internal linkage
+  // symbols with unique 

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2020-12-31 Thread Hongtao Yu via Phabricator via cfe-commits
hoy marked an inline comment as done.
hoy added inline comments.



Comment at: llvm/tools/opt/NewPMDriver.cpp:136-138
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));

dblaikie wrote:
> aeubanks wrote:
> > hoy wrote:
> > > dblaikie wrote:
> > > > I guess this should probably have some separate testing, if it's a 
> > > > separate flag/feature? (& flag+tests could be in a separate commit)
> > > I'm not sure there's a separate need for this switch except for being 
> > > tested in `unique-internal-linkage-names.ll`. The point of this whole 
> > > patch is to place the unique name pass before the pseudo probe pass and 
> > > test it works. Hence it sounds appropriate to me to include all changes 
> > > in one patch. What do you think?
> > +1 to hoy's comment. I don't think there's a need to make patches strictly 
> > as incremental as possible if they're already small. (I would have been 
> > okay with keeping the Clang change here FWIW)
> I understand I'm a bit of a stickler for some of this stuff - though the 
> particular reason I brought it up here is that this adds two flags, but 
> doesn't test them separately, only together. So it's not clear/tested as to 
> which behaviors are provided by which flags.
> 
> Separating the flags would make it clear that each flag/functionality was 
> tested fully.
> 
> Please add test coverage for each flag separately, optionally separate this 
> into two patches to make it clearer how each piece of functionality is tested.
Sounds good, a separate test added for the pseudo probe flag.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93656/new/

https://reviews.llvm.org/D93656

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/test/Misc/loop-opt-setup.c:1
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release 
mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s

Most tests use %clang_cc1 for relatively stable flag behavior so this comment 
is not needed.

The comment should mention the purpose of this test and probably why -O1 is 
used.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Atmn Patel via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a65b8c739a0: [Clang][Misc] Change run line in fragile test 
(authored by adpatel6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

Files:
  clang/test/Misc/loop-opt-setup.c


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release 
mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1a65b8c - [Clang][Misc] Change run line in fragile test

2020-12-31 Thread via cfe-commits

Author: Atmn
Date: 2020-12-31T13:48:21-05:00
New Revision: 1a65b8c739a09c587fb55ef4d2d7def13718111c

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

LOG: [Clang][Misc] Change run line in fragile test

This test has %clang in the run line when it should have %clang_cc1.
This should prevent future release test failures.

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

Added: 


Modified: 
clang/test/Misc/loop-opt-setup.c

Removed: 




diff  --git a/clang/test/Misc/loop-opt-setup.c 
b/clang/test/Misc/loop-opt-setup.c
index c5c2ec4fda84..9cea02a8bcb3 100644
--- a/clang/test/Misc/loop-opt-setup.c
+++ b/clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release 
mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;



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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 314195.
atmnpatel added a comment.

Better?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

Files:
  clang/test/Misc/loop-opt-setup.c


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release 
mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// This relies on %clang_cc1, %clang does not emit the block names in Release mode.
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D93952#2475762 , @atmnpatel wrote:

> Ah I see, I was never able to find clear documentation on what exactly the 
> -cc1 flag does other than the conceptual description. This should fix it 
> right?

-cc1 options are implementation details and are unstable. Driver options need 
to be more stable and usually cannot be removed.

Ah I forgot that the driver option's default `-f[no-]discard-value-names` is 
dependent on `-DLLVM_ENABLE_ASSERTIONS`.

Can you also update the summary of this Diff and add a file-level comment to 
the test?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

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


[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2020-12-31 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added a comment.

In D86844#2475552 , @xbolva00 wrote:

> Do you plan to implement gcc’s option in Clang as followup?

I was not planning on it but I can if no one is planning on it and doesn't mind 
waiting a bit.

Also, clang/test/Misc/loop-opt-setup.c had a bad run line, it's being fixed in 
D93952 , and I'll try to land it again after 
that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86844/new/

https://reviews.llvm.org/D86844

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 314193.
atmnpatel added a comment.

Ah I see, I was never able to find clear documentation on what exactly the -cc1 
flag does other than the conceptual description. This should fix it right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

Files:
  clang/test/Misc/loop-opt-setup.c


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,4 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,4 @@
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
 
 extern int a[16];
 int b = 0;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-31 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

Looks good to me, just some grammar nitpicks from my side.

(I only discovered the "Suggest Edit" feature halfway through the review; I 
didn't update the comments I already made as I'm not sure in which format you 
prefer them?)




Comment at: clang/docs/OpenCLSupport.rst:34
 
-Bugzilla bugs for this functionality are typically prefixed
-with '[C++]'.
+Clang implements the language version 1.0 published in `the official
+release of C++ for OpenCL Documentation





Comment at: clang/docs/OpenCLSupport.rst:47-48
 
-- Use of ObjC blocks is disabled.
-
-- Global destructor invocation is not generated correctly.
-
-- Initialization of objects in `__constant` address spaces is not guaranteed 
to work.
-
-- `addrspace_cast` operator is not supported.
+- Use of ObjC blocks is disabled and therefore there is no support of
+  `enqueue_kernel` builtin function at present.   It is expected that
+  if support for this feature is added in the future, it will utilize

the `enqueue_kernel` builtin function is not supported



Comment at: clang/docs/OpenCLSupport.rst:50
+  if support for this feature is added in the future, it will utilize
+  C++ lamdas instead of ObjC blocks.
+

lambdas



Comment at: clang/docs/OpenCLSupport.rst:52
+
+- IR generation for global destructor is incomplete (See:
+  `PR48047 `_).

destructors



Comment at: clang/docs/OpenCLSupport.rst:63
+
+The following table provides overview of features in OpenCL C 3.0 and their
+implementation status. 





Comment at: clang/docs/UsersManual.rst:2828
 
-This will produce a generic test.bc file that can be used in vendor toolchains
+This will produce test.bc file that can be used in vendor toolchains
 to perform machine code generation.

Drop "file", or say "... produce a file test.bc that ..."



Comment at: clang/docs/UsersManual.rst:2832
+Note that if compiled to bitcode for generic targets such as SPIR,
+portable IR is produced i.e. it can be used with various vendor
+tools as well as open source tools such as `SPIRV-LLVM Translator





Comment at: clang/docs/UsersManual.rst:2839
+Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
+supports full profile, there is only very limited support of the embedded
+profile. 

Full stop. New sentence.



Comment at: clang/docs/UsersManual.rst:3057
 
-Declaring the same types in different vendor extensions is disallowed.
+There is no conflict resolution for identifiers clash among extensions.
+It is therefore recommended that the identifiers are prefixed with the

identifier clashes



Comment at: clang/docs/UsersManual.rst:3058
+There is no conflict resolution for identifiers clash among extensions.
+It is therefore recommended that the identifiers are prefixed with the
+double underscore to avoid clashing with user space identifiers. Vendor





Comment at: clang/docs/UsersManual.rst:3242
 
-Since C++ features are to be used on top of OpenCL C functionality, all 
existing
-restrictions from OpenCL C v2.0 will inherently apply. All OpenCL C builtin 
types
-and function libraries are supported and can be used in this mode.
+Clang currently support the C++ for OpenCL v1.0.
+For detailed information about this language refer to the C++ for OpenCL




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93942/new/

https://reviews.llvm.org/D93942

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


[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-31 Thread Marco Antognini via Phabricator via cfe-commits
mantognini added a comment.

Thanks for the update. Looks good overall. A minor question about backticks. 
I'm no native English speaker, so I would recommend a second review from 
someone else too.




Comment at: clang/docs/OpenCLSupport.rst:69
++==+==+==+===+
+| Command line interface   | New value for `-cl-std` flag  
   | :good:`done` | https://reviews.llvm.org/D88300 
  |
++--+--+--+---+

Double backticks?



Comment at: clang/docs/UsersManual.rst:2877
+
+Alternatively the internal header `opencl-c.h` containing the declarations
+can be included manually using ``-include`` or ``-I`` followed by the path

Do you also need to use double back-ticks here? I don't remember.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93942/new/

https://reviews.llvm.org/D93942

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


[PATCH] D93822: [clang][Sema] Add diagnostics for implicit widening of multiplication result

2020-12-31 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: 
clang/test/Sema/implicit-widening-of-pointer-offset-in-array-subscript-expression.c:24
+void t1(char *base, int a, int b) {
+  // FIXME: test `[a * b]base` pattern?
+}

dblaikie wrote:
> lebedev.ri wrote:
> > dblaikie wrote:
> > > lebedev.ri wrote:
> > > > dblaikie wrote:
> > > > > Question is unclear - is there uncertainty about whether this should 
> > > > > be tested? Or is this a false negative case? In which case I'd 
> > > > > probably include the test showing no diagnostic and mention it could 
> > > > > be fixed/improved?
> > > > I may be misremembering things, but IIRC `a[b]` and `b[a]` is the same 
> > > > thing,
> > > > but i'm not sure how to exercise the second spelling.
> > > > I.e. i'm just not sure how to write a test for it.
> > > > I may be misremembering things, but IIRC a[b] and b[a] is the same 
> > > > thing,
> > > Yep, that's the case - `a[b]` where one of them is a pointer and teh 
> > > other is an integer, is equivalent to `*(a + b)`, so that means it's the 
> > > same as `b[a]`.
> > > 
> > > I guess you'd write it the same as t0, but with the expressions reversed? 
> > > `return *(a * b)[base];`
> > That's what i tried, and it does't work - https://godbolt.org/z/as4vP4
> Sorry, my mistake - the `*` was wrong. This works: 
> https://godbolt.org/z/j9jqx3
Aha, thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93822/new/

https://reviews.llvm.org/D93822

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


[PATCH] D93822: [clang][Sema] Add diagnostics for implicit widening of multiplication result

2020-12-31 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 314188.
lebedev.ri marked 3 inline comments as done.
lebedev.ri added a comment.

- Add test for inverse array subscript expression
- Support it by skipping paren expressions
- Actually ensure that we only diagnose only truly implicit casts, but not 
implicit casts that are implicit steps of an explicit cast


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93822/new/

https://reviews.llvm.org/D93822

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Misc/warning-wall.c
  clang/test/Sema/implicit-widening-of-multiplication-result.c
  
clang/test/Sema/implicit-widening-of-pointer-offset-in-array-subscript-expression.c
  clang/test/Sema/implicit-widening-of-pointer-offset.c

Index: clang/test/Sema/implicit-widening-of-pointer-offset.c
===
--- /dev/null
+++ clang/test/Sema/implicit-widening-of-pointer-offset.c
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck --implicit-check-not="fix-it" %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify -x c++ %s
+
+// RUN: %clang_cc1 -triple i686-linux-gnu   -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify=silent %s
+// RUN: %clang_cc1 -triple i686-linux-gnu   -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify=silent -x c++ %s
+
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-conversion -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify=silent %s
+
+// silent-no-diagnostics
+
+char *t0(char *base, int a, int b) {
+  return base + a * b; // #0
+  // expected-warning@#0 {{result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'}}
+  // expected-note@#0 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(ssize_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#0 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(ssize_t)"
+}
+char *t1(char *base, int a, int b) {
+  return a * b + base; // #1
+  // expected-warning@#1 {{result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'}}
+  // expected-note@#1 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:10}:"(ssize_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:14-[[@LINE-4]]:14}:")"
+  // expected-note@#1 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:10-[[@LINE-6]]:10}:"(ssize_t)"
+}
+
+char *t2(char *base, unsigned int a, int b) {
+  return base + a * b; // #2
+  // expected-warning@#2 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#2 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#2 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(size_t)"
+}
+
+char *t3(char *base, int a, unsigned int b) {
+  return base + a * b; // #3
+  // expected-warning@#3 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#3 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#3 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(size_t)"
+}
+
+char *t4(char *base, unsigned int a, unsigned int b) {
+  return base + a * b; // #4
+  // expected-warning@#4 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#4 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // 

[PATCH] D93958: [OpenCL] Restrict pointer to member functions

2020-12-31 Thread Marco Antognini via Phabricator via cfe-commits
mantognini accepted this revision.
mantognini added a comment.
This revision is now accepted and ready to land.

lgtm, thanks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93958/new/

https://reviews.llvm.org/D93958

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


[PATCH] D93958: [OpenCL] Restrict pointer to member functions

2020-12-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added a reviewer: mantognini.
Herald added subscribers: ebevhan, yaxunl.
Anastasia requested review of this revision.

OpenCL doesn't allow function pointers and therefore pointers to member 
functions are to be restricted too.

Even if this C++ feature provides more insight of the function that might be 
pointed too it inherited the same fundamental issue - can lead to the divergent 
execution of big fragments of code that are very inefficient.


https://reviews.llvm.org/D93958

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaOpenCLCXX/members.cl


Index: clang/test/SemaOpenCLCXX/members.cl
===
--- /dev/null
+++ clang/test/SemaOpenCLCXX/members.cl
@@ -0,0 +1,22 @@
+//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only
+
+// Check that pointer to member functions are diagnosed
+struct C {
+  void f(int n);
+};
+
+typedef void (C::*p_t)(int);
+
+template  struct remove_reference { typedef T type; };
+template  struct remove_reference { typedef T type; };
+
+template 
+void templ_test() {
+  typename remove_reference::type *ptr; //expected-error{{pointers to 
functions are not allowed}}
+}
+
+void test() {
+  void (C::*p)(int);   //expected-error{{pointers to functions are not 
allowed}}
+  p_t p1;  //expected-error{{pointers to functions are not 
allowed}}
+  templ_test(); //expected-note{{in instantiation of function 
template specialization}}
+}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -6748,8 +6748,8 @@
 
   // OpenCL v1.0 s6.8.a.3: Pointers to functions are not allowed.
   QualType NR = R;
-  while (NR->isPointerType()) {
-if (NR->isFunctionPointerType()) {
+  while (NR->isPointerType() || NR->isMemberFunctionPointerType()) {
+if (NR->isFunctionPointerType() || NR->isMemberFunctionPointerType()) {
   Se.Diag(D.getIdentifierLoc(), diag::err_opencl_function_pointer);
   D.setInvalidType();
   return false;


Index: clang/test/SemaOpenCLCXX/members.cl
===
--- /dev/null
+++ clang/test/SemaOpenCLCXX/members.cl
@@ -0,0 +1,22 @@
+//RUN: %clang_cc1 %s -triple spir -cl-std=clc++ -verify -fsyntax-only
+
+// Check that pointer to member functions are diagnosed
+struct C {
+  void f(int n);
+};
+
+typedef void (C::*p_t)(int);
+
+template  struct remove_reference { typedef T type; };
+template  struct remove_reference { typedef T type; };
+
+template 
+void templ_test() {
+  typename remove_reference::type *ptr; //expected-error{{pointers to functions are not allowed}}
+}
+
+void test() {
+  void (C::*p)(int);   //expected-error{{pointers to functions are not allowed}}
+  p_t p1;  //expected-error{{pointers to functions are not allowed}}
+  templ_test(); //expected-note{{in instantiation of function template specialization}}
+}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -6748,8 +6748,8 @@
 
   // OpenCL v1.0 s6.8.a.3: Pointers to functions are not allowed.
   QualType NR = R;
-  while (NR->isPointerType()) {
-if (NR->isFunctionPointerType()) {
+  while (NR->isPointerType() || NR->isMemberFunctionPointerType()) {
+if (NR->isFunctionPointerType() || NR->isMemberFunctionPointerType()) {
   Se.Diag(D.getIdentifierLoc(), diag::err_opencl_function_pointer);
   D.setInvalidType();
   return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:8544
+TEST_F(FormatTest, FormatsAccessModifiers) {
+  EXPECT_EQ("struct foo {\n"
+"  int i;\n"

any reason this can't be verifyFormat?



Comment at: clang/unittests/Format/FormatTest.cpp:8565
+   "}\n");
+  EXPECT_EQ("struct foo {\n"
+"  int i;\n"

verifyFormat? why not


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93846/new/

https://reviews.llvm.org/D93846

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


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

ok so this looks ok, but before we commit can we have a discussion about why 
you think it fails for the comment case?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93846/new/

https://reviews.llvm.org/D93846

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Take the following example:

  enum { A, B, C, D, E, F, G, H, I } Short;



  And the following minimal .clang-format
  ---
  ColumnLimit: 10
  BreakBeforeBraces: Custom
  BraceWrapping:
  AfterEnum: true

To use AfterEnum you must be using "Custom" for BreakBeforeBraces, the result is

  enum
  {
A,
B,
C,
D,
E,
F,
G,
H,
I
  } Short;

changer AfterEnum to false and you have

  enum {
A,
B,
C,
D,
E,
F,
G,
H,
I
  } Short;

Could you explain using this example what you think is wrong and why? what do 
you expect to see?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I think if you think you have a bug that you log it in the bug tracker and we 
track it with this issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938

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


[PATCH] D92445: [PowerPC] Add powerpcle target. (5/5)

2020-12-31 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92445/new/

https://reviews.llvm.org/D92445

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


[PATCH] D92445: [PowerPC] Add powerpcle target. (5/5)

2020-12-31 Thread Brandon Bergren via Phabricator via cfe-commits
Bdragon28 updated this revision to Diff 314052.
Bdragon28 added a comment.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Add missing OpenMP TLS test for powerpcle.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92445/new/

https://reviews.llvm.org/D92445

Files:
  clang/test/Driver/ppc-features.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPContext.cpp


Index: llvm/lib/Frontend/OpenMP/OMPContext.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -40,6 +40,7 @@
   case Triple::mips64:
   case Triple::mips64el:
   case Triple::ppc:
+  case Triple::ppcle:
   case Triple::ppc64:
   case Triple::ppc64le:
   case Triple::x86:
Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -1033,6 +1033,7 @@
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_be)
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_32)
 __OMP_TRAIT_PROPERTY(device, arch, ppc)
+__OMP_TRAIT_PROPERTY(device, arch, ppcle)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64le)
 __OMP_TRAIT_PROPERTY(device, arch, x86)
Index: clang/test/Driver/ppc-features.cpp
===
--- clang/test/Driver/ppc-features.cpp
+++ clang/test/Driver/ppc-features.cpp
@@ -167,6 +167,7 @@
 
 // OpenMP features
 // RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
+// RUN: %clang -target powerpcle-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp 
-o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls"


Index: llvm/lib/Frontend/OpenMP/OMPContext.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -40,6 +40,7 @@
   case Triple::mips64:
   case Triple::mips64el:
   case Triple::ppc:
+  case Triple::ppcle:
   case Triple::ppc64:
   case Triple::ppc64le:
   case Triple::x86:
Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -1033,6 +1033,7 @@
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_be)
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_32)
 __OMP_TRAIT_PROPERTY(device, arch, ppc)
+__OMP_TRAIT_PROPERTY(device, arch, ppcle)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64le)
 __OMP_TRAIT_PROPERTY(device, arch, x86)
Index: clang/test/Driver/ppc-features.cpp
===
--- clang/test/Driver/ppc-features.cpp
+++ clang/test/Driver/ppc-features.cpp
@@ -167,6 +167,7 @@
 
 // OpenMP features
 // RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
+// RUN: %clang -target powerpcle-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92445: [PowerPC] Add powerpcle target.

2020-12-31 Thread Brandon Bergren via Phabricator via cfe-commits
Bdragon28 added a reviewer: q66.
Bdragon28 added a comment.

Add q66 to reviewers list for the targeting bits relevant to Void ppcle.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92445/new/

https://reviews.llvm.org/D92445

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


[PATCH] D92445: [PowerPC] Add powerpcle target.

2020-12-31 Thread Brandon Bergren via Phabricator via cfe-commits
Bdragon28 updated this revision to Diff 313931.
Bdragon28 added a comment.

- Fix LLVM object handling unit test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92445/new/

https://reviews.llvm.org/D92445

Files:
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/altivec.c
  clang/test/CodeGen/builtins-ppc-altivec.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/target-data.c
  clang/test/Driver/linux-header-search.cpp
  clang/test/Driver/ppc-endian.c
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/ScriptParser.cpp
  lld/test/ELF/emulation-ppc.s
  lld/test/ELF/ppc32-gnu-ifunc.s
  lld/test/ELF/ppc32-reloc-rel.s
  llvm/cmake/config.guess
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  llvm/lib/Frontend/OpenMP/OMPContext.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
  llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCSubtarget.cpp
  llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
  llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
  llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.h
  llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test
  llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
  llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
  llvm/unittests/ADT/TripleTest.cpp
  llvm/unittests/Object/ELFObjectFileTest.cpp

Index: llvm/unittests/Object/ELFObjectFileTest.cpp
===
--- llvm/unittests/Object/ELFObjectFileTest.cpp
+++ llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -174,7 +174,7 @@
 }
 
 TEST(ELFObjectFileTest, MachineTestForPPC) {
-  std::array Formats = {"elf32-powerpc", "elf32-powerpc",
+  std::array Formats = {"elf32-powerpcle", "elf32-powerpc",
   "elf64-unknown", "elf64-unknown"};
   size_t I = 0;
   for (const DataForTest  : generateData(ELF::EM_PPC))
Index: llvm/unittests/ADT/TripleTest.cpp
===
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -,7 +,7 @@
 
   T.setArch(Triple::ppc);
   EXPECT_EQ(Triple::ppc, T.getBigEndianArchVariant().getArch());
-  EXPECT_EQ(Triple::UnknownArch, T.getLittleEndianArchVariant().getArch());
+  EXPECT_EQ(Triple::ppcle, T.getLittleEndianArchVariant().getArch());
 
   T.setArch(Triple::ppc64);
   EXPECT_EQ(Triple::ppc64, T.getBigEndianArchVariant().getArch());
Index: llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
===
--- llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
+++ llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
@@ -1,11 +1,14 @@
-# RUN: llvm-mc -triple=powerpc -filetype=obj %s -o %t.32.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.32.o | FileCheck --check-prefixes=ELF32,CHECK %s
+# RUN: llvm-mc -triple=powerpc -filetype=obj %s -o %t.32be.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.32be.o | FileCheck --check-prefixes=ELF32,CHECK %s
 
-# RUN: llvm-mc -triple=powerpc64le -filetype=obj %s -o %t.64.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.64.o | FileCheck --check-prefixes=ELF64,CHECK %s
+# RUN: llvm-mc -triple=powerpcle -filetype=obj %s -o %t.32le.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.32le.o | FileCheck --check-prefixes=ELF32,CHECK %s
 
-# RUN: llvm-mc -triple=powerpc64 -filetype=obj %s -o %t.64.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.64.o | FileCheck --check-prefixes=ELF64,CHECK %s
+# RUN: llvm-mc -triple=powerpc64 -filetype=obj %s -o %t.64be.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.64be.o | FileCheck --check-prefixes=ELF64,CHECK %s
+
+# RUN: llvm-mc -triple=powerpc64le -filetype=obj %s -o %t.64le.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.64le.o | FileCheck --check-prefixes=ELF64,CHECK %s
 
 # CHECK-LABEL: :
 # ELF32-NEXT:   bl 0xfffc
Index: llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test

[PATCH] D92445: [PowerPC] Add powerpcle target.

2020-12-31 Thread Brandon Bergren via Phabricator via cfe-commits
Bdragon28 updated this revision to Diff 313930.
Bdragon28 added a comment.
Herald added a subscriber: mgorny.

- Fix bug in clang/test/Driver/linux-header-search.cpp -- The powerpc64le test 
was being done with -m32 accidentally.
- Update llvm/unittests/ADT/TripleTest.cpp for powerpcle.
- Update gcc driver bits to reflect use of powerpcle in void-ppc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92445/new/

https://reviews.llvm.org/D92445

Files:
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/altivec.c
  clang/test/CodeGen/builtins-ppc-altivec.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/target-data.c
  clang/test/Driver/linux-header-search.cpp
  clang/test/Driver/ppc-endian.c
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/ScriptParser.cpp
  lld/test/ELF/emulation-ppc.s
  lld/test/ELF/ppc32-gnu-ifunc.s
  lld/test/ELF/ppc32-reloc-rel.s
  llvm/cmake/config.guess
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  llvm/lib/Frontend/OpenMP/OMPContext.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
  llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCSubtarget.cpp
  llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
  llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
  llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.h
  llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test
  llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
  llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
  llvm/unittests/ADT/TripleTest.cpp

Index: llvm/unittests/ADT/TripleTest.cpp
===
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -,7 +,7 @@
 
   T.setArch(Triple::ppc);
   EXPECT_EQ(Triple::ppc, T.getBigEndianArchVariant().getArch());
-  EXPECT_EQ(Triple::UnknownArch, T.getLittleEndianArchVariant().getArch());
+  EXPECT_EQ(Triple::ppcle, T.getLittleEndianArchVariant().getArch());
 
   T.setArch(Triple::ppc64);
   EXPECT_EQ(Triple::ppc64, T.getBigEndianArchVariant().getArch());
Index: llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
===
--- llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
+++ llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s
@@ -1,11 +1,14 @@
-# RUN: llvm-mc -triple=powerpc -filetype=obj %s -o %t.32.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.32.o | FileCheck --check-prefixes=ELF32,CHECK %s
+# RUN: llvm-mc -triple=powerpc -filetype=obj %s -o %t.32be.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.32be.o | FileCheck --check-prefixes=ELF32,CHECK %s
 
-# RUN: llvm-mc -triple=powerpc64le -filetype=obj %s -o %t.64.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.64.o | FileCheck --check-prefixes=ELF64,CHECK %s
+# RUN: llvm-mc -triple=powerpcle -filetype=obj %s -o %t.32le.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.32le.o | FileCheck --check-prefixes=ELF32,CHECK %s
 
-# RUN: llvm-mc -triple=powerpc64 -filetype=obj %s -o %t.64.o
-# RUN: llvm-objdump -d --no-show-raw-insn %t.64.o | FileCheck --check-prefixes=ELF64,CHECK %s
+# RUN: llvm-mc -triple=powerpc64 -filetype=obj %s -o %t.64be.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.64be.o | FileCheck --check-prefixes=ELF64,CHECK %s
+
+# RUN: llvm-mc -triple=powerpc64le -filetype=obj %s -o %t.64le.o
+# RUN: llvm-objdump -d --no-show-raw-insn %t.64le.o | FileCheck --check-prefixes=ELF64,CHECK %s
 
 # CHECK-LABEL: :
 # ELF32-NEXT:   bl 0xfffc
Index: llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
===
--- llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
+++ llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
@@ -34,25 +34,25 @@
 # RUN: llvm-readobj --file-headers %t.elf64_littleaarch64.dwo | FileCheck %s --check-prefixes=CHECK,LE,AARCH,64,SYSV
 
 # RUN: llvm-objcopy %t.o -O elf32-powerpc 

[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia marked an inline comment as done.
Anastasia added inline comments.



Comment at: clang/docs/UsersManual.rst:2864-2868
+Adds builtin function declarations during compilations. By default
+the OpenCL headers are not loaded and therefore the builtin functions
+ are not declared. To load them automatically this flag can be
+passed to the frontend (see also :ref:`the section on the OpenCL Header
+`):

mantognini wrote:
> This also applies to types I believe (e.g. int2). Maybe this paragraph should 
> be slightly altered to reflect this?
Good point. I added types in too.

The header contains only a few types but mainly functions but vector types are 
important for example. Although they should have been native keywords and they 
were until some refactoring was made.



Comment at: clang/docs/UsersManual.rst:2894
 
-Disables support of OpenCL extensions. All OpenCL targets provide a list
+Disables support of OpenCL extensions. All OpenCL targets set a list
 of extensions that they support. Clang allows to amend this using the 
``-cl-ext``

mantognini wrote:
> I feel "provide" was slightly better.
True, now that I think about this from the user's perspective it's a better 
wording indeed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93942/new/

https://reviews.llvm.org/D93942

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


[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 314184.
Anastasia added a comment.

Addressed comments from Marco.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93942/new/

https://reviews.llvm.org/D93942

Files:
  clang/docs/OpenCLSupport.rst
  clang/docs/UsersManual.rst

Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -41,7 +41,8 @@
variants depending on base language.
 -  :ref:`C++ Language `
 -  :ref:`Objective C++ Language `
--  :ref:`OpenCL C Language `: v1.0, v1.1, v1.2, v2.0.
+-  :ref:`OpenCL Kernel Language `: OpenCL C v1.0, v1.1, v1.2, v2.0,
+   plus C++ for OpenCL.
 
 In addition to these base languages and their dialects, Clang supports a
 broad variety of language extensions, which are documented in the
@@ -2796,8 +2797,8 @@
 ===
 
 Clang can be used to compile OpenCL kernels for execution on a device
-(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMD or
-Nvidia targets) that can be uploaded to run directly on a device (e.g. using
+(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMDGPU)
+that can be uploaded to run directly on a device (e.g. using
 `clCreateProgramWithBinary
 `_) or
 into generic bitcode files loadable into other toolchains.
@@ -2824,13 +2825,26 @@
 
  $ clang -c -emit-llvm test.cl
 
-This will produce a generic test.bc file that can be used in vendor toolchains
+This will produce test.bc file that can be used in vendor toolchains
 to perform machine code generation.
 
-Clang currently supports OpenCL C language standards up to v2.0. Starting from
-clang 9 a C++ mode is available for OpenCL (see
+Note that if compiled to bitcode for generic targets such as SPIR,
+portable IR is produced i.e. it can be used with various vendor
+tools as well as open source tools such as `SPIRV-LLVM Translator
+`_
+to produce SPIR-V binary.
+
+
+Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
+supports full profile, there is only very limited support of the embedded
+profile. 
+Starting from clang 9 a C++ mode is available for OpenCL (see
 :ref:`C++ for OpenCL `).
 
+There is ongoing support for OpenCL v3.0 that is documented along with other
+experimental functionality and features in development on :doc:`OpenCLSupport`
+page.
+
 OpenCL Specific Options
 ---
 
@@ -2847,24 +2861,31 @@
 
 .. option:: -finclude-default-header
 
-Loads standard includes during compilations. By default OpenCL headers are not
-loaded and therefore standard library includes are not available. To load them
-automatically a flag has been added to the frontend (see also :ref:`the section
-on the OpenCL Header `):
+Adds most of builtin types and function declarations during compilations. By
+default the OpenCL headers are not loaded and therefore certain builtin
+types and most of builtin functions are not declared. To load them
+automatically this flag can be passed to the frontend (see also :ref:`the
+section on the OpenCL Header `):
 
.. code-block:: console
 
  $ clang -Xclang -finclude-default-header test.cl
 
-Alternatively ``-include`` or ``-I`` followed by the path to the header location
-can be given manually.
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend, e.g. ``-cc1`` or ``-Xclang``.
+
+Alternatively the internal header `opencl-c.h` containing the declarations
+can be included manually using ``-include`` or ``-I`` followed by the path
+to the header location. The header can be found in the clang source tree or
+installation directory.
 
.. code-block:: console
 
- $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/clang//include/opencl-c.h/opencl-c.h test.cl
 
-In this case the kernel code should contain ``#include `` just as a
-regular C include.
+In this example it is assumed that the kernel code contains
+``#include `` just as a regular C include.
 
 .. _opencl_cl_ext:
 
@@ -2874,10 +2895,14 @@
 of extensions that they support. Clang allows to amend this using the ``-cl-ext``
 flag with a comma-separated list of extensions prefixed with ``'+'`` or ``'-'``.
 The syntax: ``-cl-ext=<(['-'|'+'][,])+>``,  where extensions
-can be either one of `the OpenCL specification extensions
-`_
-or any known vendor extension. Alternatively, ``'all'`` can be used to enable
+can be either one of `the OpenCL published extensions
+`_
+or any vendor extension. Alternatively, ``'all'`` can be used to enable
 or disable all known extensions.
+
+Note that this is a frontend-only flag and therefore it requires 

[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-31 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D93952#2475526 , @atmnpatel wrote:

> I can't say that I know with any certainty, I'm too inexperienced. This 
> failure was missed by me locally, the pre-merge bot, and by most of the 
> buildbots other than the ones I mentioned above. I have no idea under what 
> configuration of CMake options will clang not emit this particular case of a 
> label for a BB.

The problem is that this test is using `%clang` instead of `%clang_cc1`. 
Executing `clang` directly will pass `-fdiscard-value-names` when built with 
release mode; all blocks/values will be numbered, instead of explicitly named. 
It would be better to update the test to use `%clang_cc1`, to make it 
independent on flags passed depending on configuration of clang.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93952/new/

https://reviews.llvm.org/D93952

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


[PATCH] D91348: [OpenCL] Warn about side effects for unevaluated vec_step arg

2020-12-31 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

In D91348#2475646 , @Anastasia wrote:

> LGTM, the change seems reasonable. Thanks!
>
>> A minor side-effect of this change is that it also produces the
>> warning for co_await and co_yield now.
>
> This warning is produced for **sizeof** and it seems like a duplication of 
> another diagnostic that occurs for this case.

It aligns the note diagnostics for `sizeof` and `vec_step` for this case indeed.

> Btw just a suggestion - it is better to upload a full diff because the 
> regular diff is not reliable in the Phabricator as line numbers change 
> quickly in the repository and there is no information on the parent commit 
> for the patch.

Apologies, I normally do so but forgot to provide the full context this time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91348/new/

https://reviews.llvm.org/D91348

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


[PATCH] D93956: Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"

2020-12-31 Thread Shaurya Gupta via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8bee4d4e8f54: Revert [LoopDeletion] Allows deletion of 
possibly infinite side-effect free… (authored by bgraur, committed by 
SureYeaah).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93956/new/

https://reviews.llvm.org/D93956

Files:
  clang/test/Misc/loop-opt-setup.c
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopDeletion/mustprogress.ll
  llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll

Index: llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
===
--- llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
+++ llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
@@ -5,7 +5,14 @@
 ; CHECK: Function Attrs: mustprogress
 ; CHECK-LABEL: define {{[^@]+}}@f
 ; CHECK-SAME: () [[ATTR0:#.*]] {
-; CHECK-NEXT:unreachable
+; CHECK-NEXT:br label [[TMP1:%.*]]
+; CHECK:   1:
+; CHECK-NEXT:[[DOT01:%.*]] = phi i32 [ 1, [[TMP0:%.*]] ], [ [[TMP3:%.*]], [[TMP2:%.*]] ]
+; CHECK-NEXT:[[DOT0:%.*]] = phi i32 [ 1, [[TMP0]] ], [ [[TMP3]], [[TMP2]] ]
+; CHECK-NEXT:br label [[TMP2]]
+; CHECK:   2:
+; CHECK-NEXT:[[TMP3]] = add nsw i32 [[DOT01]], [[DOT0]]
+; CHECK-NEXT:br label [[TMP1]]
 ;
   br label %1
 
Index: llvm/test/Transforms/LoopDeletion/mustprogress.ll
===
--- llvm/test/Transforms/LoopDeletion/mustprogress.ll
+++ /dev/null
@@ -1,237 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
-; RUN: opt < %s -loop-deletion -verify-dom-info -S | FileCheck %s
-
-;; Original C Code:
-;;  void unknown_tripcount_mustprogress_attr_mustprogress_loopmd(int a, int b) {
-;;for (; a < b;) ;
-;;for (;;) ;
-;;  }
-
-define void @unknown_tripcount_mustprogress_attr_mustprogress_loopmd(i32 %a, i32 %b) #0 {
-; CHECK: Function Attrs: mustprogress
-; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_mustprogress_loopmd
-; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]] {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:unreachable
-;
-entry:
-  br label %for.cond
-for.cond:
-  %cmp = icmp slt i32 %a, %b
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.cond, !llvm.loop !2
-for.end:
-  br label %for.cond1
-for.cond1:
-  br label %for.cond1
-}
-
-;; Original C Code:
-;;  void unknown_tripcount_mustprogress_attr_no_mustprogress_loopmd(int a, int b) {
-;;for (; a < b;) ;
-;;for (;;) ;
-;;  }
-;;  => Removed mustprogress loop attribute
-
-define void @unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd(i32 %a, i32 %b) #0 {
-; CHECK: Function Attrs: mustprogress
-; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd
-; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0]] {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:unreachable
-;
-entry:
-  br label %for.cond
-for.cond:
-  %cmp = icmp slt i32 %a, %b
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.cond
-for.end:
-  br label %for.cond1
-for.cond1:
-  br label %for.cond1
-}
-
-;; Original C Code:
-;;  void known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-;;for (int i = 0; i < 5; i++) ;
-;;  }
-
-define void @known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:ret void
-;
-entry:
-  br label %for.cond
-for.cond:
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
-  %cmp = icmp slt i32 %i.0, 5
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.inc
-for.inc:
-  %inc = add nsw i32 %i.0, 1
-  br label %for.cond
-for.end:
-  ret void
-}
-
-;; Original C Code:
-;;  void known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-;;for (int i = 0; i < 5; i++) ;
-;;  }
-;;  => Added mustprogress loop attribute
-
-define void @known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:ret void
-;
-entry:
-  br label %for.cond
-for.cond:
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
-  %cmp = icmp slt i32 %i.0, 5
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.inc
-for.inc:
-  %inc = add nsw i32 %i.0, 1
-  br 

[PATCH] D91348: [OpenCL] Warn about side effects for unevaluated vec_step arg

2020-12-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: lxfind.

LGTM, the change seems reasonable. Thanks!

> A minor side-effect of this change is that it also produces the
> warning for co_await and co_yield now.

This warning is produced for **sizeof** and it seems like a duplication of 
another diagnostic that occurs for this case. But this happens elsewhere and it 
is not harmful so it seems acceptable. Alternatively, we could try to move code 
that contains `CheckVecStepTraitOperandType` some line below instead of moving 
the warning to the top. But I don't find it necessary.

Btw just a suggestion - it is better to upload a full diff because the regular 
diff is not reliable in the Phabricator as line numbers change quickly in the 
repository and there is no information on the parent commit for the patch.




Comment at: clang/lib/Sema/SemaExpr.cpp:4038
 
+  // The operand for sizeof and alignof is in an unevaluated expression 
context,
+  // so side effects could result in unintended consequences.

The comment could be updated to add vec_step. Although I think the comment has 
already changed in the repo so a rebase would be necessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91348/new/

https://reviews.llvm.org/D91348

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


[clang] 8bee4d4 - Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"

2020-12-31 Thread Shaurya Gupta via cfe-commits

Author: Bogdan Graur
Date: 2020-12-31T11:47:49Z
New Revision: 8bee4d4e8f54b5f28b9117b552d3b2c655ff129b

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

LOG: Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect 
free loops"

Test clang/test/Misc/loop-opt-setup.c fails when executed in Release.

This reverts commit 6f1503d59854b331f1f970d39839619b0a26bbc7.

Reviewed By: SureYeaah

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

Added: 


Modified: 
clang/test/Misc/loop-opt-setup.c
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Scalar/LoopDeletion.cpp
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll

Removed: 
llvm/test/Transforms/LoopDeletion/mustprogress.ll



diff  --git a/clang/test/Misc/loop-opt-setup.c 
b/clang/test/Misc/loop-opt-setup.c
index 660eea25c6af..c5c2ec4fda84 100644
--- a/clang/test/Misc/loop-opt-setup.c
+++ b/clang/test/Misc/loop-opt-setup.c
@@ -1,5 +1,4 @@
 // RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
-// RUN: %clang -std=c99 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | 
FileCheck %s --check-prefix C99
 
 extern int a[16];
 int b = 0;
@@ -25,12 +24,7 @@ void Helper() {
 }
 
 // Check br i1 to make sure the loop is gone, there will still be a label 
branch for the infinite loop.
-// In C99, there was no forward progress requirement, so we expect the 
infinite loop to still exist,
-// but for C11 and onwards, the infinite loop can be deleted.
 // CHECK-LABEL: Helper
-// C99: br label
-// C99-NOT: br i1
-// C99: br label
-// CHECK: entry:
-// CHECK-NOT: br i1
-// CHECK-NEXT: ret void
+// CHECK: br label
+// CHECK-NOT: br i1
+// CHECK: br label

diff  --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h 
b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index fc6b72eb28af..ba2bb0a4c6b0 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -255,9 +255,6 @@ bool hasDisableAllTransformsHint(const Loop *L);
 /// Look for the loop attribute that disables the LICM transformation 
heuristics.
 bool hasDisableLICMTransformsHint(const Loop *L);
 
-/// Look for the loop attribute that requires progress within the loop.
-bool hasMustProgress(const Loop *L);
-
 /// The mode sets how eager a transformation should be applied.
 enum TransformationMode {
   /// The pass can use heuristics to determine whether a transformation should

diff  --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp 
b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index 814cfc7ac6a9..065db647561e 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -128,11 +128,10 @@ static bool isLoopNeverExecuted(Loop *L) {
 
 /// Remove a loop if it is dead.
 ///
-/// A loop is considered dead either if it does not impact the observable
-/// behavior of the program other than finite running time, or if it is
-/// required to make progress by an attribute such as 'mustprogress' or
-/// 'llvm.loop.mustprogress' and does not make any. This may remove
-/// infinite loops that have been required to make progress.
+/// A loop is considered dead if it does not impact the observable behavior of
+/// the program other than finite running time. This never removes a loop that
+/// might be infinite (unless it is never executed), as doing so could change
+/// the halting/non-halting nature of a program.
 ///
 /// This entire process relies pretty heavily on LoopSimplify form and LCSSA in
 /// order to make various safety checks work.
@@ -208,13 +207,11 @@ static LoopDeletionResult deleteLoopIfDead(Loop *L, 
DominatorTree ,
: LoopDeletionResult::Unmodified;
   }
 
-  // Don't remove loops for which we can't solve the trip count unless the loop
-  // was required to make progress but has been determined to be dead.
+  // Don't remove loops for which we can't solve the trip count.
+  // They could be infinite, in which case we'd be changing program behavior.
   const SCEV *S = SE.getConstantMaxBackedgeTakenCount(L);
-  if (isa(S) &&
-  !L->getHeader()->getParent()->mustProgress() && !hasMustProgress(L)) {
-LLVM_DEBUG(dbgs() << "Could not compute SCEV MaxBackedgeTakenCount and was 
"
- "not required to make progress.\n");
+  if (isa(S)) {
+LLVM_DEBUG(dbgs() << "Could not compute SCEV MaxBackedgeTakenCount.\n");
 return Changed ? LoopDeletionResult::Modified
: LoopDeletionResult::Unmodified;
   }

diff  --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp 
b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 4cd59af6e551..8dc7709c6e55 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ 

[PATCH] D93956: Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"

2020-12-31 Thread Bogdan Graur via Phabricator via cfe-commits
bgraur created this revision.
bgraur added a reviewer: SureYeaah.
Herald added a subscriber: hiraditya.
bgraur requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Test clang/test/Misc:loop-opt-setup.c fails when executed in Release.

This reverts commit 6f1503d59854b331f1f970d39839619b0a26bbc7 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93956

Files:
  clang/test/Misc/loop-opt-setup.c
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopDeletion/mustprogress.ll
  llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll

Index: llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
===
--- llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
+++ llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
@@ -5,7 +5,14 @@
 ; CHECK: Function Attrs: mustprogress
 ; CHECK-LABEL: define {{[^@]+}}@f
 ; CHECK-SAME: () [[ATTR0:#.*]] {
-; CHECK-NEXT:unreachable
+; CHECK-NEXT:br label [[TMP1:%.*]]
+; CHECK:   1:
+; CHECK-NEXT:[[DOT01:%.*]] = phi i32 [ 1, [[TMP0:%.*]] ], [ [[TMP3:%.*]], [[TMP2:%.*]] ]
+; CHECK-NEXT:[[DOT0:%.*]] = phi i32 [ 1, [[TMP0]] ], [ [[TMP3]], [[TMP2]] ]
+; CHECK-NEXT:br label [[TMP2]]
+; CHECK:   2:
+; CHECK-NEXT:[[TMP3]] = add nsw i32 [[DOT01]], [[DOT0]]
+; CHECK-NEXT:br label [[TMP1]]
 ;
   br label %1
 
Index: llvm/test/Transforms/LoopDeletion/mustprogress.ll
===
--- llvm/test/Transforms/LoopDeletion/mustprogress.ll
+++ /dev/null
@@ -1,237 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
-; RUN: opt < %s -loop-deletion -verify-dom-info -S | FileCheck %s
-
-;; Original C Code:
-;;  void unknown_tripcount_mustprogress_attr_mustprogress_loopmd(int a, int b) {
-;;for (; a < b;) ;
-;;for (;;) ;
-;;  }
-
-define void @unknown_tripcount_mustprogress_attr_mustprogress_loopmd(i32 %a, i32 %b) #0 {
-; CHECK: Function Attrs: mustprogress
-; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_mustprogress_loopmd
-; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]] {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:unreachable
-;
-entry:
-  br label %for.cond
-for.cond:
-  %cmp = icmp slt i32 %a, %b
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.cond, !llvm.loop !2
-for.end:
-  br label %for.cond1
-for.cond1:
-  br label %for.cond1
-}
-
-;; Original C Code:
-;;  void unknown_tripcount_mustprogress_attr_no_mustprogress_loopmd(int a, int b) {
-;;for (; a < b;) ;
-;;for (;;) ;
-;;  }
-;;  => Removed mustprogress loop attribute
-
-define void @unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd(i32 %a, i32 %b) #0 {
-; CHECK: Function Attrs: mustprogress
-; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd
-; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0]] {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:unreachable
-;
-entry:
-  br label %for.cond
-for.cond:
-  %cmp = icmp slt i32 %a, %b
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.cond
-for.end:
-  br label %for.cond1
-for.cond1:
-  br label %for.cond1
-}
-
-;; Original C Code:
-;;  void known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-;;for (int i = 0; i < 5; i++) ;
-;;  }
-
-define void @known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:ret void
-;
-entry:
-  br label %for.cond
-for.cond:
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
-  %cmp = icmp slt i32 %i.0, 5
-  br i1 %cmp, label %for.body, label %for.end
-for.body:
-  br label %for.inc
-for.inc:
-  %inc = add nsw i32 %i.0, 1
-  br label %for.cond
-for.end:
-  ret void
-}
-
-;; Original C Code:
-;;  void known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-;;for (int i = 0; i < 5; i++) ;
-;;  }
-;;  => Added mustprogress loop attribute
-
-define void @known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:br label [[FOR_END:%.*]]
-; CHECK:   for.end:
-; CHECK-NEXT:ret void
-;
-entry:
-  br label %for.cond
-for.cond:
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
-  %cmp = icmp slt i32 %i.0, 5
-  br i1 %cmp, label %for.body, label 

[PATCH] D93955: [Sema] Add support for reporting multiple errors during initialization

2020-12-31 Thread Yang Fan via Phabricator via cfe-commits
nullptr.cpp updated this revision to Diff 314177.
nullptr.cpp edited the summary of this revision.
nullptr.cpp added a comment.

Update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93955/new/

https://reviews.llvm.org/D93955

Files:
  clang/include/clang/Sema/Initialization.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/test/SemaCXX/diagnostic-overload-resolution.cpp

Index: clang/test/SemaCXX/diagnostic-overload-resolution.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/diagnostic-overload-resolution.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify=expected %s
+
+namespace std {
+typedef decltype(sizeof(int)) size_t;
+
+template 
+class initializer_list {
+  const _E *__begin_;
+  size_t __size_;
+
+  initializer_list(const _E *__b, size_t __s)
+  : __begin_(__b),
+__size_(__s) {}
+
+public:
+  typedef _E value_type;
+  typedef const _E 
+  typedef const _E _reference;
+  typedef size_t size_type;
+
+  typedef const _E *iterator;
+  typedef const _E *const_iterator;
+
+  initializer_list() : __begin_(nullptr), __size_(0) {}
+
+  size_t size() const { return __size_; }
+  const _E *begin() const { return __begin_; }
+  const _E *end() const { return __begin_ + __size_; }
+};
+} // namespace std
+
+// C++11 [over.match.list]p1:
+//   In copy-list-initialization, if an explicit constructor is chosen, the
+//   initializer is ill-formed.
+struct A {
+  explicit A(std::initializer_list) = delete;
+  // expected-note@-1 {{'A' has been explicitly marked deleted here}}
+  // expected-note@-2 {{explicit constructor declared here}}
+};
+
+A a = {1, 2, 3};
+// expected-error@-1 {{call to deleted constructor of 'A'}}
+// expected-error@-2 {{chosen constructor is explicit in copy-initialization}}
Index: clang/lib/Sema/SemaInit.cpp
===
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -526,48 +526,52 @@
   // stlport does so too. Look for std::__debug for libstdc++, and for
   // std:: for stlport.  This is effectively a compiler-side implementation of
   // LWG2193.
-  if (!InitSeq && EmptyInitList && InitSeq.getFailureKind() ==
-  InitializationSequence::FK_ExplicitConstructor) {
-OverloadCandidateSet::iterator Best;
-OverloadingResult O =
-InitSeq.getFailedCandidateSet()
-.BestViableFunction(SemaRef, Kind.getLocation(), Best);
-(void)O;
-assert(O == OR_Success && "Inconsistent overload resolution");
-CXXConstructorDecl *CtorDecl = cast(Best->Function);
-CXXRecordDecl *R = CtorDecl->getParent();
-
-if (CtorDecl->getMinRequiredArguments() == 0 &&
-CtorDecl->isExplicit() && R->getDeclName() &&
-SemaRef.SourceMgr.isInSystemHeader(CtorDecl->getLocation())) {
-  bool IsInStd = false;
-  for (NamespaceDecl *ND = dyn_cast(R->getDeclContext());
-   ND && !IsInStd; ND = dyn_cast(ND->getParent())) {
-if (SemaRef.getStdNamespace()->InEnclosingNamespaceSetOf(ND))
-  IsInStd = true;
-  }
+  if (!InitSeq && EmptyInitList) {
+auto Failures = InitSeq.getFailureKind();
+if (Failures.end() !=
+std::find(Failures.begin(), Failures.end(),
+  InitializationSequence::FK_ExplicitConstructor)) {
+  OverloadCandidateSet::iterator Best;
+  OverloadingResult O = InitSeq.getFailedCandidateSet().BestViableFunction(
+  SemaRef, Kind.getLocation(), Best);
+  (void)O;
+  assert(O == OR_Success && "Inconsistent overload resolution");
+  CXXConstructorDecl *CtorDecl = cast(Best->Function);
+  CXXRecordDecl *R = CtorDecl->getParent();
+
+  if (CtorDecl->getMinRequiredArguments() == 0 && CtorDecl->isExplicit() &&
+  R->getDeclName() &&
+  SemaRef.SourceMgr.isInSystemHeader(CtorDecl->getLocation())) {
+bool IsInStd = false;
+for (NamespaceDecl *ND = dyn_cast(R->getDeclContext());
+ ND && !IsInStd; ND = dyn_cast(ND->getParent())) {
+  if (SemaRef.getStdNamespace()->InEnclosingNamespaceSetOf(ND))
+IsInStd = true;
+}
 
-  if (IsInStd && llvm::StringSwitch(R->getName())
-  .Cases("basic_string", "deque", "forward_list", true)
-  .Cases("list", "map", "multimap", "multiset", true)
-  .Cases("priority_queue", "queue", "set", "stack", true)
-  .Cases("unordered_map", "unordered_set", "vector", true)
-  .Default(false)) {
-InitSeq.InitializeFrom(
-SemaRef, Entity,
-InitializationKind::CreateValue(Loc, Loc, Loc, true),
-MultiExprArg(), /*TopLevelOfInitList=*/false,
-TreatUnavailableAsInvalid);
-// Emit a warning for this.  System header warnings aren't shown
-// by default, but people working on system headers should see it.
-  

[PATCH] D93955: [Sema] Add support for reporting multiple errors during initialization

2020-12-31 Thread Yang Fan via Phabricator via cfe-commits
nullptr.cpp created this revision.
nullptr.cpp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

During the initialization process, more than one error may be encountered, but
Clang reports only one of them. This patch makes Clang report all errors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93955

Files:
  clang/include/clang/Sema/Initialization.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/test/SemaCXX/diagnostic-overload-resolution.cpp

Index: clang/test/SemaCXX/diagnostic-overload-resolution.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/diagnostic-overload-resolution.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify=expected %s
+
+namespace std {
+typedef decltype(sizeof(int)) size_t;
+
+template 
+class initializer_list {
+  const _E *__begin_;
+  size_t __size_;
+
+  initializer_list(const _E *__b, size_t __s)
+  : __begin_(__b),
+__size_(__s) {}
+
+public:
+  typedef _E value_type;
+  typedef const _E 
+  typedef const _E _reference;
+  typedef size_t size_type;
+
+  typedef const _E *iterator;
+  typedef const _E *const_iterator;
+
+  initializer_list() : __begin_(nullptr), __size_(0) {}
+
+  size_t size() const { return __size_; }
+  const _E *begin() const { return __begin_; }
+  const _E *end() const { return __begin_ + __size_; }
+};
+} // namespace std
+
+// C++11 [over.match.list]p1:
+//   In copy-list-initialization, if an explicit constructor is chosen, the
+//   initializer is ill-formed.
+struct A {
+  explicit A(std::initializer_list) = delete;
+  // expected-note@-1 {{'A' has been explicitly marked deleted here}}
+  // expected-note@-2 {{explicit constructor declared here}}
+};
+
+A a = {1, 2, 3};
+// expected-error@-1 {{call to deleted constructor of 'A'}}
+// expected-error@-2 {{chosen constructor is explicit in copy-initialization}}
Index: clang/lib/Sema/SemaInit.cpp
===
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -526,48 +526,52 @@
   // stlport does so too. Look for std::__debug for libstdc++, and for
   // std:: for stlport.  This is effectively a compiler-side implementation of
   // LWG2193.
-  if (!InitSeq && EmptyInitList && InitSeq.getFailureKind() ==
-  InitializationSequence::FK_ExplicitConstructor) {
-OverloadCandidateSet::iterator Best;
-OverloadingResult O =
-InitSeq.getFailedCandidateSet()
-.BestViableFunction(SemaRef, Kind.getLocation(), Best);
-(void)O;
-assert(O == OR_Success && "Inconsistent overload resolution");
-CXXConstructorDecl *CtorDecl = cast(Best->Function);
-CXXRecordDecl *R = CtorDecl->getParent();
-
-if (CtorDecl->getMinRequiredArguments() == 0 &&
-CtorDecl->isExplicit() && R->getDeclName() &&
-SemaRef.SourceMgr.isInSystemHeader(CtorDecl->getLocation())) {
-  bool IsInStd = false;
-  for (NamespaceDecl *ND = dyn_cast(R->getDeclContext());
-   ND && !IsInStd; ND = dyn_cast(ND->getParent())) {
-if (SemaRef.getStdNamespace()->InEnclosingNamespaceSetOf(ND))
-  IsInStd = true;
-  }
+  if (!InitSeq && EmptyInitList) {
+auto Failures = InitSeq.getFailureKind();
+if (Failures.end() !=
+std::find(Failures.begin(), Failures.end(),
+  InitializationSequence::FK_ExplicitConstructor)) {
+  OverloadCandidateSet::iterator Best;
+  OverloadingResult O = InitSeq.getFailedCandidateSet().BestViableFunction(
+  SemaRef, Kind.getLocation(), Best);
+  (void)O;
+  assert(O == OR_Success && "Inconsistent overload resolution");
+  CXXConstructorDecl *CtorDecl = cast(Best->Function);
+  CXXRecordDecl *R = CtorDecl->getParent();
+
+  if (CtorDecl->getMinRequiredArguments() == 0 && CtorDecl->isExplicit() &&
+  R->getDeclName() &&
+  SemaRef.SourceMgr.isInSystemHeader(CtorDecl->getLocation())) {
+bool IsInStd = false;
+for (NamespaceDecl *ND = dyn_cast(R->getDeclContext());
+ ND && !IsInStd; ND = dyn_cast(ND->getParent())) {
+  if (SemaRef.getStdNamespace()->InEnclosingNamespaceSetOf(ND))
+IsInStd = true;
+}
 
-  if (IsInStd && llvm::StringSwitch(R->getName())
-  .Cases("basic_string", "deque", "forward_list", true)
-  .Cases("list", "map", "multimap", "multiset", true)
-  .Cases("priority_queue", "queue", "set", "stack", true)
-  .Cases("unordered_map", "unordered_set", "vector", true)
-  .Default(false)) {
-InitSeq.InitializeFrom(
-SemaRef, Entity,
-InitializationKind::CreateValue(Loc, Loc, Loc, true),
-MultiExprArg(), /*TopLevelOfInitList=*/false,
-TreatUnavailableAsInvalid);
-// Emit a warning for this.  System header 

[PATCH] D93817: Update transformations to use poison for insertelement/shufflevector's placeholder value

2020-12-31 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

Running Alive2 finds one failure, which is fixed by updating the shufflevector 
semantics to return poison on undef/poison mask (D93818 
):

Transforms/InstCombine/shufflevector-div-rem-inseltpoison.ll

    
 
  define <2 x float> @test_fdiv(float %a, float %b, i1 %cmp) {  
 
  %0:   
 
%splatinsert = insertelement <2 x float> poison, float %a, i32 0
 
%denom = insertelement <2 x float> { 3.00, poison }, float 1.00, 
i32 1   
%t1 = fdiv <2 x float> %splatinsert, %denom 
 
%splat.op = shufflevector <2 x float> %t1, <2 x float> poison, 4294967295, 
0 ; THIS BLOCKS POISON
%t2 = select i1 %cmp, <2 x float> { 77.00, 99.00 }, <2 x float> 
%splat.op
ret <2 x float> %t2 
 
  } 
 
  =>
 
  define <2 x float> @test_fdiv(float %a, float %b, i1 %cmp) {  
 
  %0:   
 
%1 = insertelement <2 x float> poison, float %a, i32 1  
 
%2 = fdiv <2 x float> %1, { undef, 3.00 }   
 
%t2 = select i1 %cmp, <2 x float> { 77.00, 99.00 }, <2 x float> %2  
 
ret <2 x float> %t2 
 
  } 
 
  Transformation doesn't verify!
 
  ERROR: Target is more poisonous than source   
 

For the diffs, I checked that all of these are replacements of undef with 
poison, and there was no larger change.

After this patch, there are two places where undef still shows up as a 
placeholder from llvm tests: I couldn't find where they are coming from. :(
If someone points me where they're likely to appear, I'll fix these.

  $ ag "shufflevector <.*> .*, <.*> undef" | grep inseltpoison
  Transforms/InstCombine/X86/x86-pshufb-inseltpoison.ll
  
  $ ag "insertelement <.*> undef" | grep inseltpoison
  Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93817/new/

https://reviews.llvm.org/D93817

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


[PATCH] D93817: Update transformations to use poison for insertelement/shufflevector's placeholder value

2020-12-31 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 314175.
aqjune added a comment.

Find a few missing places & update them to use poison


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93817/new/

https://reviews.llvm.org/D93817

Files:
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c
  clang/test/CodeGen/X86/avx-shuffle-builtins.c
  clang/test/CodeGen/aarch64-bf16-dotprod-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-lane-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
  clang/test/CodeGen/aarch64-neon-dot-product.c
  clang/test/CodeGen/arm-bf16-convert-intrinsics.c
  clang/test/CodeGen/arm-bf16-dotprod-intrinsics.c
  clang/test/CodeGen/arm-bf16-getset-intrinsics.c
  clang/test/CodeGen/arm-neon-dot-product.c
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/InterleavedAccessPass.cpp
  llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
  llvm/lib/Target/X86/X86InterleavedAccess.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/Scalarizer.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  
llvm/test/Transforms/CodeGenPrepare/ARM/sink-add-mul-shufflevector-inseltpoison.ll
  
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx2-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx2.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx512.ll
  llvm/test/Transforms/InstCombine/X86/x86-f16c-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-f16c.ll
  llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll
  llvm/test/Transforms/InstCombine/X86/x86-vpermil-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-vpermil.ll
  llvm/test/Transforms/InstCombine/bitcast-vec-canon-inseltpoison.ll
  llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
  llvm/test/Transforms/InstCombine/broadcast-inseltpoison.ll
  llvm/test/Transforms/InstCombine/broadcast.ll
  llvm/test/Transforms/InstCombine/canonicalize-vector-extract.ll
  llvm/test/Transforms/InstCombine/extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/extractelement.ll
  llvm/test/Transforms/InstCombine/gep-inbounds-null.ll
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/InstCombine/icmp-vec-inseltpoison.ll
  llvm/test/Transforms/InstCombine/icmp-vec.ll
  llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
  llvm/test/Transforms/InstCombine/masked_intrinsics-inseltpoison.ll
  llvm/test/Transforms/InstCombine/masked_intrinsics.ll
  llvm/test/Transforms/InstCombine/obfuscated_splat-inseltpoison.ll
  llvm/test/Transforms/InstCombine/obfuscated_splat.ll
  llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
  llvm/test/Transforms/InstCombine/select-extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/select-extractelement.ll
  llvm/test/Transforms/InstCombine/shufflevector-div-rem-inseltpoison.ll
  llvm/test/Transforms/InstCombine/shufflevector-div-rem.ll
  llvm/test/Transforms/InstCombine/trunc-extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/trunc-extractelement.ll
  llvm/test/Transforms/InstCombine/trunc-inseltpoison.ll
  llvm/test/Transforms/InstCombine/trunc.ll
  llvm/test/Transforms/InstCombine/vec-binop-select-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec-binop-select.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
  llvm/test/Transforms/InstCombine/vec_gep_scalar_arg-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_shuffle.ll
  llvm/test/Transforms/InstCombine/vector-casts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll
  llvm/test/Transforms/InstCombine/vscale_cmp.ll
  llvm/test/Transforms/InstSimplify/insertelement.ll
  llvm/test/Transforms/InstSimplify/shufflevector-inseltpoison.ll
  llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
  

[clang] f2cc266 - [test] Fix -triple and delete UNSUPPORTED: system-windows

2020-12-31 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-12-31T00:13:34-08:00
New Revision: f2cc2669a0d91994c93f2e9708e137484081a7c1

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

LOG: [test] Fix -triple and delete UNSUPPORTED: system-windows

Added: 


Modified: 
clang/test/CodeGen/attr-loader-uninitialized.c
clang/test/CodeGenCXX/attr-loader-uninitialized.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-loader-uninitialized.c 
b/clang/test/CodeGen/attr-loader-uninitialized.c
index 9ff0c23d77c3..eecd1eaf221d 100644
--- a/clang/test/CodeGen/attr-loader-uninitialized.c
+++ b/clang/test/CodeGen/attr-loader-uninitialized.c
@@ -1,5 +1,4 @@
-// UNSUPPORTED: system-windows
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
 
 // CHECK: @tentative_attr_first = global i32 undef
 int tentative_attr_first __attribute__((loader_uninitialized));

diff  --git a/clang/test/CodeGenCXX/attr-loader-uninitialized.cpp 
b/clang/test/CodeGenCXX/attr-loader-uninitialized.cpp
index ec3e84b59023..1542b39e1159 100644
--- a/clang/test/CodeGenCXX/attr-loader-uninitialized.cpp
+++ b/clang/test/CodeGenCXX/attr-loader-uninitialized.cpp
@@ -1,5 +1,4 @@
-// UNSUPPORTED: system-windows
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: @defn = global i32 undef
 int defn  [[clang::loader_uninitialized]];



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