Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate LLVM at llvm/llvm-project@e109c4932105 #19198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
378 changes: 315 additions & 63 deletions third_party/llvm/generated.patch
Original file line number Diff line number Diff line change
@@ -1,65 +1,317 @@
Auto generated patch. Do not edit or delete it, even if empty.
diff -ruN --strip-trailing-cr a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -2337,6 +2337,7 @@
srcs = ["include/mlir/Dialect/AMX/AMX.td"],
includes = ["include"],
deps = [
+ ":BuiltinDialectTdFiles",
":LLVMOpsTdFiles",
":SideEffectInterfacesTdFiles",
],
@@ -2360,6 +2361,20 @@
"include/mlir/Dialect/AMX/AMXDialect.cpp.inc",
),
(
+ [
+ "-gen-typedef-decls",
+ "-typedefs-dialect=amx",
+ ],
+ "include/mlir/Dialect/AMX/AMXTypes.h.inc",
+ ),
+ (
+ [
+ "-gen-typedef-defs",
+ "-typedefs-dialect=amx",
+ ],
+ "include/mlir/Dialect/AMX/AMXTypes.cpp.inc",
+ ),
+ (
["-gen-op-decls"],
"include/mlir/Dialect/AMX/AMX.h.inc",
),
@@ -2388,6 +2403,7 @@
":IR",
":LLVMDialect",
":SideEffectInterfaces",
+ "//llvm:Support",
],
)
diff -ruN --strip-trailing-cr a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -613,8 +613,6 @@
an implicitly instantiated class template specialization. (#GH51051)
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
- Name independent data members were not correctly initialized from default member initializers. (#GH114069)
-- Fixed an assertion failure caused by invalid default argument substitutions in non-defining
- friend declarations. (#GH113324).

@@ -2398,6 +2414,7 @@
includes = ["include"],
deps = [
":AMXDialect",
+ ":ConvertToLLVMInterface",
":IR",
":LLVMCommonConversion",
":LLVMDialect",
@@ -4858,6 +4875,7 @@
deps = [
":AffineTransformOps",
":ArithToLLVM",
+ ":AMXTransforms",
":BufferizationTransformOps",
":BuiltinToLLVMIRTranslation",
":ComplexToLLVM",
@@ -5965,6 +5983,7 @@
deps = [
":ArithDialect",
":ConversionPassIncGen",
+ ":DialectUtils",
":IR",
":Pass",
":SPIRVConversion",
Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
diff -ruN --strip-trailing-cr a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6018,17 +6018,6 @@
} else {
assert(Param && "can't use default arguments without a known callee");

- // FIXME: We don't track member specialization info for non-defining
- // friend declarations, so we will not be able to later find the function
- // pattern. As a workaround, don't instantiate the default argument in
- // this case. This is correct per wording and only an error recovery
- // issue, as per [dcl.fct.default]p4:
- // if a friend declaration D specifies a default argument expression,
- // that declaration shall be a definition.
- if (FDecl->getFriendObjectKind() != Decl::FOK_None &&
- FDecl->getMemberSpecializationInfo() == nullptr)
- return true;
-
ExprResult ArgExpr = BuildCXXDefaultArgExpr(CallLoc, FDecl, Param);
if (ArgExpr.isInvalid())
return true;
diff -ruN --strip-trailing-cr a/clang/test/CXX/temp/temp.res/p4.cpp b/clang/test/CXX/temp/temp.res/p4.cpp
--- a/clang/test/CXX/temp/temp.res/p4.cpp
+++ b/clang/test/CXX/temp/temp.res/p4.cpp
@@ -185,22 +185,3 @@
friend void X::f(T::type);
};
}
-
-namespace GH113324 {
-template <typename = int> struct ct {
- friend void f1(ct, int = 0); // expected-error {{friend declaration specifying a default argument must be a definition}}
- friend void f2(ct a, ct = decltype(a){ }); // expected-error {{friend declaration specifying a default argument must be a definition}}
-};
-
-template<class T> using alias = int;
-template<typename T> struct C {
- // FIXME: We miss diagnosing the default argument instantiation failure (forming reference to void)
- friend void f3(C, int a = alias<T&>(1)); // expected-error {{friend declaration specifying a default argument must be a definition}}
-};
-
-void test() {
- f1(ct<>{});
- f2(ct<>{});
- f3(C<void>());
-}
-} // namespace GH113324
diff -ruN --strip-trailing-cr a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
--- a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
+++ b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h
@@ -315,6 +315,12 @@
return EB->getExpressionType() == ET_Call;
}

+ bool equals(const Expression &Other) const override;
+ bool exactlyEquals(const Expression &Other) const override {
+ return Expression::exactlyEquals(Other) &&
+ cast<CallExpression>(Other).Call == Call;
+ }
+
// Debugging support
void printInternal(raw_ostream &OS, bool PrintEType) const override {
if (PrintEType)
diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -143,6 +143,8 @@
Type *type = nullptr;
SmallVector<uint32_t, 4> varargs;

+ AttributeList attrs;
+
Expression(uint32_t o = ~2U) : opcode(o) {}

bool operator==(const Expression &other) const {
@@ -154,6 +156,9 @@
return false;
if (varargs != other.varargs)
return false;
+ if (!attrs.isEmpty() && !other.attrs.isEmpty() &&
+ !attrs.intersectWith(type->getContext(), other.attrs).has_value())
+ return false;
return true;
}

@@ -364,6 +369,8 @@
} else if (auto *SVI = dyn_cast<ShuffleVectorInst>(I)) {
ArrayRef<int> ShuffleMask = SVI->getShuffleMask();
e.varargs.append(ShuffleMask.begin(), ShuffleMask.end());
+ } else if (auto *CB = dyn_cast<CallBase>(I)) {
+ e.attrs = CB->getAttributes();
}

return e;
@@ -2136,16 +2143,6 @@
return Changed;
}

-// Return true iff V1 can be replaced with V2.
-static bool canBeReplacedBy(Value *V1, Value *V2) {
- if (auto *CB1 = dyn_cast<CallBase>(V1))
- if (auto *CB2 = dyn_cast<CallBase>(V2))
- return CB1->getAttributes()
- .intersectWith(CB2->getContext(), CB2->getAttributes())
- .has_value();
- return true;
-}
-
static void patchAndReplaceAllUsesWith(Instruction *I, Value *Repl) {
patchReplacementInstruction(I, Repl);
I->replaceAllUsesWith(Repl);
@@ -2690,7 +2687,7 @@
// Perform fast-path value-number based elimination of values inherited from
// dominators.
Value *Repl = findLeader(I->getParent(), Num);
- if (!Repl || !canBeReplacedBy(I, Repl)) {
+ if (!Repl) {
// Failure, just remember this instance for future use.
LeaderTable.insert(Num, I, I->getParent());
return false;
@@ -2956,7 +2953,7 @@

uint32_t TValNo = VN.phiTranslate(P, CurrentBlock, ValNo, *this);
Value *predV = findLeader(P, TValNo);
- if (!predV || !canBeReplacedBy(CurInst, predV)) {
+ if (!predV) {
predMap.push_back(std::make_pair(static_cast<Value *>(nullptr), P));
PREPred = P;
++NumWithout;
diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -945,6 +945,18 @@
return true;
}

+bool CallExpression::equals(const Expression &Other) const {
+ if (!MemoryExpression::equals(Other))
+ return false;
+
+ if (auto *RHS = dyn_cast<CallExpression>(&Other))
+ return Call->getAttributes()
+ .intersectWith(Call->getContext(), RHS->Call->getAttributes())
+ .has_value();
+
+ return false;
+}
+
// Determine if the edge From->To is a backedge
bool NewGVN::isBackedge(BasicBlock *From, BasicBlock *To) const {
return From == To ||
@@ -3854,16 +3866,6 @@
return nullptr;
}

-// Return true iff V1 can be replaced with V2.
-static bool canBeReplacedBy(Value *V1, Value *V2) {
- if (auto *CB1 = dyn_cast<CallBase>(V1))
- if (auto *CB2 = dyn_cast<CallBase>(V2))
- return CB1->getAttributes()
- .intersectWith(CB2->getContext(), CB2->getAttributes())
- .has_value();
- return true;
-}
-
bool NewGVN::eliminateInstructions(Function &F) {
// This is a non-standard eliminator. The normal way to eliminate is
// to walk the dominator tree in order, keeping track of available
@@ -3973,8 +3975,6 @@
MembersLeft.insert(Member);
continue;
}
- if (!canBeReplacedBy(Member, Leader))
- continue;

LLVM_DEBUG(dbgs() << "Found replacement " << *(Leader) << " for "
<< *Member << "\n");
@@ -4082,11 +4082,8 @@
if (DominatingLeader != Def) {
// Even if the instruction is removed, we still need to update
// flags/metadata due to downstreams users of the leader.
- if (!match(DefI, m_Intrinsic<Intrinsic::ssa_copy>())) {
- if (!canBeReplacedBy(DefI, DominatingLeader))
- continue;
+ if (!match(DefI, m_Intrinsic<Intrinsic::ssa_copy>()))
patchReplacementInstruction(DefI, DominatingLeader);
- }

markInstructionForDeletion(DefI);
}
@@ -4134,11 +4131,8 @@
// original operand, as we already know we can just drop it.
auto *ReplacedInst = cast<Instruction>(U->get());
auto *PI = PredInfo->getPredicateInfoFor(ReplacedInst);
- if (!PI || DominatingLeader != PI->OriginalOp) {
- if (!canBeReplacedBy(ReplacedInst, DominatingLeader))
- continue;
+ if (!PI || DominatingLeader != PI->OriginalOp)
patchReplacementInstruction(ReplacedInst, DominatingLeader);
- }

LLVM_DEBUG(dbgs()
<< "Found replacement " << *DominatingLeader << " for "
diff -ruN --strip-trailing-cr a/llvm/test/Transforms/GVN/pr113997.ll b/llvm/test/Transforms/GVN/pr113997.ll
--- a/llvm/test/Transforms/GVN/pr113997.ll
+++ b/llvm/test/Transforms/GVN/pr113997.ll
@@ -31,3 +31,39 @@
if.then:
ret i1 false
}
+
+; Make sure we don't merge these two users of the incompatible call pair.
+
+define i1 @bucket2(i32 noundef %x) {
+; CHECK-LABEL: define i1 @bucket2(
+; CHECK-SAME: i32 noundef [[X:%.*]]) {
+; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[X]], 0
+; CHECK-NEXT: [[CTPOP1:%.*]] = tail call range(i32 1, 32) i32 @llvm.ctpop.i32(i32 zeroext [[X]])
+; CHECK-NEXT: [[CTPOP1INC:%.*]] = add i32 [[CTPOP1]], 1
+; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[CTPOP1INC]], 3
+; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP1]], i1 [[CMP2]], i1 false
+; CHECK-NEXT: br i1 [[COND]], label %[[IF_THEN:.*]], label %[[IF_ELSE:.*]]
+; CHECK: [[IF_ELSE]]:
+; CHECK-NEXT: [[CTPOP2:%.*]] = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 [[X]])
+; CHECK-NEXT: [[CTPOP2INC:%.*]] = add i32 [[CTPOP2]], 1
+; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[CTPOP2INC]], 2
+; CHECK-NEXT: ret i1 [[RES]]
+; CHECK: [[IF_THEN]]:
+; CHECK-NEXT: ret i1 false
+;
+ %cmp1 = icmp sgt i32 %x, 0
+ %ctpop1 = tail call range(i32 1, 32) i32 @llvm.ctpop.i32(i32 zeroext %x)
+ %ctpop1inc = add i32 %ctpop1, 1
+ %cmp2 = icmp samesign ult i32 %ctpop1inc, 3
+ %cond = select i1 %cmp1, i1 %cmp2, i1 false
+ br i1 %cond, label %if.then, label %if.else
+
+if.else:
+ %ctpop2 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %x)
+ %ctpop2inc = add i32 %ctpop2, 1
+ %res = icmp eq i32 %ctpop2inc, 2
+ ret i1 %res
+
+if.then:
+ ret i1 false
+}
diff -ruN --strip-trailing-cr a/llvm/test/Transforms/NewGVN/pr113997.ll b/llvm/test/Transforms/NewGVN/pr113997.ll
--- a/llvm/test/Transforms/NewGVN/pr113997.ll
+++ b/llvm/test/Transforms/NewGVN/pr113997.ll
@@ -31,3 +31,39 @@
if.then:
ret i1 false
}
+
+; Make sure we don't merge these two users of the incompatible call pair.
+
+define i1 @bucket2(i32 noundef %x) {
+; CHECK-LABEL: define i1 @bucket2(
+; CHECK-SAME: i32 noundef [[X:%.*]]) {
+; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[X]], 0
+; CHECK-NEXT: [[CTPOP1:%.*]] = tail call range(i32 1, 32) i32 @llvm.ctpop.i32(i32 zeroext [[X]])
+; CHECK-NEXT: [[CTPOP1INC:%.*]] = add i32 [[CTPOP1]], 1
+; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[CTPOP1INC]], 3
+; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP1]], i1 [[CMP2]], i1 false
+; CHECK-NEXT: br i1 [[COND]], label %[[IF_THEN:.*]], label %[[IF_ELSE:.*]]
+; CHECK: [[IF_ELSE]]:
+; CHECK-NEXT: [[CTPOP2:%.*]] = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 [[X]])
+; CHECK-NEXT: [[CTPOP2INC:%.*]] = add i32 [[CTPOP2]], 1
+; CHECK-NEXT: [[RES:%.*]] = icmp eq i32 [[CTPOP2INC]], 2
+; CHECK-NEXT: ret i1 [[RES]]
+; CHECK: [[IF_THEN]]:
+; CHECK-NEXT: ret i1 false
+;
+ %cmp1 = icmp sgt i32 %x, 0
+ %ctpop1 = tail call range(i32 1, 32) i32 @llvm.ctpop.i32(i32 zeroext %x)
+ %ctpop1inc = add i32 %ctpop1, 1
+ %cmp2 = icmp samesign ult i32 %ctpop1inc, 3
+ %cond = select i1 %cmp1, i1 %cmp2, i1 false
+ br i1 %cond, label %if.then, label %if.else
+
+if.else:
+ %ctpop2 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %x)
+ %ctpop2inc = add i32 %ctpop2, 1
+ %res = icmp eq i32 %ctpop2inc, 2
+ ret i1 %res
+
+if.then:
+ ret i1 false
+}
diff -ruN --strip-trailing-cr a/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp b/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
--- a/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
+++ b/mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
@@ -40,11 +40,6 @@
setResultRange(getResult(), ConstantIntRanges::constant(value));
return;
}
- if (auto splatAttr = llvm::dyn_cast_or_null<SplatElementsAttr>(getValue())) {
- setResultRange(getResult(), ConstantIntRanges::constant(
- splatAttr.getSplatValue<APInt>()));
- return;
- }
if (auto arrayCstAttr =
llvm::dyn_cast_or_null<DenseIntElementsAttr>(getValue())) {
std::optional<ConstantIntRanges> result;
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 = "f548d39c3c751446d124c08769080214680d53ba"
LLVM_SHA256 = "66872d95602de81098608858f799969579ac35122e028f30a82c53e4c68d9a7f"
LLVM_COMMIT = "e109c493210572535de25950e7b83f74b8d11a6a"
LLVM_SHA256 = "1df13ffa86d666994cd921bad34e449f8540b35f2f9ab3a4e160fd46191e73f9"

tf_http_archive(
name = name,
Expand Down
Loading
Loading