Skip to content

Commit 53f9f51

Browse files
authored
Merge branch 'main' into asan_free_aligned_sized
2 parents e52e3d0 + f8ffb4e commit 53f9f51

File tree

92 files changed

+3113
-2910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3113
-2910
lines changed

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
546546
return Res;
547547

548548
for (auto Iter = FromIter; Iter != ToIter;) {
549-
const uint32_t Src = Iter->first;
549+
const uint32_t Src = Iter->second >> 1;
550550
if (Iter->second & BRANCHENTRY) {
551551
++Iter;
552552
continue;
@@ -557,7 +557,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
557557
++Iter;
558558
if (Iter->second & BRANCHENTRY)
559559
break;
560-
Res.emplace_back(Src, Iter->first);
560+
Res.emplace_back(Src, Iter->second >> 1);
561561
}
562562

563563
return Res;

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,8 @@ bool DataAggregator::doTrace(const Trace &Trace, uint64_t Count,
835835

836836
LLVM_DEBUG(dbgs() << "Processing " << FTs->size() << " fallthroughs for "
837837
<< FromFunc->getPrintName() << ":" << Trace << '\n');
838-
for (auto [From, To] : *FTs) {
839-
if (BAT) {
840-
From = BAT->translate(FromFunc->getAddress(), From, /*IsBranchSrc=*/true);
841-
To = BAT->translate(FromFunc->getAddress(), To, /*IsBranchSrc=*/false);
842-
}
838+
for (const auto &[From, To] : *FTs)
843839
doIntraBranch(*ParentFunc, From, To, Count, false);
844-
}
845840

846841
return true;
847842
}

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,11 @@ void RewriteInstance::registerFragments() {
15671567

15681568
uint64_t ParentAddress{0};
15691569

1570+
// Check if containing FILE symbol is BOLT emitted synthetic symbol marking
1571+
// local fragments of global parents.
1572+
if (cantFail(FSI[-1].getName()) == getBOLTFileSymbolName())
1573+
goto registerParent;
1574+
15701575
// BOLT split fragment symbols are emitted just before the main function
15711576
// symbol.
15721577
for (ELFSymbolRef NextSymbol = Symbol; NextSymbol < StopSymbol;

bolt/test/X86/register-fragments-bolt-symbols.s

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
# RUN: link_fdata %s %t.bolt %t.preagg PREAGG
3131
# PREAGG: B X:0 #chain.cold.0# 1 0
32+
# PREAGG: B X:0 #dummy# 1 0
3233
# RUN: perf2bolt %t.bolt -p %t.preagg --pa -o %t.bat.fdata -w %t.bat.yaml -v=1 \
3334
# RUN: | FileCheck %s --check-prefix=CHECK-REGISTER
3435
# RUN: FileCheck --input-file %t.bat.fdata --check-prefix=CHECK-FDATA %s
@@ -44,7 +45,13 @@
4445
# CHECK-SYMS: l F .text.cold [[#]] chain.cold.0
4546
# CHECK-SYMS: l F .text [[#]] chain
4647
# CHECK-SYMS: l df *ABS* [[#]] bolt-pseudo.o
48+
# CHECK-SYMS: l F .text.cold [[#]] dummy.cold.0
49+
# CHECK-SYMS: l F .text.cold.1 [[#]] dummy.cold.1
50+
# CHECK-SYMS: l F .text.cold.2 [[#]] dummy.cold.2
4751

52+
# CHECK-REGISTER: BOLT-INFO: marking dummy.cold.0/1(*2) as a fragment of dummy
53+
# CHECK-REGISTER: BOLT-INFO: marking dummy.cold.1/1(*2) as a fragment of dummy
54+
# CHECK-REGISTER: BOLT-INFO: marking dummy.cold.2/1(*2) as a fragment of dummy
4855
# CHECK-REGISTER: BOLT-INFO: marking chain.cold.0/1(*2) as a fragment of chain/2(*2)
4956

5057
# CHECK-FDATA: 0 [unknown] 0 1 chain/chain.s/2 10 0 1

flang/lib/Lower/OpenMP/Atomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ namespace Fortran {
1212
namespace lower {
1313
class AbstractConverter;
1414
class SymMap;
15+
16+
namespace pft {
17+
struct Evaluation;
18+
}
1519
} // namespace lower
1620

1721
namespace parser {
1822
struct OpenMPAtomicConstruct;
1923
}
2024

21-
namespace pft {
22-
struct Evaluation;
23-
}
24-
2525
namespace semantics {
2626
class SemanticsContext;
2727
}

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,9 @@ if(LLVM_LIBC_FULL_BUILD)
12441244
libc.src.sys.socket.recv
12451245
libc.src.sys.socket.recvfrom
12461246
libc.src.sys.socket.recvmsg
1247+
1248+
# wchar.h entrypoints
1249+
libc.src.wchar.mbrtowc
12471250
)
12481251
endif()
12491252

libc/hdr/types/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ add_proxy_header_library(
2020
libc.include.uchar
2121
)
2222

23+
add_proxy_header_library(
24+
mbstate_t
25+
HDRS
26+
mbstate_t.h
27+
DEPENDS
28+
libc.include.llvm-libc-types.mbstate_t
29+
)
30+
2331
add_proxy_header_library(
2432
div_t
2533
HDRS

libc/hdr/types/mbstate_t.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Definition of macros from mbstate_t.h -----------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_HDR_TYPES_MBSTATE_T_H
10+
#define LLVM_LIBC_HDR_TYPES_MBSTATE_T_H
11+
12+
#ifdef LIBC_FULL_BUILD
13+
14+
#include "include/llvm-libc-types/mbstate_t.h"
15+
16+
#else // Overlay mode
17+
18+
#error "Cannot overlay mbstate_t
19+
20+
#endif // LLVM_LIBC_FULL_BUILD
21+
22+
#endif // LLVM_LIBC_HDR_TYPES_MBSTATE_T_H

libc/include/llvm-libc-types/mbstate_t.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
#ifndef LLVM_LIBC_TYPES_MBSTATE_T_H
1010
#define LLVM_LIBC_TYPES_MBSTATE_T_H
1111

12-
// TODO: Complete this once we implement functions that operate on this type.
12+
#include "../llvm-libc-macros/stdint-macros.h"
13+
1314
typedef struct {
15+
uint32_t __field1;
16+
uint8_t __field2;
17+
uint8_t __field3;
1418
} mbstate_t;
1519

1620
#endif // LLVM_LIBC_TYPES_MBSTATE_T_H

libc/include/wchar.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ functions:
2929
return_type: wint_t
3030
arguments:
3131
- type: int
32+
- name: mbrtowc
33+
standards:
34+
- stdc
35+
return_type: size_t
36+
arguments:
37+
- type: wchar_t *__restrict
38+
- type: const char *__restrict
39+
- type: size_t
40+
- type: mbstate_t *__restrict
3241
- name: wmemset
3342
standards:
3443
- stdc

0 commit comments

Comments
 (0)