Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit ece3bee

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:beffc821e829 into amd-gfx:010f535d2674
Local branch amd-gfx 010f535 Merged main:6eee238975e4 into amd-gfx:4d4ec95d174b Remote branch main beffc82 [CodeLayout] CDSortImpl: remove HotChains and remove linear-time erase_value from mergeChains (llvm#69276)
2 parents 010f535 + beffc82 commit ece3bee

File tree

15 files changed

+165
-48
lines changed

15 files changed

+165
-48
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,15 @@
303303
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 40)
304304
# endif
305305
#elif SANITIZER_RISCV64
306-
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47)
306+
// FIXME: Rather than hardcoding the VMA here, we should rely on
307+
// GetMaxUserVirtualAddress(). This will require some refactoring though since
308+
// many places either hardcode some value or SANITIZER_MMAP_RANGE_SIZE is
309+
// assumed to be some constant integer.
310+
# if SANITIZER_FUCHSIA
311+
# define SANITIZER_MMAP_RANGE_SIZE (1ULL << 38)
312+
# else
313+
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47)
314+
# endif
307315
#elif defined(__aarch64__)
308316
# if SANITIZER_APPLE
309317
# if SANITIZER_OSX || SANITIZER_IOSSIM

lldb/examples/synthetic/gnu_libstdcpp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,11 @@ def get_variant_npos_value(index_byte_size):
914914
if index == npos_value:
915915
return " No Value"
916916

917+
# Invalid index can happen when the variant is not initialized yet.
918+
template_arg_count = data_obj.GetType().GetNumberOfTemplateArguments()
919+
if index >= template_arg_count:
920+
return " <Invalid>"
921+
917922
active_type = data_obj.GetType().GetTemplateArgumentType(index)
918923
return f" Active Type = {active_type.GetDisplayTypeName()} "
919924

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7182,6 +7182,9 @@ GetNthTemplateArgument(const clang::ClassTemplateSpecializationDecl *decl,
71827182
// Note that 'idx' counts from the beginning of all template arguments
71837183
// (including the ones preceding the parameter pack).
71847184
const auto &pack = args[last_idx];
7185+
if (idx >= pack.pack_size())
7186+
return nullptr;
7187+
71857188
const size_t pack_idx = idx - last_idx;
71867189
assert(pack_idx < pack.pack_size() && "parameter pack index out-of-bounds");
71877190
return &pack.pack_elements()[pack_idx];

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/variant/TestDataFormatterLibStdcxxVariant.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,29 @@ def test_with_run_command(self):
7171
substrs=["v_many_types_no_value = No Value"],
7272
)
7373
"""
74+
75+
@add_test_categories(["libstdcxx"])
76+
def test_invalid_variant_index(self):
77+
"""Test LibStdC++ data formatter for std::variant with invalid index."""
78+
self.build()
79+
80+
(self.target, self.process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
81+
self, "// break here", lldb.SBFileSpec("main.cpp", False)
82+
)
83+
84+
lldbutil.continue_to_breakpoint(self.process, bkpt)
85+
86+
self.expect(
87+
"frame variable v1",
88+
substrs=["v1 = Active Type = int {", "Value = 12", "}"],
89+
)
90+
91+
var_v1 = thread.frames[0].FindVariable("v1")
92+
var_v1_raw_obj = var_v1.GetNonSyntheticValue()
93+
index_obj = var_v1_raw_obj.GetChildMemberWithName("_M_index")
94+
self.assertTrue(index_obj and index_obj.IsValid())
95+
96+
INVALID_INDEX = "100"
97+
index_obj.SetValueFromCString(INVALID_INDEX)
98+
99+
self.expect("frame variable v1", substrs=["v1 = <Invalid>"])

llvm/docs/LangRef.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ added in the future:
309309
prototype of all callees to exactly match the prototype of the
310310
function definition. Furthermore the inliner doesn't consider such function
311311
calls for inlining.
312-
"``cc 10``" - GHC convention
312+
"``ghccc``" - GHC convention
313313
This calling convention has been implemented specifically for use by
314314
the `Glasgow Haskell Compiler (GHC) <http://www.haskell.org/ghc>`_.
315315
It passes everything in registers, going to extremes to achieve this

llvm/docs/TestSuiteGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ benchmarks. CMake can print a list of them:
177177
- `TEST_SUITE_FORTRAN`
178178

179179
Activate that Fortran tests. This is a work in progress. More information can be
180-
found in the [Flang documentation](https://flang.llvm.org/docs/html/FortranLLVMTestSuite.html)
180+
found in the [Flang documentation](https://flang.llvm.org/docs/FortranLLVMTestSuite.html)
181181

182182
- `TEST_SUITE_RUN_UNDER`
183183

llvm/docs/WritingAnLLVMPass.rst

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,7 @@ series of passes:
10201020
instead of traversing the entire program. It reduces the memory consumption
10211021
of compiler, because, for example, only one `DominatorSet
10221022
<https://llvm.org/doxygen/classllvm_1_1DominatorSet.html>`_ needs to be
1023-
calculated at a time. This also makes it possible to implement some
1024-
:ref:`interesting enhancements <writing-an-llvm-pass-SMP>` in the future.
1023+
calculated at a time.
10251024

10261025
The effectiveness of the ``PassManager`` is influenced directly by how much
10271026
information it has about the behaviors of the passes it is scheduling. For
@@ -1350,29 +1349,3 @@ some with solutions, some without.
13501349
Hopefully these tips will help with common case debugging situations. If you'd
13511350
like to contribute some tips of your own, just contact `Chris
13521351
<mailto:sabre@nondot.org>`_.
1353-
1354-
Future extensions planned
1355-
-------------------------
1356-
1357-
Although the LLVM Pass Infrastructure is very capable as it stands, and does
1358-
some nifty stuff, there are things we'd like to add in the future. Here is
1359-
where we are going:
1360-
1361-
.. _writing-an-llvm-pass-SMP:
1362-
1363-
Multithreaded LLVM
1364-
^^^^^^^^^^^^^^^^^^
1365-
1366-
Multiple CPU machines are becoming more common and compilation can never be
1367-
fast enough: obviously we should allow for a multithreaded compiler. Because
1368-
of the semantics defined for passes above (specifically they cannot maintain
1369-
state across invocations of their ``run*`` methods), a nice clean way to
1370-
implement a multithreaded compiler would be for the ``PassManager`` class to
1371-
create multiple instances of each pass object, and allow the separate instances
1372-
to be hacking on different parts of the program at the same time.
1373-
1374-
This implementation would prevent each of the passes from having to implement
1375-
multithreaded constructs, requiring only the LLVM core to have locking in a few
1376-
places (for global resources). Although this is a simple extension, we simply
1377-
haven't had time (or multiprocessor machines, thus a reason) to implement this.
1378-
Despite that, we have kept the LLVM passes SMP ready, and you should too.

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 477827
19+
#define LLVM_MAIN_REVISION 477835
2020

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

llvm/lib/Target/M68k/MCTargetDesc/M68kMCCodeEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void M68kMCCodeEmitter::encodeInstruction(const MCInst &MI,
204204
SmallVectorImpl<MCFixup> &Fixups,
205205
const MCSubtargetInfo &STI) const {
206206
LLVM_DEBUG(dbgs() << "EncodeInstruction: " << MCII.getName(MI.getOpcode())
207-
<< "(" << Opcode << ")\n");
207+
<< "(" << MI.getOpcode() << ")\n");
208208
(void)MCII;
209209

210210
// Try using the new method first.

llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ bool RISCVInstructionSelector::select(MachineInstr &MI) {
194194
}
195195
case TargetOpcode::G_SEXT_INREG:
196196
return selectSExtInreg(MI, MIB);
197+
case TargetOpcode::G_FRAME_INDEX: {
198+
// TODO: We may want to replace this code with the SelectionDAG patterns,
199+
// which fail to get imported because it uses FrameAddrRegImm, which is a
200+
// ComplexPattern
201+
MI.setDesc(TII.get(RISCV::ADDI));
202+
MI.addOperand(MachineOperand::CreateImm(0));
203+
return constrainSelectedInstRegOperands(MI, TII, TRI, RBI);
204+
}
197205
case TargetOpcode::G_SELECT:
198206
return selectSelect(MI, MIB, MRI);
199207
default:

0 commit comments

Comments
 (0)