Skip to content

Commit

Permalink
Integrate LLVM at llvm/llvm-project@10dc3a8e916d
Browse files Browse the repository at this point in the history
Updates LLVM usage to match
[10dc3a8e916d](llvm/llvm-project@10dc3a8e916d)

PiperOrigin-RevId: 636778164
  • Loading branch information
tensorflower-gardener committed May 24, 2024
1 parent f471831 commit b4afcb3
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 3 deletions.
1 change: 1 addition & 0 deletions tensorflow/dtensor/mlir/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ cc_library(
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:span",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:Analysis",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:FunctionInterfaces",
"@llvm-project//mlir:IR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ limitations under the License.
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FormatVariadic.h"
#include "mlir/Analysis/TopologicalSortUtils.h" // from @llvm-project
#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project
#include "mlir/IR/Block.h" // from @llvm-project
#include "mlir/IR/Builders.h" // from @llvm-project
Expand All @@ -43,7 +44,6 @@ limitations under the License.
#include "mlir/Pass/Pass.h" // from @llvm-project
#include "mlir/Support/LLVM.h" // from @llvm-project
#include "mlir/Support/LogicalResult.h" // from @llvm-project
#include "mlir/Transforms/TopologicalSortUtils.h" // from @llvm-project
#include "tensorflow/compiler/mlir/tensorflow/analysis/side_effect_analysis.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h"
Expand Down
155 changes: 155 additions & 0 deletions third_party/llvm/generated.patch
Original file line number Diff line number Diff line change
@@ -1 +1,156 @@
Auto generated patch. Do not edit or delete it, even if empty.
diff -ruN --strip-trailing-cr a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -1807,8 +1807,6 @@
// Returns the template parameter list with all default template argument
// information.
static TemplateParameterList *GetTemplateParameterList(TemplateDecl *TD) {
- if (TD->isImplicit())
- return TD->getTemplateParameters();
// Make sure we get the template parameter list from the most
// recent declaration, since that is the only one that is guaranteed to
// have all the default template argument information.
@@ -1829,8 +1827,7 @@
// template <class = void> friend struct C;
// };
// template struct S<int>;
- while ((D->isImplicit() ||
- D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None) &&
+ while (D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None &&
D->getPreviousDecl())
D = D->getPreviousDecl();
return cast<TemplateDecl>(D)->getTemplateParameters();
diff -ruN --strip-trailing-cr a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -527,8 +527,8 @@
R->setDefaultArgument(
S.Context,
S.getTrivialTemplateArgumentLoc(Default, QualType(), SourceLocation()));
- if (T->hasTypeConstraint()) {
- auto *C = T->getTypeConstraint();
+ if (R->hasTypeConstraint()) {
+ auto *C = R->getTypeConstraint();
R->setTypeConstraint(C->getConceptReference(),
C->getImmediatelyDeclaredConstraint());
}
@@ -583,53 +583,37 @@
return TemplateDeductionResult::Success;

auto NewDeduced = DeducedTemplateArgument(Arg);
- // Provisional resolution for CWG2398: If Arg names a template
- // specialization, then we deduce a synthesized template template parameter
- // based on A, but using the TS's arguments as defaults.
- if (DefaultArguments.size() != 0) {
+ // Provisional resolution for CWG2398: If Arg is also a template template
+ // param, and it names a template specialization, then we deduce a
+ // synthesized template template parameter based on A, but using the TS's
+ // arguments as defaults.
+ if (auto *TempArg = dyn_cast_or_null<TemplateTemplateParmDecl>(
+ Arg.getAsTemplateDecl())) {
assert(Arg.getKind() == TemplateName::Template);
- TemplateDecl *TempArg = Arg.getAsTemplateDecl();
- TemplateParameterList *As = TempArg->getTemplateParameters();
- assert(DefaultArguments.size() <= As->size());
-
- SmallVector<NamedDecl *, 4> Params(As->size());
- for (unsigned I = 0; I < DefaultArguments.size(); ++I)
- Params[I] = getTemplateParameterWithDefault(S, As->getParam(I),
- DefaultArguments[I]);
- for (unsigned I = DefaultArguments.size(); I < As->size(); ++I)
- Params[I] = As->getParam(I);
- // FIXME: We could unique these, and also the parameters, but we don't
- // expect programs to contain a large enough amount of these deductions
- // for that to be worthwhile.
- auto *TPL = TemplateParameterList::Create(
- S.Context, SourceLocation(), SourceLocation(), Params,
- SourceLocation(), As->getRequiresClause());
+ assert(!TempArg->isExpandedParameterPack());

- TemplateDecl *TD;
- switch (TempArg->getKind()) {
- case Decl::TemplateTemplateParm: {
- auto *A = cast<TemplateTemplateParmDecl>(TempArg);
- assert(!A->isExpandedParameterPack());
- TD = TemplateTemplateParmDecl::Create(
- S.Context, A->getDeclContext(), SourceLocation(), A->getDepth(),
- A->getPosition(), A->isParameterPack(), A->getIdentifier(),
- A->wasDeclaredWithTypename(), TPL);
- break;
- }
- case Decl::ClassTemplate: {
- auto *A = cast<ClassTemplateDecl>(TempArg);
- auto *CT = ClassTemplateDecl::Create(S.Context, A->getDeclContext(),
- SourceLocation(), A->getDeclName(),
- TPL, A->getTemplatedDecl());
- CT->setPreviousDecl(A);
- TD = CT;
- break;
- }
- default:
- llvm_unreachable("Unexpected Template Kind");
+ TemplateParameterList *As = TempArg->getTemplateParameters();
+ if (DefaultArguments.size() != 0) {
+ assert(DefaultArguments.size() <= As->size());
+ SmallVector<NamedDecl *, 4> Params(As->size());
+ for (unsigned I = 0; I < DefaultArguments.size(); ++I)
+ Params[I] = getTemplateParameterWithDefault(S, As->getParam(I),
+ DefaultArguments[I]);
+ for (unsigned I = DefaultArguments.size(); I < As->size(); ++I)
+ Params[I] = As->getParam(I);
+ // FIXME: We could unique these, and also the parameters, but we don't
+ // expect programs to contain a large enough amount of these deductions
+ // for that to be worthwhile.
+ auto *TPL = TemplateParameterList::Create(
+ S.Context, SourceLocation(), SourceLocation(), Params,
+ SourceLocation(), As->getRequiresClause());
+ NewDeduced = DeducedTemplateArgument(
+ TemplateName(TemplateTemplateParmDecl::Create(
+ S.Context, TempArg->getDeclContext(), SourceLocation(),
+ TempArg->getDepth(), TempArg->getPosition(),
+ TempArg->isParameterPack(), TempArg->getIdentifier(),
+ TempArg->wasDeclaredWithTypename(), TPL)));
}
- TD->setImplicit(true);
- NewDeduced = DeducedTemplateArgument(TemplateName(TD));
}

DeducedTemplateArgument Result = checkDeducedTemplateArguments(S.Context,
diff -ruN --strip-trailing-cr a/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp
--- a/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp
@@ -28,14 +28,13 @@
{ /* ... */ }

template<template<class> class TT>
- void f(TT<int>);
+ void f(TT<int>); // expected-note {{candidate template ignored}}

template<template<class,class> class TT>
void g(TT<int, Alloc<int>>);

int h() {
- f(v); // OK: TT = vector, Alloc<int> is used as the default argument for the
- // second parameter.
+ f(v); // expected-error {{no matching function for call to 'f'}}
g(v); // OK: TT = vector
}

diff -ruN --strip-trailing-cr a/clang/test/SemaTemplate/cwg2398.cpp b/clang/test/SemaTemplate/cwg2398.cpp
--- a/clang/test/SemaTemplate/cwg2398.cpp
+++ b/clang/test/SemaTemplate/cwg2398.cpp
@@ -65,10 +65,13 @@
template <class T3> struct B;

template <template <class T4> class TT1, class T5> struct B<TT1<T5>>;
+ // new-note@-1 {{partial specialization matches}}

template <class T6, class T7> struct B<A<T6, T7>> {};
+ // new-note@-1 {{partial specialization matches}}

template struct B<A<int>>;
+ // new-error@-1 {{ambiguous partial specialization}}
} // namespace class_template

namespace type_pack1 {
4 changes: 2 additions & 2 deletions third_party/llvm/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive")

def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "446f66d685c2470bc7744b1d1538c4728e838e43"
LLVM_SHA256 = "e3fc6f836845a8accea29bfa65cae4835fd2c1dd621242c53f94b5e64e117d61"
LLVM_COMMIT = "10dc3a8e916d73291269e5e2b82dd22681489aa1"
LLVM_SHA256 = "6ee5e0f9a49d41b5f48ebc4613ce3371f686bf70fcece9f849aba3c37bdeb3e8"

tf_http_archive(
name = name,
Expand Down

0 comments on commit b4afcb3

Please sign in to comment.