diff --git a/third_party/llvm/generated.patch b/third_party/llvm/generated.patch index 47b340f218abb3..6bb5a177cc9324 100644 --- a/third_party/llvm/generated.patch +++ b/third_party/llvm/generated.patch @@ -1,15 +1,60 @@ Auto generated patch. Do not edit or delete it, even if empty. -diff -ruN --strip-trailing-cr a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h ---- a/clang/include/clang/Frontend/FrontendOptions.h -+++ b/clang/include/clang/Frontend/FrontendOptions.h -@@ -580,7 +580,9 @@ - BuildingImplicitModuleUsesLock(true), ModulesEmbedAllFiles(false), - IncludeTimestamps(true), UseTemporary(true), - AllowPCMWithCompilerErrors(false), ModulesShareFileManager(true), -- TimeTraceGranularity(500) {} -+ EmitSymbolGraph(false), EmitExtensionSymbolGraphs(false), -+ EmitSymbolGraphSymbolLabelsForTesting(false), -+ EmitPrettySymbolGraphs(false), TimeTraceGranularity(500) {} - - /// getInputKindForExtension - Return the appropriate input kind for a file - /// extension. For example, "c" would return Language::C. +diff -ruN --strip-trailing-cr a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp ++++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +@@ -6276,15 +6276,14 @@ + bool CombinerHelper::matchCommuteConstantToRHS(MachineInstr &MI) { + Register LHS = MI.getOperand(1).getReg(); + Register RHS = MI.getOperand(2).getReg(); +- if (!getIConstantVRegVal(LHS, MRI)) { +- // Skip commuting if LHS is not a constant. But, LHS may be a +- // G_CONSTANT_FOLD_BARRIER. If so we commute as long as we don't already +- // have a constant on the RHS. +- if (MRI.getVRegDef(LHS)->getOpcode() != +- TargetOpcode::G_CONSTANT_FOLD_BARRIER) +- return false; +- } +- // Commute as long as RHS is not a constant or G_CONSTANT_FOLD_BARRIER. ++ auto *LHSDef = MRI.getVRegDef(LHS); ++ if (getIConstantVRegVal(LHS, MRI).has_value()) ++ return true; ++ ++ // LHS may be a G_CONSTANT_FOLD_BARRIER. If so we commute ++ // as long as we don't already have a constant on the RHS. ++ if (LHSDef->getOpcode() != TargetOpcode::G_CONSTANT_FOLD_BARRIER) ++ return false; + return MRI.getVRegDef(RHS)->getOpcode() != + TargetOpcode::G_CONSTANT_FOLD_BARRIER && + !getIConstantVRegVal(RHS, MRI); +diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir b/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir +--- a/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir ++++ b/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir +@@ -1,28 +0,0 @@ +-# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +-# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner %s -o - \ +-# RUN: --aarch64prelegalizercombiner-disable-rule=constant_fold_binop | FileCheck %s +- +-# `constant_fold_binop` is disabled to trigger the infinite loop in `commute_int_constant_to_rhs`. +- +---- +-name: add +-tracksRegLiveness: true +-body: | +- bb.0: +- liveins: $s0 +- +- ; CHECK-LABEL: name: add +- ; CHECK: liveins: $s0 +- ; CHECK-NEXT: {{ $}} +- ; CHECK-NEXT: %c0:_(s32) = G_CONSTANT i32 1 +- ; CHECK-NEXT: %c1:_(s32) = G_CONSTANT i32 2 +- ; CHECK-NEXT: %add:_(s32) = G_ADD %c0, %c1 +- ; CHECK-NEXT: $s0 = COPY %add(s32) +- ; CHECK-NEXT: RET_ReallyLR +- %c0:_(s32) = G_CONSTANT i32 1 +- %c1:_(s32) = G_CONSTANT i32 2 +- %add:_(s32) = G_ADD %c0, %c1 +- $s0 = COPY %add +- RET_ReallyLR +- +-... diff --git a/third_party/llvm/workspace.bzl b/third_party/llvm/workspace.bzl index be9d4839bee071..8b4c03d09646dc 100644 --- a/third_party/llvm/workspace.bzl +++ b/third_party/llvm/workspace.bzl @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" - LLVM_COMMIT = "c511c90680eecae2e4adb87f442f41d465feb0f2" - LLVM_SHA256 = "9667d22e7a5ccee5acc209abca172ac7fef99f67281c3099568e9eda541771f0" + LLVM_COMMIT = "e0e615efac522365591119165a7691ce869de512" + LLVM_SHA256 = "5495223e087e0fcf02375c8f0ccf7c27920d978fa2d9025788b59865049e0905" tf_http_archive( name = name, diff --git a/third_party/tsl/third_party/llvm/generated.patch b/third_party/tsl/third_party/llvm/generated.patch index 47b340f218abb3..6bb5a177cc9324 100644 --- a/third_party/tsl/third_party/llvm/generated.patch +++ b/third_party/tsl/third_party/llvm/generated.patch @@ -1,15 +1,60 @@ Auto generated patch. Do not edit or delete it, even if empty. -diff -ruN --strip-trailing-cr a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h ---- a/clang/include/clang/Frontend/FrontendOptions.h -+++ b/clang/include/clang/Frontend/FrontendOptions.h -@@ -580,7 +580,9 @@ - BuildingImplicitModuleUsesLock(true), ModulesEmbedAllFiles(false), - IncludeTimestamps(true), UseTemporary(true), - AllowPCMWithCompilerErrors(false), ModulesShareFileManager(true), -- TimeTraceGranularity(500) {} -+ EmitSymbolGraph(false), EmitExtensionSymbolGraphs(false), -+ EmitSymbolGraphSymbolLabelsForTesting(false), -+ EmitPrettySymbolGraphs(false), TimeTraceGranularity(500) {} - - /// getInputKindForExtension - Return the appropriate input kind for a file - /// extension. For example, "c" would return Language::C. +diff -ruN --strip-trailing-cr a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp ++++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +@@ -6276,15 +6276,14 @@ + bool CombinerHelper::matchCommuteConstantToRHS(MachineInstr &MI) { + Register LHS = MI.getOperand(1).getReg(); + Register RHS = MI.getOperand(2).getReg(); +- if (!getIConstantVRegVal(LHS, MRI)) { +- // Skip commuting if LHS is not a constant. But, LHS may be a +- // G_CONSTANT_FOLD_BARRIER. If so we commute as long as we don't already +- // have a constant on the RHS. +- if (MRI.getVRegDef(LHS)->getOpcode() != +- TargetOpcode::G_CONSTANT_FOLD_BARRIER) +- return false; +- } +- // Commute as long as RHS is not a constant or G_CONSTANT_FOLD_BARRIER. ++ auto *LHSDef = MRI.getVRegDef(LHS); ++ if (getIConstantVRegVal(LHS, MRI).has_value()) ++ return true; ++ ++ // LHS may be a G_CONSTANT_FOLD_BARRIER. If so we commute ++ // as long as we don't already have a constant on the RHS. ++ if (LHSDef->getOpcode() != TargetOpcode::G_CONSTANT_FOLD_BARRIER) ++ return false; + return MRI.getVRegDef(RHS)->getOpcode() != + TargetOpcode::G_CONSTANT_FOLD_BARRIER && + !getIConstantVRegVal(RHS, MRI); +diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir b/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir +--- a/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir ++++ b/llvm/test/CodeGen/AArch64/GlobalISel/combine-commute-int-const-lhs.mir +@@ -1,28 +0,0 @@ +-# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4 +-# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner %s -o - \ +-# RUN: --aarch64prelegalizercombiner-disable-rule=constant_fold_binop | FileCheck %s +- +-# `constant_fold_binop` is disabled to trigger the infinite loop in `commute_int_constant_to_rhs`. +- +---- +-name: add +-tracksRegLiveness: true +-body: | +- bb.0: +- liveins: $s0 +- +- ; CHECK-LABEL: name: add +- ; CHECK: liveins: $s0 +- ; CHECK-NEXT: {{ $}} +- ; CHECK-NEXT: %c0:_(s32) = G_CONSTANT i32 1 +- ; CHECK-NEXT: %c1:_(s32) = G_CONSTANT i32 2 +- ; CHECK-NEXT: %add:_(s32) = G_ADD %c0, %c1 +- ; CHECK-NEXT: $s0 = COPY %add(s32) +- ; CHECK-NEXT: RET_ReallyLR +- %c0:_(s32) = G_CONSTANT i32 1 +- %c1:_(s32) = G_CONSTANT i32 2 +- %add:_(s32) = G_ADD %c0, %c1 +- $s0 = COPY %add +- RET_ReallyLR +- +-... diff --git a/third_party/tsl/third_party/llvm/workspace.bzl b/third_party/tsl/third_party/llvm/workspace.bzl index be9d4839bee071..8b4c03d09646dc 100644 --- a/third_party/tsl/third_party/llvm/workspace.bzl +++ b/third_party/tsl/third_party/llvm/workspace.bzl @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" - LLVM_COMMIT = "c511c90680eecae2e4adb87f442f41d465feb0f2" - LLVM_SHA256 = "9667d22e7a5ccee5acc209abca172ac7fef99f67281c3099568e9eda541771f0" + LLVM_COMMIT = "e0e615efac522365591119165a7691ce869de512" + LLVM_SHA256 = "5495223e087e0fcf02375c8f0ccf7c27920d978fa2d9025788b59865049e0905" tf_http_archive( name = name,