Skip to content

Commit 8233497

Browse files
author
git apple-llvm automerger
committed
Merge commit 'a6ba74e471ac' from llvm.org/main into experimental/cas/main
2 parents 5061218 + a6ba74e commit 8233497

File tree

28 files changed

+541
-196
lines changed

28 files changed

+541
-196
lines changed

clang/lib/CodeGen/CGCleanup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
782782
if (!RequiresNormalCleanup) {
783783
// Mark CPP scope end for passed-by-value Arg temp
784784
// per Windows ABI which is "normally" Cleanup in callee
785-
if (IsEHa && getInvokeDest()) {
785+
if (IsEHa && getInvokeDest() && Builder.GetInsertBlock()) {
786786
if (Personality.isMSVCXXPersonality())
787787
EmitSehCppScopeEnd();
788788
}
@@ -1031,6 +1031,8 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
10311031
if (!Personality.isMSVCPersonality()) {
10321032
EHStack.pushTerminate();
10331033
PushedTerminate = true;
1034+
} else if (IsEHa && getInvokeDest()) {
1035+
EmitSehCppScopeEnd();
10341036
}
10351037

10361038
// We only actually emit the cleanup code if the cleanup is either

clang/test/CodeGen/windows-seh-EHa-CppCatchReturn.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,20 @@ void foo() {
1212
return;
1313
}
1414
}
15+
16+
__declspec(noreturn) void bar();
17+
class baz {
18+
public:
19+
~baz();
20+
};
21+
22+
// CHECK: define dso_local void @"?qux@@YAXXZ
23+
// CHECK: invoke void @llvm.seh.scope.begin()
24+
// CHECK-NOT: llvm.seh.try
25+
// CHECK-NOT: llvm.seh.scope.end
26+
27+
// We don't need to generate llvm.seh.scope.end for unreachable.
28+
void qux() {
29+
baz a;
30+
bar();
31+
}

compiler-rt/test/builtins/Unit/divmodti4_test.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// XFAIL: target=aarch64-{{.*}}-windows-{{.*}}
21
// RUN: %clang_builtins %s %librt -o %t && %run %t
32
// REQUIRES: librt_has_divmodti4
43
// REQUIRES: int128

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ set(files
568568
__ranges/views.h
569569
__ranges/zip_view.h
570570
__split_buffer
571-
__std_stream
572571
__string/char_traits.h
573572
__string/constexpr_c_functions.h
574573
__string/extern_template_lists.h

libcxx/include/libcxx.imp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
{ include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] },
99
{ include: [ "<__split_buffer>", "private", "<deque>", "public" ] },
1010
{ include: [ "<__split_buffer>", "private", "<vector>", "public" ] },
11-
{ include: [ "<__std_stream>", "private", "<iostream>", "public" ] },
1211
{ include: [ "<__threading_support>", "private", "<atomic>", "public" ] },
1312
{ include: [ "<__threading_support>", "private", "<mutex>", "public" ] },
1413
{ include: [ "<__threading_support>", "private", "<semaphore>", "public" ] },

libcxx/include/module.modulemap.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,10 +1725,6 @@ module std [system] {
17251725
module __mbstate_t { private header "__mbstate_t.h" export * }
17261726
module __node_handle { private header "__node_handle" export * }
17271727
module __split_buffer { private header "__split_buffer" export * }
1728-
module __std_stream {
1729-
@requires_LIBCXX_ENABLE_LOCALIZATION@
1730-
private header "__std_stream" export *
1731-
}
17321728
module __threading_support { header "__threading_support" export * }
17331729
module __tree { header "__tree" export * }
17341730
module __undef_macros { header "__undef_macros" export * }
File renamed without changes.

libcxx/src/iostream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <__locale>
10-
#include <__std_stream>
10+
#include "__std_stream"
1111
#include <new>
1212
#include <string>
1313

libcxx/test/libcxx/private_headers.verify.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ END-SCRIPT
599599
#include <__ranges/views.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/views.h'}}
600600
#include <__ranges/zip_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/zip_view.h'}}
601601
#include <__split_buffer> // expected-error@*:* {{use of private header from outside its module: '__split_buffer'}}
602-
#include <__std_stream> // expected-error@*:* {{use of private header from outside its module: '__std_stream'}}
603602
#include <__string/char_traits.h> // expected-error@*:* {{use of private header from outside its module: '__string/char_traits.h'}}
604603
#include <__string/constexpr_c_functions.h> // expected-error@*:* {{use of private header from outside its module: '__string/constexpr_c_functions.h'}}
605604
#include <__string/extern_template_lists.h> // expected-error@*:* {{use of private header from outside its module: '__string/extern_template_lists.h'}}

libcxx/utils/data/ignore_format.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ libcxx/include/stdexcept
592592
libcxx/include/stdint.h
593593
libcxx/include/stdio.h
594594
libcxx/include/stdlib.h
595-
libcxx/include/__std_stream
596595
libcxx/include/streambuf
597596
libcxx/include/string
598597
libcxx/include/__string/char_traits.h
@@ -806,6 +805,7 @@ libcxx/src/random_shuffle.cpp
806805
libcxx/src/regex.cpp
807806
libcxx/src/shared_mutex.cpp
808807
libcxx/src/stdexcept.cpp
808+
libcxx/src/__std_stream
809809
libcxx/src/string.cpp
810810
libcxx/src/strstream.cpp
811811
libcxx/src/support/ibm/mbsnrtowcs.cpp

libcxx/utils/generate_iwyu_mapping.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def generate_map(include):
5353
elif i == '__mutex_base': continue
5454
elif i == '__node_handle': public = ['map', 'set', 'unordered_map', 'unordered_set']
5555
elif i == '__split_buffer': public = ['deque', 'vector']
56-
elif i == '__std_stream': public = ['iostream']
5756
elif i == '__threading_support': public = ['atomic', 'mutex', 'semaphore', 'thread']
5857
elif i == '__tree': public = ['map', 'set']
5958
elif i == '__undef_macros': continue

libcxx/utils/libcxx/test/features.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ def _getSuitableClangTidy(cfg):
240240
DEFAULT_FEATURES += [
241241
Feature(name='darwin', when=lambda cfg: '__APPLE__' in compilerMacros(cfg)),
242242
Feature(name='windows', when=lambda cfg: '_WIN32' in compilerMacros(cfg)),
243-
Feature(name='windows-dll', when=lambda cfg: '_WIN32' in compilerMacros(cfg) and programSucceeds(cfg, """
243+
Feature(name='windows-dll', when=lambda cfg: '_WIN32' in compilerMacros(cfg) and sourceBuilds(cfg, """
244+
#include <iostream>
245+
int main(int, char**) { return 0; }
246+
""") and programSucceeds(cfg, """
244247
#include <iostream>
245248
#include <windows.h>
246249
#include <winnt.h>

libcxxabi/test/catch_ptr_02.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.9
1818

1919
#include <cassert>
20+
#include <stdint.h>
2021

2122
#if __cplusplus < 201103L
2223
#define DISABLE_NULLPTR_TESTS
@@ -136,7 +137,7 @@ void test7 ()
136137
assert(false);
137138
}
138139
catch (base2 *p) {
139-
assert ((unsigned long)p == 12+sizeof(base1));
140+
assert ((uintptr_t)p == 12+sizeof(base1));
140141
}
141142
catch (...)
142143
{

llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <unordered_map>
2323

2424
namespace llvm {
25-
class Any;
2625
class BasicBlock;
2726
class Function;
2827
class Instruction;

llvm/test/Analysis/ScalarEvolution/guards.ll

Lines changed: 77 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
12
; RUN: opt -S -passes=indvars < %s | FileCheck %s
23

34
; Check that SCEV is able to recognize and use guards to prove
@@ -13,17 +14,27 @@ declare void @llvm.experimental.guard(i1, ...)
1314
declare void @use(i64 %x)
1415

1516
define void @test_1(ptr %cond_buf, ptr %len_buf) {
16-
; CHECK-LABEL: @test_1(
17+
; CHECK-LABEL: define void @test_1
18+
; CHECK-SAME: (ptr [[COND_BUF:%.*]], ptr [[LEN_BUF:%.*]]) {
19+
; CHECK-NEXT: entry:
20+
; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[LEN_BUF]], align 4, !range [[RNG0:![0-9]+]]
21+
; CHECK-NEXT: br label [[LOOP:%.*]]
22+
; CHECK: loop:
23+
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_INC:%.*]], [[LOOP]] ]
24+
; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], 1
25+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 true) [ "deopt"() ]
26+
; CHECK-NEXT: [[IV_INC_CMP:%.*]] = icmp ult i32 [[IV_INC]], [[LEN]]
27+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[IV_INC_CMP]]) [ "deopt"() ]
28+
; CHECK-NEXT: [[BECOND:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
29+
; CHECK-NEXT: br i1 [[BECOND]], label [[LOOP]], label [[LEAVE:%.*]]
30+
; CHECK: leave:
31+
; CHECK-NEXT: ret void
32+
;
1733
entry:
1834
%len = load i32, ptr %len_buf, !range !{i32 1, i32 2147483648}
1935
br label %loop
2036

2137
loop:
22-
; CHECK: loop:
23-
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 true) [ "deopt"() ]
24-
; CHECK: %iv.inc.cmp = icmp ult i32 %iv.inc, %len
25-
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %iv.inc.cmp) [ "deopt"() ]
26-
; CHECK: leave:
2738

2839
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
2940
%iv.inc = add i32 %iv, 1
@@ -42,21 +53,30 @@ leave:
4253
}
4354

4455
define void @test_2(i32 %n, ptr %len_buf) {
45-
; CHECK-LABEL: @test_2(
46-
; CHECK: [[LEN_ZEXT:%[^ ]+]] = zext i32 %len to i64
47-
; CHECK: br label %loop
56+
; CHECK-LABEL: define void @test_2
57+
; CHECK-SAME: (i32 [[N:%.*]], ptr [[LEN_BUF:%.*]]) {
58+
; CHECK-NEXT: entry:
59+
; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[LEN_BUF]], align 4, !range [[RNG1:![0-9]+]]
60+
; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[LEN]] to i64
61+
; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[N]] to i64
62+
; CHECK-NEXT: br label [[LOOP:%.*]]
63+
; CHECK: loop:
64+
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY:%.*]] ]
65+
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
66+
; CHECK-NEXT: call void @use(i64 [[INDVARS_IV]])
67+
; CHECK-NEXT: [[IV_INC_CMP:%.*]] = icmp ult i64 [[INDVARS_IV_NEXT]], [[TMP0]]
68+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[IV_INC_CMP]]) [ "deopt"() ]
69+
; CHECK-NEXT: [[BECOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[TMP1]]
70+
; CHECK-NEXT: br i1 [[BECOND]], label [[LOOP]], label [[LEAVE:%.*]]
71+
; CHECK: leave:
72+
; CHECK-NEXT: ret void
73+
;
4874

4975
entry:
5076
%len = load i32, ptr %len_buf, !range !{i32 0, i32 2147483648}
5177
br label %loop
5278

5379
loop:
54-
; CHECK: loop:
55-
; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %loop ], [ 0, %entry ]
56-
; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
57-
; CHECK: %iv.inc.cmp = icmp ult i64 %indvars.iv.next, [[LEN_ZEXT]]
58-
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %iv.inc.cmp) [ "deopt"() ]
59-
; CHECK: leave:
6080

6181
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
6282
%iv.inc = add i32 %iv, 1
@@ -75,7 +95,24 @@ leave:
7595
}
7696

7797
define void @test_3(ptr %cond_buf, ptr %len_buf) {
78-
; CHECK-LABEL: @test_3(
98+
; CHECK-LABEL: define void @test_3
99+
; CHECK-SAME: (ptr [[COND_BUF:%.*]], ptr [[LEN_BUF:%.*]]) {
100+
; CHECK-NEXT: entry:
101+
; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[LEN_BUF]], align 4
102+
; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp sgt i32 [[LEN]], 0
103+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[ENTRY_COND]]) [ "deopt"() ]
104+
; CHECK-NEXT: br label [[LOOP:%.*]]
105+
; CHECK: loop:
106+
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_INC:%.*]], [[LOOP]] ]
107+
; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], 1
108+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 true) [ "deopt"() ]
109+
; CHECK-NEXT: [[IV_INC_CMP:%.*]] = icmp slt i32 [[IV_INC]], [[LEN]]
110+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[IV_INC_CMP]]) [ "deopt"() ]
111+
; CHECK-NEXT: [[BECOND:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
112+
; CHECK-NEXT: br i1 [[BECOND]], label [[LOOP]], label [[LEAVE:%.*]]
113+
; CHECK: leave:
114+
; CHECK-NEXT: ret void
115+
;
79116

80117
entry:
81118
%len = load i32, ptr %len_buf
@@ -84,11 +121,6 @@ entry:
84121
br label %loop
85122

86123
loop:
87-
; CHECK: loop:
88-
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 true) [ "deopt"() ]
89-
; CHECK: %iv.inc.cmp = icmp slt i32 %iv.inc, %len
90-
; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %iv.inc.cmp) [ "deopt"() ]
91-
; CHECK: leave:
92124
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
93125
%iv.inc = add i32 %iv, 1
94126

@@ -106,7 +138,30 @@ leave:
106138
}
107139

108140
define void @test_4(ptr %cond_buf, ptr %len_buf) {
109-
; CHECK-LABEL: @test_4(
141+
; CHECK-LABEL: define void @test_4
142+
; CHECK-SAME: (ptr [[COND_BUF:%.*]], ptr [[LEN_BUF:%.*]]) {
143+
; CHECK-NEXT: entry:
144+
; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[LEN_BUF]], align 4
145+
; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp sgt i32 [[LEN]], 0
146+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[ENTRY_COND]]) [ "deopt"() ]
147+
; CHECK-NEXT: br label [[LOOP:%.*]]
148+
; CHECK: loop:
149+
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_INC:%.*]], [[BE:%.*]] ]
150+
; CHECK-NEXT: [[IV_INC]] = add i32 [[IV]], 1
151+
; CHECK-NEXT: [[COND:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
152+
; CHECK-NEXT: br i1 [[COND]], label [[LEFT:%.*]], label [[BE]]
153+
; CHECK: left:
154+
; CHECK-NEXT: [[IV_INC_CMP:%.*]] = icmp slt i32 [[IV_INC]], [[LEN]]
155+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[IV_INC_CMP]]) [ "deopt"() ]
156+
; CHECK-NEXT: br label [[BE]]
157+
; CHECK: be:
158+
; CHECK-NEXT: [[IV_CMP:%.*]] = icmp slt i32 [[IV]], [[LEN]]
159+
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[IV_CMP]]) [ "deopt"() ]
160+
; CHECK-NEXT: [[BECOND:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
161+
; CHECK-NEXT: br i1 [[BECOND]], label [[LOOP]], label [[LEAVE:%.*]]
162+
; CHECK: leave:
163+
; CHECK-NEXT: ret void
164+
;
110165

111166
entry:
112167
%len = load i32, ptr %len_buf
@@ -128,10 +183,6 @@ left:
128183
br label %be
129184

130185
be:
131-
; CHECK: be:
132-
; CHECK-NEXT: %iv.cmp = icmp slt i32 %iv, %len
133-
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 %iv.cmp) [ "deopt"() ]
134-
; CHECK: leave:
135186

136187
%iv.cmp = icmp slt i32 %iv, %len
137188
call void(i1, ...) @llvm.experimental.guard(i1 %iv.cmp) [ "deopt"() ]

llvm/test/Transforms/GVNHoist/pr30216.ll

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
12
; RUN: opt -S -passes=gvn-hoist < %s | FileCheck %s
23

34
; Make sure the two stores @B do not get hoisted past the load @B.
45

5-
; CHECK-LABEL: define ptr @Foo
6-
; CHECK: store
7-
; CHECK: store
8-
; CHECK: load
9-
; CHECK: store
10-
116
@A = external global i8
127
@B = external global ptr
138

149
define ptr @Foo() {
10+
; CHECK-LABEL: define ptr @Foo() {
11+
; CHECK-NEXT: store i8 0, ptr @A, align 1
12+
; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
13+
; CHECK: if.then:
14+
; CHECK-NEXT: store ptr null, ptr @B, align 8
15+
; CHECK-NEXT: ret ptr null
16+
; CHECK: if.else:
17+
; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @B, align 8
18+
; CHECK-NEXT: store ptr null, ptr @B, align 8
19+
; CHECK-NEXT: ret ptr [[TMP1]]
20+
;
1521
store i8 0, ptr @A
1622
br i1 undef, label %if.then, label %if.else
1723

@@ -27,16 +33,21 @@ if.else:
2733

2834
; Make sure the two stores @B do not get hoisted past the store @GlobalVar.
2935

30-
; CHECK-LABEL: define ptr @Fun
31-
; CHECK: store
32-
; CHECK: store
33-
; CHECK: store
34-
; CHECK: store
35-
; CHECK: load
36-
3736
@GlobalVar = internal global i8 0
3837

3938
define ptr @Fun() {
39+
; CHECK-LABEL: define ptr @Fun() {
40+
; CHECK-NEXT: store i8 0, ptr @A, align 1
41+
; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
42+
; CHECK: if.then:
43+
; CHECK-NEXT: store ptr null, ptr @B, align 8
44+
; CHECK-NEXT: ret ptr null
45+
; CHECK: if.else:
46+
; CHECK-NEXT: store i8 0, ptr @GlobalVar, align 1
47+
; CHECK-NEXT: store ptr null, ptr @B, align 8
48+
; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @B, align 8
49+
; CHECK-NEXT: ret ptr [[TMP1]]
50+
;
4051
store i8 0, ptr @A
4152
br i1 undef, label %if.then, label %if.else
4253

0 commit comments

Comments
 (0)