Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
bfd4155
[VPlan] Don't apply predication discount to non-originally-predicated…
lukel97 Nov 10, 2025
e2a2c03
[DebugInfo] Add Verifier check for incorrectly-scoped retainedNodes (…
dzhidzhoev Nov 10, 2025
28d9f99
Remove unused standard headers: <string>, <optional>, <numeric>, <tup…
serge-sans-paille Nov 10, 2025
2705951
[X86] 2012-01-10-UndefExceptionEdge.ll - regenerate test checks (#167…
RKSimon Nov 10, 2025
309729e
[C2y] Claim nonconformance to WG14 N3348 (#166966)
AaronBallman Nov 10, 2025
342e28f
[clang][DebugInfo] Attach `DISubprogram` to additional call variants …
jryans Nov 10, 2025
f22d588
[mlir] Dialect Conversion: Fix expensive pattern check in no-rollback…
timnoack Nov 10, 2025
be84705
[HLSL][SPIRV] Add error test for unpackhalf2x16 (#166969)
tcorringham Nov 10, 2025
bba40ab
[MLIR][XeGPU] Decouple `inst_data` and `lane_layout` in propagation (…
akroviakov Nov 10, 2025
5b20453
[CodeGenPrepare] sinkCmpExpression - don't sink larger than legal int…
RKSimon Nov 10, 2025
a5d4ba7
[clang][doc] Document and prefer __asm as mangled name attribute (#16…
tambry Nov 10, 2025
1553f90
[MLIR][XeGPU][TransformOps] Add get_desc_op (#166801)
tkarna Nov 10, 2025
71cdd40
Allow avx512 bw masked intrinsics to be used in constexpr (#162871)
GrumpyPigSkin Nov 10, 2025
94a7006
[MLIR][XeGPU][TransformOps] Add set_op_layout_attr op (#166854)
tkarna Nov 10, 2025
69c8756
[NFC][PowerPC] Pre-commit adding test case: use millicode for memmove…
diggerlin Nov 10, 2025
c17a839
[OMPIRBuilder] Fix addrspace of internal critical section lock (#166459)
sarnex Nov 10, 2025
99a5e7b
[mlir][NFC] Split registerAndParseCLIOptions() in mlir-opt (#166538)
andrey-golubev Nov 10, 2025
2681497
[SPIRV] Allow multiple FuncParamAttr decoration on the same id. (#166…
maarquitos14 Nov 10, 2025
2d381bf
[MLIR][Python] add/fix docstrings in IRCore (#167063)
makslevental Nov 10, 2025
cd68056
[BOLT] Simplify RAState helpers (NFCI) (#162820)
bgergely0 Nov 10, 2025
51815b1
[Clang][ASTImporter] Implement AST import for CXXParenListInitExpr, S…
ganenkokb-yandex Nov 10, 2025
9625cf6
[BAZEL] Add missing dependency on /llvm:Support from XeGPUTransformOp…
WillFroom Nov 10, 2025
741ba82
AMDGPU: Add baseline test for known bits of AssertNoFPClass (#167288)
arsenm Nov 10, 2025
726c049
AMDGPU: Add baseline test for nofpclass on call results (#167263)
arsenm Nov 10, 2025
54053cf
AMDGPU: Add baseline tests for copysign with known signmask input (#1…
arsenm Nov 10, 2025
b9e22cc
[Flang][driver] Do not emit -latomic on link line on Windows (#164648)
mjklemm Nov 10, 2025
38cade7
[PGO][Offload] Fix missing names bug in GPU PGO (#166444)
EthanLuisMcDonough Nov 10, 2025
9a783b6
[clang] Refactor option-related code from clangDriver into new clangO…
naveen-seth Nov 10, 2025
0bae337
[flang][cuda] Fix detection of assumed size arrays in shared memory o…
clementval Nov 10, 2025
61e5bc3
[SandboxIR] Fix typo in doc (#167315)
c8ef Nov 10, 2025
241bfac
[CodeGen] Use MCRegister in RegisterMaskPair constructor. NFC (#167274)
topperc Nov 10, 2025
e1f8690
[X86] BuiltinsX86.td - move the SSE constexpr builtins together. NFC.…
RKSimon Nov 10, 2025
7fe60a7
[AArch64][SVE] Avoid movprfx by reusing register for _UNDEF pseudos. …
sdesmalen-arm Nov 10, 2025
caed089
TargetLibraryInfo: Split off VectorLibrary enum and flag (#166980)
arsenm Nov 10, 2025
7171a9c
[SelectionDAG] Fix typo in comment glueged->glued. NFC (#167006)
topperc Nov 10, 2025
20a22a4
[MLGO] Remove Extra Dev Mode Features (#167273)
boomanaiden154 Nov 10, 2025
b4f1994
DAG: Add AssertNoFPClass from call return attributes (#167264)
arsenm Nov 10, 2025
ec75be1
[VPlan] Assert that addMetadata does not add duplicates (NFC).
fhahn Nov 10, 2025
bb0bd38
[GitHub][CI] Add a new container to use for the abi tests (#166886)
tstellar Nov 10, 2025
315d705
[clang-tidy] Move 'cert-msc51-cpp', 'cert-msc32-c' checks outside of …
luobochuanqi Nov 10, 2025
a3d00e1
DAG: Fold copysign with a known signmask to a disjoint or (#167266)
arsenm Nov 10, 2025
fa98fcd
DAG: Handle AssertNoFPClass in computeKnownBits (#167289)
arsenm Nov 10, 2025
fc093f1
[mlir][Interfaces] Add interface methods to allow reifying single res…
MaheshRavishankar Nov 10, 2025
87e094d
[MLIR][Conversion] XeGPU to XeVM: Add handler for 1D block ops (#165894)
silee2 Nov 10, 2025
5a1acf7
[Clang][AMDGPU] Fix early exit when finding hip dlls AMDGPUArchByHIP.…
harkgill-amd Nov 10, 2025
8a83700
[ROCDL] Added matrix load-transpose ops for gfx1250+ (#165564)
ravil-mobile Nov 10, 2025
c2d4c7c
[VPlan] Permit more users in narrowToSingleScalars (#166559)
artagnon Nov 10, 2025
2345b7d
[MLGO] Delete InlineSizeEstimatorAnalysis (#167271)
boomanaiden154 Nov 10, 2025
cbb3be5
[flang][NFC] Strip trailing whitespace from tests (2 of N)
tarunprabhu Nov 10, 2025
8c52f33
[libc++][docs] Update to refer to P3355R2 (#167267)
frederick-vs-ja Nov 10, 2025
6bad2d1
Revert "[clang] Refactor option-related code from clangDriver into ne…
naveen-seth Nov 10, 2025
e95f6fa
RegisterCoalescer: Enable terminal rule by default for AMDGPU (#161621)
arsenm Nov 10, 2025
4cd16f2
[BOLT][AArch64] Add more heuristics on epilogue determination (#167077)
yozhu Nov 10, 2025
9f0c449
[CIR][NFC] Add test for Complex imag with GUN extension (#167215)
AmrDeveloper Nov 10, 2025
0d7c0b2
merge main into amd-staging
ronlieb Nov 10, 2025
911d1c2
[libc++][NFC] Remove unused imports from generate_feature_test_macro_…
ldionne Nov 10, 2025
d2521f1
[libc++] Split macros related to hardening into their own header (#16…
ldionne Nov 10, 2025
ca17584
[bazel] Port #166980: TLI/VectorLibrary refactor (#167354)
rupprecht Nov 10, 2025
5aec174
AMDGPU: Update test after e95f6fa12
arsenm Nov 10, 2025
6d18313
[HLSL] Add internal linkage attribute to resources (#166844)
hekota Nov 10, 2025
ccedf25
[PowerPC] convert memmove to milicode call .___memmove64[PR] in 64-…
diggerlin Nov 10, 2025
824df46
[gn build] Port 2345b7d98f75
llvmgnsyncbot Nov 10, 2025
de147e5
[gn build] Port 315d705b7608
llvmgnsyncbot Nov 10, 2025
f7c61b6
[gn build] Port caed0893465a
llvmgnsyncbot Nov 10, 2025
5eb7126
[gn build] Port d2521f14a73d
llvmgnsyncbot Nov 10, 2025
b639b6a
[CIR] Re-land: Recognize constant aggregate initialization of auto va…
andykaylor Nov 10, 2025
e9d3340
[X86] _mm_addsub_pd is not valid for constexpr (#167363)
RKSimon Nov 10, 2025
b7423af
RuntimeLibcalls: Add entries for vector sincospi functions (#166981)
arsenm Nov 10, 2025
08222ca
[Flang][OpenMP] Move char box bounds generation for Maps to Directive…
agozillon Nov 10, 2025
0d97f43
[libc++] Inline vector::__append into resize (#162086)
philnik777 Nov 10, 2025
46a8ddb
[libc++abi][NFC] Remove some cruft from <__cxxabi_config.h> (#164578)
philnik777 Nov 10, 2025
821d282
RuntimeLibcalls: Remove incorrect sincospi from most targets (#166982)
arsenm Nov 10, 2025
89577e9
[flang][OpenMP] Detect complex part designators in atomic variables (…
kparzysz Nov 10, 2025
efc83cc
[NFC][SpecialCaseList] Precommit Version 4 tests (#167282)
vitalybuka Nov 10, 2025
0364baf
[clang] Fix possible nullptr deref in BuildCXXNestedNameSpecifier (#1…
ilovepi Nov 10, 2025
5c4083e
[WebAssembly] Enable musttail only when tail-call is enabled (#163618)
badumbatish Nov 10, 2025
70a6475
Revert "[CIR][NFC] Add test for Complex imag with GUN extension" (#16…
AmrDeveloper Nov 10, 2025
2f54efd
[MachineOutliner] Don't outline ADRP pair to avoid incorrect ICF (#16…
pranavk Nov 10, 2025
eae817d
Reapply "[CI] Make premerge_advisor_explain write comments" (#167198)
boomanaiden154 Nov 10, 2025
f2f04c3
RuntimeLibcalls: Add call entries for sincos sleef and armpl libcalls…
arsenm Nov 10, 2025
26b4ac0
Revert "[OMPIRBuilder] Fix addrspace of internal critical section loc…
ronlieb Nov 10, 2025
70559d4
merge main into amd-staging
ronlieb Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
194 changes: 192 additions & 2 deletions .ci/all_requirements.txt

Large diffs are not rendered by default.

100 changes: 97 additions & 3 deletions .ci/premerge_advisor_explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,90 @@
"""Script for getting explanations from the premerge advisor."""

import argparse
import os
import platform
import sys
import json

# TODO(boomanaiden154): Remove the optional call once we can require Python
# 3.10.
from typing import Optional

import requests
import github
import github.PullRequest

import generate_test_report_lib

PREMERGE_ADVISOR_URL = (
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/explain"
)
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"


def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> Optional[int]:
platform_comment_tag = COMMENT_TAG.format(platform=platform)
for comment in pr.as_issue().get_comments():
if platform_comment_tag in comment.body:
return comment.id
return None


def get_comment(
github_token: str,
pr_number: int,
body: str,
) -> dict[str, str]:
repo = github.Github(github_token).get_repo("llvm/llvm-project")
pr = repo.get_issue(pr_number).as_pull_request()
comment = {"body": body}
comment_id = get_comment_id(platform.system(), pr)
if comment_id:
comment["id"] = comment_id
return comment


def main(commit_sha: str, build_log_files: list[str]):
def main(
commit_sha: str,
build_log_files: list[str],
github_token: str,
pr_number: int,
return_code: int,
):
"""The main entrypoint for the script.

This function parses failures from files, requests information from the
premerge advisor, and may write a Github comment depending upon the output.
There are four different scenarios:
1. There has never been a previous failure and the job passes - We do not
create a comment. We write out an empty file to the comment path so the
issue-write workflow knows not to create anything.
2. There has never been a previous failure and the job fails - We create a
new comment containing the failure information and any possible premerge
advisor findings.
3. There has been a previous failure and the job passes - We update the
existing comment by passing its ID and a passed message to the
issue-write workflow.
4. There has been a previous failure and the job fails - We update the
existing comment in the same manner as above, but generate the comment
as if we have a failure.

Args:
commit_sha: The base commit SHA for this PR run.
build_log_files: The list of JUnit XML files and ninja logs.
github_token: The token to use to access the Github API.
pr_number: The number of the PR associated with this run.
return_code: The numerical return code of ninja/CMake.
"""
if return_code == 0:
with open("comment", "w") as comment_file_handle:
comment = get_comment(
github_token,
pr_number,
":white_check_mark: With the latest revision this PR passed "
"the premerge checks.",
)
if "id" in comment:
json.dump([comment], comment_file_handle)
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
build_log_files
)
Expand Down Expand Up @@ -45,13 +115,31 @@ def main(commit_sha: str, build_log_files: list[str]):
)
if advisor_response.status_code == 200:
print(advisor_response.json())
comments = [
get_comment(
github_token,
pr_number,
generate_test_report_lib.generate_report(
generate_test_report_lib.compute_platform_title(),
return_code,
junit_objects,
ninja_logs,
failure_explanations_list=advisor_response.json(),
),
)
]
with open("comment", "w") as comment_file_handle:
json.dump(comments, comment_file_handle)
else:
print(advisor_response.reason)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
parser.add_argument("return_code", help="The build's return code", type=int)
parser.add_argument("github_token", help="Github authentication token", type=str)
parser.add_argument("pr_number", help="The PR number", type=int)
parser.add_argument(
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
)
Expand All @@ -62,4 +150,10 @@ def main(commit_sha: str, build_log_files: list[str]):
if platform.machine() == "arm64":
sys.exit(0)

main(args.commit_sha, args.build_log_files)
main(
args.commit_sha,
args.build_log_files,
args.github_token,
args.pr_number,
args.return_code,
)
1 change: 1 addition & 0 deletions .ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
junitparser==3.2.0
google-cloud-storage==3.3.0
PyGithub==2.8.1
9 changes: 5 additions & 4 deletions .ci/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ function at-exit {
# If building fails there will be no results files.
shopt -s nullglob

if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
if [[ "$GITHUB_ACTIONS" != "" ]]; then
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
>> $GITHUB_STEP_SUMMARY
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
"${MONOREPO_ROOT}"/ninja*.log
fi

if [[ "$retcode" != "0" ]]; then
if [[ "$GITHUB_ACTIONS" != "" ]]; then
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
"${MONOREPO_ROOT}"/ninja*.log
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build-ci-container-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
test-command: 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
- container-name: lint
test-command: 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
- container-name: abi-tests
test-command: 'cd $HOME && abi-compliance-checker --help'
target: abi-tests
steps:
- name: Checkout LLVM
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -52,7 +55,7 @@ jobs:
with:
container-name: ci-ubuntu-24.04-${{ matrix.container-name }}
dockerfile: .github/workflows/containers/github-action-ci-tooling/Dockerfile
target: ci-container-code-${{ matrix.container-name }}
target: ci-container-${{ matrix.target || format('code-{0}', matrix.container-name) }}
test-command: ${{ matrix.test-command }}

push-ci-container:
Expand Down
56 changes: 42 additions & 14 deletions .github/workflows/containers/github-action-ci-tooling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# as root in 'ci-container-code-format' and 'ci-container-code-lint' containers


FROM base AS ci-container-build-tools
ARG LLVM_VERSION
ARG LLVM_VERSION_MAJOR

COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
${LLVM_SYSROOT}/bin/
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
cmake \
ninja-build && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV CC=${LLVM_SYSROOT}/bin/clang
ENV CXX=${LLVM_SYSROOT}/bin/clang++


FROM base AS ci-container-code-format
ARG LLVM_VERSION

Expand All @@ -63,31 +85,37 @@ USER gha
WORKDIR /home/gha


FROM base AS ci-container-code-lint
FROM ci-container-build-tools AS ci-container-code-lint
ARG LLVM_VERSION
ARG LLVM_VERSION_MAJOR

COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
${LLVM_SYSROOT}/bin/
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py

RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
# Install dependencies for 'pr-code-lint.yml' job
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
RUN pip install -r requirements_linting.txt --break-system-packages && \
rm requirements_linting.txt
USER gha
WORKDIR /home/gha


FROM ci-container-build-tools as ci-container-abi-tests

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
cmake \
ninja-build && \
abi-compliance-checker \
abi-dumper \
autoconf \
pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install dependencies for 'pr-code-lint.yml' job
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
RUN pip install -r requirements_linting.txt --break-system-packages && \
rm requirements_linting.txt
USER gha
WORKDIR /home/gha
RUN git clone https://github.com/universal-ctags/ctags.git && \
cd ctags && \
./autogen.sh && \
./configure && \
sudo make install && \
rm -Rf ../ctags

6 changes: 6 additions & 0 deletions .github/workflows/premerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
- name: Build and Test
timeout-minutes: 120
continue-on-error: ${{ runner.arch == 'ARM64' }}
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
git config --global --add safe.directory '*'

Expand Down Expand Up @@ -153,6 +156,9 @@ jobs:
timeout-minutes: 180
if: ${{ steps.vars.outputs.windows-projects != '' }}
shell: cmd
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
# See the comments above in the Linux job for why we define each of
Expand Down
24 changes: 11 additions & 13 deletions bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ class MCPlusBuilder {

virtual bool isPop(const MCInst &Inst) const { return false; }

/// Determine if a basic block looks like an epilogue. For now it is only
/// called at the final stage of building CFG to check basic block ending
/// with an indirect call that has unknown control flow attribute.
virtual bool isEpilogue(const BinaryBasicBlock &BB) const { return false; }

/// Return true if the instruction is used to terminate an indirect branch.
virtual bool isTerminateBranch(const MCInst &Inst) const {
llvm_unreachable("not implemented");
Expand Down Expand Up @@ -1371,20 +1376,13 @@ class MCPlusBuilder {
/// Return true if \p Inst has RestoreState annotation.
bool hasRestoreState(const MCInst &Inst) const;

/// Stores RA Signed annotation on \p Inst.
void setRASigned(MCInst &Inst) const;

/// Return true if \p Inst has Signed RA annotation.
bool isRASigned(const MCInst &Inst) const;

/// Stores RA Unsigned annotation on \p Inst.
void setRAUnsigned(MCInst &Inst) const;

/// Return true if \p Inst has Unsigned RA annotation.
bool isRAUnsigned(const MCInst &Inst) const;
/// Sets kRASigned or kRAUnsigned annotation on \p Inst.
/// Fails if \p Inst has either annotation already set.
void setRAState(MCInst &Inst, bool State) const;

/// Return true if \p Inst doesn't have any annotation related to RA state.
bool isRAStateUnknown(const MCInst &Inst) const;
/// Return true if \p Inst has kRASigned annotation, false if it has
/// kRAUnsigned annotation, and std::nullopt if neither annotation is set.
std::optional<bool> getRAState(const MCInst &Inst) const;

/// Return true if the instruction is a call with an exception handling info.
virtual bool isInvoke(const MCInst &Inst) const {
Expand Down
11 changes: 4 additions & 7 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2167,13 +2167,10 @@ bool BinaryFunction::postProcessIndirectBranches(
continue;
}

// If this block contains an epilogue code and has an indirect branch,
// then most likely it's a tail call. Otherwise, we cannot tell for sure
// what it is and conservatively reject the function's CFG.
bool IsEpilogue = llvm::any_of(BB, [&](const MCInst &Instr) {
return BC.MIB->isLeave(Instr) || BC.MIB->isPop(Instr);
});
if (IsEpilogue) {
// If this block contains epilogue code and has an indirect branch,
// then most likely it's a tail call. Otherwise, we cannot tell for
// sure what it is and conservatively reject the function's CFG.
if (BC.MIB->isEpilogue(BB)) {
BC.MIB->convertJmpToTailCall(Instr);
BB.removeAllSuccessors();
continue;
Expand Down
27 changes: 11 additions & 16 deletions bolt/lib/Core/MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,21 @@ bool MCPlusBuilder::hasRestoreState(const MCInst &Inst) const {
return hasAnnotation(Inst, MCAnnotation::kRestoreState);
}

void MCPlusBuilder::setRASigned(MCInst &Inst) const {
void MCPlusBuilder::setRAState(MCInst &Inst, bool State) const {
assert(!hasAnnotation(Inst, MCAnnotation::kRASigned));
setAnnotationOpValue(Inst, MCAnnotation::kRASigned, true);
}

bool MCPlusBuilder::isRASigned(const MCInst &Inst) const {
return hasAnnotation(Inst, MCAnnotation::kRASigned);
}

void MCPlusBuilder::setRAUnsigned(MCInst &Inst) const {
assert(!hasAnnotation(Inst, MCAnnotation::kRAUnsigned));
setAnnotationOpValue(Inst, MCAnnotation::kRAUnsigned, true);
if (State)
setAnnotationOpValue(Inst, MCAnnotation::kRASigned, true);
else
setAnnotationOpValue(Inst, MCAnnotation::kRAUnsigned, true);
}

bool MCPlusBuilder::isRAUnsigned(const MCInst &Inst) const {
return hasAnnotation(Inst, MCAnnotation::kRAUnsigned);
}

bool MCPlusBuilder::isRAStateUnknown(const MCInst &Inst) const {
return !(isRAUnsigned(Inst) || isRASigned(Inst));
std::optional<bool> MCPlusBuilder::getRAState(const MCInst &Inst) const {
if (hasAnnotation(Inst, MCAnnotation::kRASigned))
return true;
if (hasAnnotation(Inst, MCAnnotation::kRAUnsigned))
return false;
return std::nullopt;
}

std::optional<MCLandingPad> MCPlusBuilder::getEHInfo(const MCInst &Inst) const {
Expand Down
Loading