Skip to content

Commit d7d5170

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:4c59f809c926 into amd-gfx:1347e75c19d8
Local branch amd-gfx 1347e75 Merged main:4c1c96e6fc0f into amd-gfx:b38cf8a980c5 Remote branch main 4c59f80 Coroutines: Cleanup typed pointer code in CoroFrame.cpp. NFC
2 parents 1347e75 + 4c59f80 commit d7d5170

File tree

15 files changed

+819
-123
lines changed

15 files changed

+819
-123
lines changed

clang/lib/Format/Format.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ namespace llvm {
6161
namespace yaml {
6262
template <>
6363
struct ScalarEnumerationTraits<FormatStyle::BreakBeforeNoexceptSpecifierStyle> {
64-
static void enumeration(IO &IO,
65-
FormatStyle::BreakBeforeNoexceptSpecifierStyle &Value) {
64+
static void
65+
enumeration(IO &IO, FormatStyle::BreakBeforeNoexceptSpecifierStyle &Value) {
6666
IO.enumCase(Value, "Never", FormatStyle::BBNSS_Never);
6767
IO.enumCase(Value, "OnlyWithParen", FormatStyle::BBNSS_OnlyWithParen);
6868
IO.enumCase(Value, "Always", FormatStyle::BBNSS_Always);
@@ -3779,16 +3779,6 @@ tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style,
37793779
return NamespaceEndCommentsFixer(*Env, Style).process().first;
37803780
}
37813781

3782-
tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style,
3783-
StringRef Code,
3784-
ArrayRef<tooling::Range> Ranges,
3785-
StringRef FileName) {
3786-
auto Env = Environment::make(Code, FileName, Ranges);
3787-
if (!Env)
3788-
return {};
3789-
return DefinitionBlockSeparator(*Env, Style).process().first;
3790-
}
3791-
37923782
tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
37933783
StringRef Code,
37943784
ArrayRef<tooling::Range> Ranges,

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ void WhitespaceManager::alignTrailingComments() {
10621062
const int OriginalSpaces =
10631063
C.OriginalWhitespaceRange.getEnd().getRawEncoding() -
10641064
C.OriginalWhitespaceRange.getBegin().getRawEncoding() -
1065-
C.Tok->NewlinesBefore;
1065+
C.Tok->LastNewlineOffset;
10661066
assert(OriginalSpaces >= 0);
10671067
const auto RestoredLineLength =
10681068
C.StartOfTokenColumn + C.TokenLength + OriginalSpaces;

clang/unittests/Format/FormatTestComments.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,12 @@ TEST_F(FormatTestComments, AlignTrailingCommentsLeave) {
30533053
"}",
30543054
Style);
30553055

3056+
Style.AlignEscapedNewlines = FormatStyle::ENAS_Left;
3057+
verifyNoChange("#define FOO \\\n"
3058+
" /* foo(); */ \\\n"
3059+
" bar();",
3060+
Style);
3061+
30563062
// Allow to keep 2 empty lines
30573063
Style.MaxEmptyLinesToKeep = 2;
30583064
EXPECT_EQ("// do not touch\n"

compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ _ZN11__sanitizer16internal_iserrorEjPi U
1111
_ZN11__sanitizer16internal_iserrorEmPi U
1212
_ZN11__sanitizer17internal_snprintfEPcjPKcz U
1313
_ZN11__sanitizer17internal_snprintfEPcmPKcz U
14+
__aarch64_cas8_acq_rel U
15+
__aarch64_ldadd4_acq_rel U
16+
__aarch64_ldadd8_acq_rel U
17+
__aarch64_ldadd8_relax U
18+
__aarch64_swp8_acq_rel U
1419
__ashldi3 U
1520
__ashrdi3 U
1621
__ctype_b_loc U

compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void WriteMemoryProfile(char *buf, uptr buf_size, u64 uptime_ns) {
152152
#if !SANITIZER_GO
153153
// Mark shadow for .rodata sections with the special Shadow::kRodata marker.
154154
// Accesses to .rodata can't race, so this saves time, memory and trace space.
155-
static void MapRodata() {
155+
static NOINLINE void MapRodata(char* buffer, uptr size) {
156156
// First create temp file.
157157
const char *tmpdir = GetEnv("TMPDIR");
158158
if (tmpdir == 0)
@@ -163,13 +163,12 @@ static void MapRodata() {
163163
#endif
164164
if (tmpdir == 0)
165165
return;
166-
char name[256];
167-
internal_snprintf(name, sizeof(name), "%s/tsan.rodata.%d",
166+
internal_snprintf(buffer, size, "%s/tsan.rodata.%d",
168167
tmpdir, (int)internal_getpid());
169-
uptr openrv = internal_open(name, O_RDWR | O_CREAT | O_EXCL, 0600);
168+
uptr openrv = internal_open(buffer, O_RDWR | O_CREAT | O_EXCL, 0600);
170169
if (internal_iserror(openrv))
171170
return;
172-
internal_unlink(name); // Unlink it now, so that we can reuse the buffer.
171+
internal_unlink(buffer); // Unlink it now, so that we can reuse the buffer.
173172
fd_t fd = openrv;
174173
// Fill the file with Shadow::kRodata.
175174
const uptr kMarkerSize = 512 * 1024 / sizeof(RawShadow);
@@ -188,8 +187,8 @@ static void MapRodata() {
188187
}
189188
// Map the file into shadow of .rodata sections.
190189
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
191-
// Reusing the buffer 'name'.
192-
MemoryMappedSegment segment(name, ARRAY_SIZE(name));
190+
// Reusing the buffer 'buffer'.
191+
MemoryMappedSegment segment(buffer, size);
193192
while (proc_maps.Next(&segment)) {
194193
if (segment.filename[0] != 0 && segment.filename[0] != '[' &&
195194
segment.IsReadable() && segment.IsExecutable() &&
@@ -209,7 +208,8 @@ static void MapRodata() {
209208
}
210209

211210
void InitializeShadowMemoryPlatform() {
212-
MapRodata();
211+
char buffer[256]; // Keep in a different frame.
212+
MapRodata(buffer, sizeof(buffer));
213213
}
214214

215215
#endif // #if !SANITIZER_GO

libcxx/test/std/experimental/simd/test_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ struct TestAllSimdAbiFunctor {
4040
}
4141
};
4242

43-
// TODO: Support long double (12 bytes) for MinGW (DLL, i686)
44-
#ifdef __MINGW32__
43+
// TODO: Support long double (12 bytes) for 32-bits x86
44+
#ifdef __i386__
4545
using arithmetic_no_bool_types = types::concatenate_t<types::integer_types, types::type_list<float, double>>;
4646
#else
4747
using arithmetic_no_bool_types = types::concatenate_t<types::integer_types, types::floating_point_types>;

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 475777
19+
#define LLVM_MAIN_REVISION 475785
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,15 +1682,6 @@ static Instruction *splitBeforeCatchSwitch(CatchSwitchInst *CatchSwitch) {
16821682
return CleanupRet;
16831683
}
16841684

1685-
static void createFramePtr(coro::Shape &Shape) {
1686-
auto *CB = Shape.CoroBegin;
1687-
IRBuilder<> Builder(CB->getNextNode());
1688-
StructType *FrameTy = Shape.FrameTy;
1689-
PointerType *FramePtrTy = FrameTy->getPointerTo();
1690-
Shape.FramePtr =
1691-
cast<Instruction>(Builder.CreateBitCast(CB, FramePtrTy, "FramePtr"));
1692-
}
1693-
16941685
// Replace all alloca and SSA values that are accessed across suspend points
16951686
// with GetElementPointer from coroutine frame + loads and stores. Create an
16961687
// AllocaSpillBB that will become the new entry block for the resume parts of
@@ -1702,7 +1693,6 @@ static void createFramePtr(coro::Shape &Shape) {
17021693
// becomes:
17031694
//
17041695
// %hdl = coro.begin(...)
1705-
// %FramePtr = bitcast i8* hdl to %f.frame*
17061696
// br label %AllocaSpillBB
17071697
//
17081698
// AllocaSpillBB:
@@ -1781,8 +1771,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
17811771
Type *ByValTy = nullptr;
17821772
if (auto *Arg = dyn_cast<Argument>(Def)) {
17831773
// For arguments, we will place the store instruction right after
1784-
// the coroutine frame pointer instruction, i.e. bitcast of
1785-
// coro.begin from i8* to %f.frame*.
1774+
// the coroutine frame pointer instruction, i.e. coro.begin.
17861775
InsertPt = Shape.getInsertPtAfterFramePtr()->getIterator();
17871776

17881777
// If we're spilling an Argument, make sure we clear 'nocapture'
@@ -1987,16 +1976,12 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
19871976
// to the pointer in the frame.
19881977
for (const auto &Alias : A.Aliases) {
19891978
auto *FramePtr = GetFramePointer(Alloca);
1990-
auto *FramePtrRaw =
1991-
Builder.CreateBitCast(FramePtr, Type::getInt8PtrTy(C));
19921979
auto &Value = *Alias.second;
19931980
auto ITy = IntegerType::get(C, Value.getBitWidth());
1994-
auto *AliasPtr = Builder.CreateGEP(Type::getInt8Ty(C), FramePtrRaw,
1981+
auto *AliasPtr = Builder.CreateGEP(Type::getInt8Ty(C), FramePtr,
19951982
ConstantInt::get(ITy, Value));
1996-
auto *AliasPtrTyped =
1997-
Builder.CreateBitCast(AliasPtr, Alias.first->getType());
19981983
Alias.first->replaceUsesWithIf(
1999-
AliasPtrTyped, [&](Use &U) { return DT.dominates(CB, U); });
1984+
AliasPtr, [&](Use &U) { return DT.dominates(CB, U); });
20001985
}
20011986
}
20021987

@@ -2769,17 +2754,8 @@ static void sinkLifetimeStartMarkers(Function &F, coro::Shape &Shape,
27692754
// Sink lifetime.start markers to dominate block when they are
27702755
// only used outside the region.
27712756
if (Valid && Lifetimes.size() != 0) {
2772-
// May be AI itself, when the type of AI is i8*
2773-
auto *NewBitCast = [&](AllocaInst *AI) -> Value* {
2774-
if (isa<AllocaInst>(Lifetimes[0]->getOperand(1)))
2775-
return AI;
2776-
auto *Int8PtrTy = Type::getInt8PtrTy(F.getContext());
2777-
return CastInst::Create(Instruction::BitCast, AI, Int8PtrTy, "",
2778-
DomBB->getTerminator());
2779-
}(AI);
2780-
27812757
auto *NewLifetime = Lifetimes[0]->clone();
2782-
NewLifetime->replaceUsesOfWith(NewLifetime->getOperand(1), NewBitCast);
2758+
NewLifetime->replaceUsesOfWith(NewLifetime->getOperand(1), AI);
27832759
NewLifetime->insertBefore(DomBB->getTerminator());
27842760

27852761
// All the outsided lifetime.start markers are no longer necessary.
@@ -3121,7 +3097,7 @@ void coro::buildCoroutineFrame(
31213097
Shape.ABI == coro::ABI::Async)
31223098
sinkSpillUsesAfterCoroBegin(F, FrameData, Shape.CoroBegin);
31233099
Shape.FrameTy = buildFrameType(F, Shape, FrameData);
3124-
createFramePtr(Shape);
3100+
Shape.FramePtr = Shape.CoroBegin;
31253101
// For now, this works for C++ programs only.
31263102
buildFrameDebugInfo(F, Shape, FrameData);
31273103
insertSpills(FrameData, Shape);

0 commit comments

Comments
 (0)