Skip to content

Commit 13ac505

Browse files
XLS Teamcopybara-github
authored andcommitted
Updates LLVM usage to match [ec28be3ccac4](llvm/llvm-project@ec28be3ccac4) PiperOrigin-RevId: 862069391
1 parent 95e6660 commit 13ac505

File tree

3 files changed

+58
-236
lines changed

3 files changed

+58
-236
lines changed

dependency_support/llvm/llvm.patch

Lines changed: 53 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -1,240 +1,62 @@
11
Auto generated patch. Do not edit or delete it, even if empty.
2-
diff -ruN --strip-trailing-cr a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
3-
--- a/clang/lib/Driver/ToolChains/Clang.cpp
4-
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
5-
@@ -1065,10 +1065,6 @@
6-
A->render(Args, CmdArgs);
7-
}
8-
9-
- Args.addAllArgs(CmdArgs,
10-
- {options::OPT_D, options::OPT_U, options::OPT_I_Group,
11-
- options::OPT_F, options::OPT_embed_dir_EQ});
12-
-
13-
if (C.isOffloadingHostKind(Action::OFK_Cuda) ||
14-
JA.isDeviceOffloading(Action::OFK_Cuda)) {
15-
// Collect all enabled NVPTX architectures.
16-
@@ -1091,6 +1087,10 @@
17-
}
18-
}
19-
20-
+ Args.addAllArgs(CmdArgs,
21-
+ {options::OPT_D, options::OPT_U, options::OPT_I_Group,
22-
+ options::OPT_F, options::OPT_embed_dir_EQ});
23-
+
24-
// Add -Wp, and -Xpreprocessor if using the preprocessor.
25-
26-
// FIXME: There is a very unfortunate problem here, some troubled
27-
diff -ruN --strip-trailing-cr a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
28-
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
29-
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
30-
@@ -3642,9 +3642,23 @@
31-
void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
32-
Redeclarable<VarDecl> *D,
33-
Decl *Previous, Decl *Canon) {
34-
+ auto *VD = static_cast<VarDecl *>(D);
35-
auto *PrevVD = cast<VarDecl>(Previous);
36-
D->RedeclLink.setPrevious(PrevVD);
37-
D->First = PrevVD->First;
38-
+
39-
+ // We should keep at most one definition on the chain.
40-
+ // FIXME: Cache the definition once we've found it. Building a chain with
41-
+ // N definitions currently takes O(N^2) time here.
42-
+ if (VD->isThisDeclarationADefinition() == VarDecl::Definition) {
43-
+ for (VarDecl *CurD = PrevVD; CurD; CurD = CurD->getPreviousDecl()) {
44-
+ if (CurD->isThisDeclarationADefinition() == VarDecl::Definition) {
45-
+ Reader.mergeDefinitionVisibility(CurD, VD);
46-
+ VD->demoteThisDefinitionToDeclaration();
47-
+ break;
48-
+ }
49-
+ }
50-
+ }
2+
diff -ruN --strip-trailing-cr a/libc/src/__support/wchar/character_converter.h b/libc/src/__support/wchar/character_converter.h
3+
--- a/libc/src/__support/wchar/character_converter.h
4+
+++ b/libc/src/__support/wchar/character_converter.h
5+
@@ -77,7 +77,8 @@
516
}
527

53-
static bool isUndeducedReturnType(QualType T) {
54-
diff -ruN --strip-trailing-cr a/clang/test/Driver/cuda-arch-list.cu b/clang/test/Driver/cuda-arch-list.cu
55-
--- a/clang/test/Driver/cuda-arch-list.cu
56-
+++ b/clang/test/Driver/cuda-arch-list.cu
57-
@@ -23,6 +23,11 @@
58-
// RUN: --offload-arch=sm_60 --offload-arch=sm_70 --no-offload-arch=sm_60 %s 2>&1 \
59-
// RUN: | FileCheck -check-prefixes=DEVICE70-ONLY,HOST70-ONLY %s
8+
LIBC_INLINE int CharacterConverter::push(char8_t utf8_byte) {
9+
- uint8_t num_ones = static_cast<uint8_t>(cpp::countl_one(utf8_byte));
10+
+ uint8_t num_ones =
11+
+ static_cast<uint8_t>(cpp::countl_one(static_cast<uint8_t>(utf8_byte)));
12+
// Checking the first byte if first push
13+
if (isEmpty()) {
14+
// UTF-8 char has 1 byte total
15+
diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp b/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
16+
--- a/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
17+
+++ b/llvm/lib/Transforms/Instrumentation/MemProfUse.cpp
18+
@@ -910,11 +910,8 @@
6019

61-
+// Verify that user-specified -D__CUDA_ARCH_LIST__ overrides the driver-generated one
62-
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nocudainc -nocudalib \
63-
+// RUN: --offload-arch=sm_60 -D__CUDA_ARCH_LIST__=999 %s 2>&1 \
64-
+// RUN: | FileCheck -check-prefixes=DEVICE-OVERRIDE,HOST-OVERRIDE %s
65-
+
66-
// DEVICE60: "-cc1" "-triple" "nvptx64-nvidia-cuda"
67-
// DEVICE60-SAME: "-target-cpu" "sm_60"
68-
// DEVICE60-SAME: "-D__CUDA_ARCH_LIST__=600"
69-
@@ -54,3 +59,12 @@
70-
71-
// HOST70-ONLY: "-cc1" "-triple" "x86_64-unknown-linux-gnu"
72-
// HOST70-ONLY-SAME: "-D__CUDA_ARCH_LIST__=700"
20+
if (!DataAccessProf) {
21+
M.addModuleFlag(Module::Warning, "EnableDataAccessProf", 0U);
22+
- M.getContext().diagnose(DiagnosticInfoPGOProfile(
23+
- MemoryProfileFileName.data(),
24+
- StringRef("Data access profiles not found in memprof. Ignore "
25+
- "-memprof-annotate-static-data-prefix."),
26+
- DS_Warning));
27+
+ // FIXME: Add a diagnostic message without failing the compilation when
28+
+ // data access profile payload is not available.
29+
return false;
30+
}
31+
M.addModuleFlag(Module::Warning, "EnableDataAccessProf", 1U);
32+
diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/fptoi-256.ll b/llvm/test/CodeGen/AArch64/fptoi-256.ll
33+
--- a/llvm/test/CodeGen/AArch64/fptoi-256.ll
34+
+++ b/llvm/test/CodeGen/AArch64/fptoi-256.ll
35+
@@ -0,0 +1,11 @@
36+
+; RUN: llc -mtriple=aarch64 < %s
7337
+
74-
+// DEVICE-OVERRIDE: "-cc1" "-triple" "nvptx64-nvidia-cuda"
75-
+// DEVICE-OVERRIDE-SAME: "-target-cpu" "sm_60"
76-
+// DEVICE-OVERRIDE-SAME: "-D__CUDA_ARCH_LIST__=600"
77-
+// DEVICE-OVERRIDE-SAME: "-D" "__CUDA_ARCH_LIST__=999"
38+
+define i256 @doubletosi256(double %a) {
39+
+ %conv = fptosi double %a to i256
40+
+ ret i256 %conv
41+
+}
7842
+
79-
+// HOST-OVERRIDE: "-cc1" "-triple" "x86_64-unknown-linux-gnu"
80-
+// HOST-OVERRIDE-SAME: "-D__CUDA_ARCH_LIST__=600"
81-
+// HOST-OVERRIDE-SAME: "-D" "__CUDA_ARCH_LIST__=999"
82-
diff -ruN --strip-trailing-cr a/clang/test/Modules/pr149404-02.cppm b/clang/test/Modules/pr149404-02.cppm
83-
--- a/clang/test/Modules/pr149404-02.cppm
84-
+++ b/clang/test/Modules/pr149404-02.cppm
85-
@@ -1,104 +0,0 @@
86-
-// RUN: rm -rf %t
87-
-// RUN: mkdir -p %t
88-
-// RUN: split-file %s %t
89-
-
90-
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -o %t/format.pcm %t/format.cppm
91-
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -o %t/includes_in_gmf.pcm %t/includes_in_gmf.cppm
92-
-// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/test.cpp -verify -fsyntax-only
93-
-
94-
-// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -o %t/format.pcm %t/format.cppm
95-
-// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -o %t/includes_in_gmf.pcm %t/includes_in_gmf.cppm
96-
-// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/test.cpp -verify -fsyntax-only
97-
-
98-
-//--- format.h
99-
-#pragma once
100-
-
101-
-namespace test {
102-
-
103-
-template <class _Tp>
104-
-struct type_identity {
105-
- typedef _Tp type;
106-
-};
107-
-
108-
-template <class _Tp>
109-
-using type_identity_t = typename type_identity<_Tp>::type;
110-
-
111-
-
112-
-template <class _Tp, class _CharT>
113-
-struct formatter
114-
-{
115-
- formatter() = delete;
116-
-};
117-
-
118-
-template <>
119-
-struct formatter<char, char>
120-
-{};
121-
-
122-
-template <class _CharT, class... _Args>
123-
-struct basic_format_string {
124-
- static inline const int __handles_{ [] {
125-
- formatter<char, _CharT> f;
126-
- (void)f;
127-
- return 0;
128-
- }() };
129-
-
130-
- consteval basic_format_string(const _CharT*) {
131-
- (void)__handles_;
132-
- }
133-
-};
134-
-
135-
-template <class... _Args>
136-
-using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
137-
-
138-
-template <class... _Args>
139-
-using format_string = basic_format_string<char, type_identity_t<_Args>...>;
140-
-
141-
-template <class... _Args>
142-
-void format(format_string<_Args...> __fmt, _Args&&... __args) {}
143-
-
144-
-template <class... _Args>
145-
-void format(wformat_string<_Args...> __fmt, _Args&&... __args) {}
146-
-
147-
-}
148-
-
149-
-//--- format.cppm
150-
-module;
151-
-#include "format.h"
152-
-export module format;
153-
-
154-
-export namespace test {
155-
- using test::format;
156-
- using test::formatter;
157-
- using test::format_string;
158-
-}
159-
-
160-
-auto something() -> void
161-
-{
162-
- auto a = 'a';
163-
- test::format("{}", a);
164-
-}
165-
-
166-
-//--- includes_in_gmf.cppm
167-
-module;
168-
-#include "format.h"
169-
-export module includes_in_gmf;
170-
-
171-
-namespace test {
172-
- using test::format;
173-
- using test::formatter;
174-
- using test::format_string;
43+
+define double @si256todouble(i256 %a) {
44+
+ %conv = sitofp i256 %a to double
45+
+ ret double %conv
46+
+}
47+
diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/fptoi-256.ll b/llvm/test/CodeGen/fptoi-256.ll
48+
--- a/llvm/test/CodeGen/fptoi-256.ll
49+
+++ b/llvm/test/CodeGen/fptoi-256.ll
50+
@@ -1,12 +0,0 @@
51+
-; REQUIRES: aarch64-registered-target
52+
-; RUN: llc -mtriple=aarch64 < %s
53+
-
54+
-define i256 @doubletosi256(double %a) {
55+
- %conv = fptosi double %a to i256
56+
- ret i256 %conv
17557
-}
17658
-
177-
-//--- test.cpp
178-
-// expected-no-diagnostics
179-
-import format;
180-
-import includes_in_gmf;
181-
-
182-
-auto what() -> void
183-
-{
184-
- auto a = 'a';
185-
- test::format("{}", a);
186-
-
187-
- constexpr auto fs = "{}"; // test::format_string<char>{ "{}" }; // <- same result even passing exact param type
188-
- test::format(fs, 'r');
59+
-define double @si256todouble(i256 %a) {
60+
- %conv = sitofp i256 %a to double
61+
- ret double %conv
18962
-}
190-
diff -ruN --strip-trailing-cr a/clang/test/Modules/pr172241.cppm b/clang/test/Modules/pr172241.cppm
191-
--- a/clang/test/Modules/pr172241.cppm
192-
+++ b/clang/test/Modules/pr172241.cppm
193-
@@ -1,47 +0,0 @@
194-
-// RUN: rm -rf %t
195-
-// RUN: mkdir -p %t
196-
-// RUN: split-file %s %t
197-
-//
198-
-// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/m.cppm -emit-module-interface -o %t/m.pcm
199-
-// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/use.cpp -fmodule-file=m=%t/m.pcm -emit-llvm -o - | FileCheck %t/use.cpp
200-
-//
201-
-// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm
202-
-// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/use.cpp -fmodule-file=m=%t/m.pcm -emit-llvm -o - | FileCheck %t/use.cpp
203-
-
204-
-//--- header.h
205-
-#pragma once
206-
-
207-
-template <unsigned T>
208-
-class Templ {
209-
-public:
210-
- void lock() { __set_locked_bit(); }
211-
-
212-
-private:
213-
- static constexpr auto __set_locked_bit = [](){};
214-
-};
215-
-
216-
-class JT {
217-
-public:
218-
- ~JT() {
219-
- Templ<4> state;
220-
- state.lock();
221-
- }
222-
-};
223-
-
224-
-//--- m.cppm
225-
-module;
226-
-#include "header.h"
227-
-export module m;
228-
-export struct M {
229-
- JT jt;
230-
-};
231-
-//--- use.cpp
232-
-#include "header.h"
233-
-import m;
234-
-
235-
-int main() {
236-
- M m;
237-
- return 0;
238-
-}
239-
-
240-
-// CHECK: @_ZN5TemplILj4EE16__set_locked_bitE = {{.*}}linkonce_odr

dependency_support/llvm/workspace.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2020
def repo():
2121
"""Initialize the llvm-project repository."""
2222

23-
LLVM_COMMIT = "01e6245af481dac4604e8a25be6bec0dbe36f99d"
24-
LLVM_SHA256 = "3387b340f1734dca6544e043c53c9964545e2a4b6e9c426c84a23ad914b7047c"
23+
LLVM_COMMIT = "ec28be3ccac432ea6a45eca67249b209be216c0a"
24+
LLVM_SHA256 = "f817108a98dc666bbf5590743670ee0d529ad6ddb4afd659b11540d2834ecb28"
2525

2626
maybe(
2727
http_archive,

xls/jit/ir_builder_visitor.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ absl::Status InvokeStringStepCallback(llvm::IRBuilder<>* builder,
595595
const std::string& step_string,
596596
llvm::Value* buffer_ptr,
597597
llvm::Value* instance_ctx) {
598-
llvm::Constant* step_constant = builder->CreateGlobalStringPtr(step_string);
598+
llvm::Constant* step_constant = builder->CreateGlobalString(step_string);
599599
InvokeCallback<InstanceContext::kPerformStringStepOffset>(
600600
builder, llvm::Type::getVoidTy(builder->getContext()), instance_ctx,
601601
{step_constant, buffer_ptr});
@@ -619,7 +619,7 @@ absl::Status InvokeFormatStepCallback(
619619
auto proto_str = operand_type->ToProto().SerializeAsString();
620620
llvm::ConstantInt* proto_len =
621621
llvm::ConstantInt::get(i64_type, proto_str.size());
622-
llvm::Constant* proto_llvm_str = builder->CreateGlobalStringPtr(proto_str);
622+
llvm::Constant* proto_llvm_str = builder->CreateGlobalString(proto_str);
623623
InvokeCallback<InstanceContext::kPerformFormatStepOffset>(
624624
builder, void_type, instance_ctx,
625625
{jit_runtime_ptr, proto_llvm_str, proto_len, operand, llvm_format,
@@ -658,7 +658,7 @@ absl::Status InvokeAssertCallback(llvm::IRBuilder<>* builder,
658658
const std::string& message,
659659
llvm::Value* interpreter_events_ptr,
660660
llvm::Value* instance_ctx) {
661-
llvm::Constant* msg_constant = builder->CreateGlobalStringPtr(message);
661+
llvm::Constant* msg_constant = builder->CreateGlobalString(message);
662662
llvm::Type* void_type = llvm::Type::getVoidTy(builder->getContext());
663663

664664
InvokeCallback<InstanceContext::kRecordAssertionOffset>(

0 commit comments

Comments
 (0)