Skip to content

Commit 98650ae

Browse files
Merge branch 'main' into llvm-mca-x86-stack-engine
2 parents a5a592d + 37729d8 commit 98650ae

File tree

752 files changed

+36341
-11268
lines changed

Some content is hidden

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

752 files changed

+36341
-11268
lines changed

.github/new-prs-labeler.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ LTO:
9090
- llvm/lib/Transforms/*/FunctionImport*
9191
- llvm/tools/gold/**
9292

93-
mc:
94-
- llvm/*/MC/**
95-
9693
clang:driver:
9794
- clang/*/Driver/**
9895

@@ -621,6 +618,12 @@ llvm:adt:
621618
llvm:support:
622619
- llvm/**/Support/**
623620

621+
# Skip llvm/test/MC and llvm/unittests/MC, which includes target-specific directories.
622+
llvm:mc:
623+
- llvm/include/llvm/MC/**
624+
- llvm/lib/MC/**
625+
- llvm/tools/llvm-mc/**
626+
624627
llvm:transforms:
625628
- llvm/lib/Transforms/**
626629
- llvm/include/llvm/Transforms/**

.github/workflows/bazel-checks.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Bazel Checks
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
paths:
9+
- '.github/workflows/bazel-checks.yml'
10+
- 'utils/bazel/**'
11+
branches:
12+
- main
13+
pull_request:
14+
paths:
15+
- '.github/workflows/bazel-checks.yml'
16+
- 'utils/bazel/**'
17+
18+
jobs:
19+
buildifier:
20+
name: "Buildifier"
21+
runs-on: ubuntu-24.04
22+
if: github.repository == 'llvm/llvm-project'
23+
steps:
24+
- name: Fetch LLVM sources
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
- name: Setup Buildifier
27+
run: |
28+
sudo curl -L https://github.com/bazelbuild/buildtools/releases/download/v8.2.1/buildifier-linux-amd64 -o /usr/bin/buildifier
29+
sudo chmod +x /usr/bin/buildifier
30+
- name: Run Buildifier
31+
run: |
32+
buildifier --mode=check $(find ./utils/bazel -name *BUILD*)

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.10.0/sccach
8181

8282
ENV LLVM_SYSROOT=$LLVM_SYSROOT
8383
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
84+
ENV CC=clang
85+
ENV CXX=clang++
8486

8587
# Create a new user to avoid test failures related to a lack of expected
8688
# permissions issues in some tests. Set the user id to 1001 as that is the

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ autoconf/autom4te.cache
5252
# CLion project configuration
5353
/.idea
5454
/cmake-build*
55+
# Coding assistants' stuff
56+
/CLAUDE.md
57+
/.claude/
58+
/GEMINI.md
59+
/.gemini/
5560

5661
#==============================================================================#
5762
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,10 @@ class MCPlusBuilder {
740740
return false;
741741
}
742742

743+
/// Return true if the hlt instruction under the x86, otherwise, default to
744+
/// false.
745+
virtual bool isX86HLT(const MCInst &Inst) const { return false; }
746+
743747
/// Return the width, in bytes, of the memory access performed by \p Inst, if
744748
/// this is a pop instruction. Return zero otherwise.
745749
virtual int getPopSize(const MCInst &Inst) const {

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ bool MCPlusBuilder::equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
132132
}
133133

134134
bool MCPlusBuilder::isTerminator(const MCInst &Inst) const {
135-
return Analysis->isTerminator(Inst) ||
136-
(opts::TerminalTrap && Info->get(Inst.getOpcode()).isTrap());
135+
return (opts::TerminalTrap && Info->get(Inst.getOpcode()).isTrap()) ||
136+
Analysis->isTerminator(Inst)
137+
? !isX86HLT(Inst)
138+
: false;
137139
}
138140

139141
void MCPlusBuilder::setTailCall(MCInst &Inst) const {

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ class X86MCPlusBuilder : public MCPlusBuilder {
223223
return Inst.getOpcode() == X86::ENDBR32 || Inst.getOpcode() == X86::ENDBR64;
224224
}
225225

226+
bool isX86HLT(const MCInst &Inst) const override {
227+
return Inst.getOpcode() == X86::HLT;
228+
}
229+
226230
int getPopSize(const MCInst &Inst) const override {
227231
switch (Inst.getOpcode()) {
228232
case X86::POP16r:

bolt/test/X86/cfg_build_hlt.s

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Check CFG for halt instruction
2+
3+
# RUN: %clang %cflags %s -static -o %t.exe -nostdlib
4+
# RUN: llvm-bolt %t.exe --print-cfg --print-only=main -o %t 2>&1 | FileCheck %s --check-prefix=CHECK-CFG
5+
# RUN: llvm-objdump -d %t --print-imm-hex | FileCheck %s --check-prefix=CHECK-BIN
6+
7+
# CHECK-CFG: BB Count : 1
8+
# CHECK-BIN: <main>:
9+
# CHECK-BIN-NEXT: f4 hlt
10+
# CHECK-BIN-NEXT: c3 retq
11+
12+
.global main
13+
.type main, %function
14+
main:
15+
hlt
16+
retq
17+
.size main, .-main

clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,22 @@ Error MustacheHTMLGenerator::generateDocs(
144144
} else
145145
return JSONGenerator.takeError();
146146
}
147+
SmallString<128> JSONPath;
148+
sys::path::native(RootDir.str() + "/json", JSONPath);
147149

148150
StringMap<json::Value> JSONFileMap;
149151
{
150152
llvm::TimeTraceScope TS("Iterate JSON files");
151153
std::error_code EC;
152-
sys::fs::directory_iterator JSONIter(RootDir, EC);
154+
sys::fs::directory_iterator JSONIter(JSONPath, EC);
153155
std::vector<json::Value> JSONFiles;
154156
JSONFiles.reserve(Infos.size());
155157
if (EC)
156158
return createStringError("Failed to create directory iterator.");
157159

160+
SmallString<128> HTMLDirPath(RootDir.str() + "/html/");
161+
if (auto EC = sys::fs::create_directories(HTMLDirPath))
162+
return createFileError(HTMLDirPath, EC);
158163
while (JSONIter != sys::fs::directory_iterator()) {
159164
if (EC)
160165
return createFileError("Failed to iterate: " + JSONIter->path(), EC);
@@ -177,14 +182,15 @@ Error MustacheHTMLGenerator::generateDocs(
177182
return Parsed.takeError();
178183

179184
std::error_code FileErr;
180-
SmallString<16> HTMLPath(Path.begin(), Path.end());
181-
sys::path::replace_extension(HTMLPath, "html");
182-
raw_fd_ostream InfoOS(HTMLPath, FileErr, sys::fs::OF_None);
185+
SmallString<128> HTMLFilePath(HTMLDirPath);
186+
sys::path::append(HTMLFilePath, sys::path::filename(Path));
187+
sys::path::replace_extension(HTMLFilePath, "html");
188+
raw_fd_ostream InfoOS(HTMLFilePath, FileErr, sys::fs::OF_None);
183189
if (FileErr)
184190
return createFileOpenError(Path, FileErr);
185191

186-
if (Error Err = generateDocForJSON(*Parsed, sys::path::stem(HTMLPath),
187-
HTMLPath, InfoOS, CDCtx))
192+
if (Error Err = generateDocForJSON(*Parsed, sys::path::stem(HTMLFilePath),
193+
HTMLFilePath, InfoOS, CDCtx))
188194
return Err;
189195
JSONIter.increment(EC);
190196
}

clang-tools-extra/clang-doc/JSONGenerator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ Error JSONGenerator::generateDocs(
600600
Info *Info = Group.getValue().get();
601601

602602
SmallString<128> Path;
603-
sys::path::native(RootDir, Path);
603+
auto RootDirStr = RootDir.str() + "/json";
604+
StringRef JSONDir = StringRef(RootDirStr);
605+
sys::path::native(JSONDir, Path);
604606
if (!CreatedDirs.contains(Path)) {
605607
if (std::error_code Err = sys::fs::create_directories(Path);
606608
Err != std::error_code())

0 commit comments

Comments
 (0)