History log of /llvm-project/clang/lib/CodeGen/BackendUtil.cpp (Results 1 – 25 of 872)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 9fbf5cfe 23-Jan-2025 Ben Langmuir <blangmuir@apple.com>

[clang][modules] Partially revert 48d0eb518 to fix -gmodules output (#124003)

With the changes in 48d0eb518, the CodeGenOptions used to emit .pcm
files with -fmodule-format=obj (-gmodules) were the

[clang][modules] Partially revert 48d0eb518 to fix -gmodules output (#124003)

With the changes in 48d0eb518, the CodeGenOptions used to emit .pcm
files with -fmodule-format=obj (-gmodules) were the ones from the
original invocation, rather than the ones specifically crafted for
outputting the pcm. This was causing the pcm to be written with only the
debug info and without the __clangast section in some cases (e.g. -O2).
This unforunately was not covered by existing tests, because compiling
and loading a module within a single compilation load the ast content
from the in-memory module cache rather than reading it from the pcm file
that was written. This broke bootstrapping a build of clang with modules
enabled on Darwin.

rdar://143418834

show more ...


# 24764172 22-Jan-2025 Thurston Dang <thurston@google.com>

Reapply "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833) (#122994)

This reverts commit 1515caf7a59dc20cb932b724b2ef5c1d1a593427
(https://github.com/llvm/llvm-project/pull/

Reapply "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833) (#122994)

This reverts commit 1515caf7a59dc20cb932b724b2ef5c1d1a593427
(https://github.com/llvm/llvm-project/pull/122833) i.e., relands
7d8b4eb0ead277f41ff69525ed807f9f6e227f37
(https://github.com/llvm/llvm-project/pull/122765), with LowerAllowCheckPass::Options moved inside the callback to fix a stack use-after-scope error.

---------

Co-authored-by: Vitaly Buka <vitalybuka@gmail.com>

show more ...


# e7f756d4 15-Jan-2025 Vitaly Buka <vitalybuka@google.com>

[NFC][BoundsChecking] Address #122576 review comments (#122773)


Revision tags: llvmorg-19.1.7
# 1515caf7 14-Jan-2025 Thurston Dang <thurston@google.com>

Revert "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833)

Reverts llvm/llvm-project#122765

Reason: buildbot breakage
(https://lab.llvm.org/buildbot/#/builders/46/builds/1

Revert "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833)

Reverts llvm/llvm-project#122765

Reason: buildbot breakage
(https://lab.llvm.org/buildbot/#/builders/46/builds/10393)

```
z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe -cc1 -internal-isystem Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\20\include -nostdsysteminc -triple x86_64-pc-linux-gnu -emit-llvm -o - Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\CodeGen\allow-ubsan-check-inline.c -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check -fno-inline 2>&1 | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\CodeGen\allow-ubsan-check-inline.c --check-prefixes=NOINL --implicit-check-not="remark:"
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe' -cc1 -internal-isystem 'Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\20\include' -nostdsysteminc -triple x86_64-pc-linux-gnu -emit-llvm -o - 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\CodeGen\allow-ubsan-check-inline.c' -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check -fno-inline
# note: command had no output on stdout or stderr
# error: command failed with exit status: 0xc0000409
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\CodeGen\allow-ubsan-check-inline.c' --check-prefixes=NOINL --implicit-check-not=remark:
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line: z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\CodeGen\allow-ubsan-check-inline.c --check-prefixes=NOINL --implicit-check-not=remark:
# `-----------------------------
# error: command failed with exit status: 2
```

show more ...


# 7d8b4eb0 14-Jan-2025 Thurston Dang <thurston@google.com>

[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (#122765)

This is glue code to convert LowerAllowCheckPass from a FUNCTION_PASS to
FUNCTION_PASS_WITH_PARAMS. The parameters are curre

[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (#122765)

This is glue code to convert LowerAllowCheckPass from a FUNCTION_PASS to
FUNCTION_PASS_WITH_PARAMS. The parameters are currently unused.

Future work will plumb `-fsanitize-skip-hot-cutoff` (introduced in
https://github.com/llvm/llvm-project/pull/121619) to
LowerAllowCheckOptions.

show more ...


# 409ca49f 13-Jan-2025 Vitaly Buka <vitalybuka@google.com>

[ubsan] Pass fsanitize-skip-hot-cutoff into -fsanitize=bounds (#122576)


# 0de18e72 11-Jan-2025 Fangrui Song <i@maskray.me>

-ftime-report: reorganize timers

The code generation time is unclear in the -ftime-report output:

* The two clang timers "Code Generation Time" and "LLVM IR Generation
Time" are in the default gr

-ftime-report: reorganize timers

The code generation time is unclear in the -ftime-report output:

* The two clang timers "Code Generation Time" and "LLVM IR Generation
Time" are in the default group "Miscellaneous Ungrouped Timers".
* There is also a "Clang front-end time" group, which actually includes
code generation time.

```
===-------------------------------------------------------------------------===
Miscellaneous Ungrouped Timers
===-------------------------------------------------------------------------===

---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0611 ( 1.7%) 0.0099 ( 4.4%) 0.0710 ( 1.9%) 0.0713 ( 1.9%) LLVM IR Generation Time
3.5140 ( 98.3%) 0.2165 ( 95.6%) 3.7306 ( 98.1%) 3.7342 ( 98.1%) Code Generation Time
3.5751 (100.0%) 0.2265 (100.0%) 3.8016 (100.0%) 3.8055 (100.0%) Total
...
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 3.9108 seconds (3.9146 wall clock)

---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
3.6802 (100.0%) 0.2306 (100.0%) 3.9108 (100.0%) 3.9146 (100.0%) Clang front-end timer
3.6802 (100.0%) 0.2306 (100.0%) 3.9108 (100.0%) 3.9146 (100.0%) Total
```

This patch

* renames "Clang front-end time report" (FrontendAction time) to "Clang
time report",
* renames "Clang front-end" to "Front end",
* moves "LLVM IR Generation" into the group,
* replaces "Code Generation time" with "Optimizer" (middle end) and
"Machine code generation" (back end).

```
% clang -c sqlite3.i -w -ftime-report -mllvm -sort-timers=0
...
===-------------------------------------------------------------------------===
Clang time report
===-------------------------------------------------------------------------===
Total Execution Time: 1.5922 seconds (1.5972 wall clock)

---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.5107 ( 35.9%) 0.0105 ( 6.2%) 0.5211 ( 32.7%) 0.5222 ( 32.7%) Front end
0.2464 ( 17.3%) 0.0340 ( 20.0%) 0.2804 ( 17.6%) 0.2814 ( 17.6%) LLVM IR generation
0.6240 ( 43.9%) 0.1235 ( 72.7%) 0.7475 ( 47.0%) 0.7503 ( 47.0%) Machine code generation
0.0413 ( 2.9%) 0.0018 ( 1.0%) 0.0431 ( 2.7%) 0.0433 ( 2.7%) Optimizer
1.4224 (100.0%) 0.1698 (100.0%) 1.5922 (100.0%) 1.5972 (100.0%) Total
```

Pull Request: https://github.com/llvm/llvm-project/pull/122225

show more ...


# 186bd8e4 10-Jan-2025 Fangrui Song <i@maskray.me>

[CodeGen] Restore CodeGenerationTime

Fixes 48d0eb5181065a3d086de2e30f5c619fe407e4ce


# 48d0eb51 10-Jan-2025 Fangrui Song <i@maskray.me>

[CodeGen] Simplify EmitAssemblyHelper and emitBackendOutput

Prepare for -ftime-report change (#122225).


# 4c8fdc29 10-Jan-2025 Vitaly Buka <vitalybuka@google.com>

[nfc][BoundsChecking] Rename BoundsCheckingOptions into Options (#122359)


# 9c2de994 10-Jan-2025 Vitaly Buka <vitalybuka@google.com>

[nfc][BoundsChecking] Refactor BoundsCheckingOptions (#122346)

Remove ReportingMode and ReportingOpts.


# 2a163282 08-Jan-2025 Mingjie Xu <xumingjie.enna1@bytedance.com>

[tysan] Convert TySan from function+module pass to just module pass (#120667)

As mentioned in https://github.com/llvm/llvm-project/pull/118989, all
sanitizers but tsan are converted to just module

[tysan] Convert TySan from function+module pass to just module pass (#120667)

As mentioned in https://github.com/llvm/llvm-project/pull/118989, all
sanitizers but tsan are converted to just module pass for easier
maintenance.

This patch removes the TySan function pass, convert TySan from
function+module pass to just module pass.

show more ...


# 5bb65034 20-Dec-2024 Thurston Dang <thurston@google.com>

Remove -bounds-checking-unique-traps (replace with -fno-sanitize-merge=local-bounds) (#120682)

#120613 removed -ubsan-unique-traps and replaced it with
-fno-sanitize-merge (introduced in #120511),

Remove -bounds-checking-unique-traps (replace with -fno-sanitize-merge=local-bounds) (#120682)

#120613 removed -ubsan-unique-traps and replaced it with
-fno-sanitize-merge (introduced in #120511), which allows fine-grained
control of which UBSan checks to prevent merging. This analogous patch
removes -bound-checking-unique-traps, and allows it to be controlled via
-fno-sanitize-merge=local-bounds.

Most of this patch is simply plumbing through the compiler flags into
the bounds checking pass.

Note: this patch subtly changes -fsanitize-merge (the default) to also
include -fsanitize-merge=local-bounds. This is different from the
previous behavior, where -fsanitize-merge (or the old
-ubsan-unique-traps) did not affect local-bounds (requiring the separate
-bounds-checking-unique-traps). However, we argue that the new behavior
is more intuitive.

Removing -bounds-checking-unique-traps and merging its functionality
into -fsanitize-merge breaks backwards compatibility; we hope that this
is acceptable since '-mllvm -bounds-checking-unique-traps' was an
experimental flag.

show more ...


# c2aee506 20-Dec-2024 Vitaly Buka <vitalybuka@google.com>

[ubsan] Runtime and driver support for local-bounds (#120515)

Implements ``-f[no-]sanitize-trap=local-bounds``,
and ``-f[no-]sanitize-recover=local-bounds``.

LLVM part is here #120513.


# 55e87a79 18-Dec-2024 Vitaly Buka <vitalybuka@google.com>

[BoundsChecking] Add parameters to pass (#119894)

This check is a part of UBSAN, but does not support
verbose output like other UBSAN checks.

This is a step to fix that.


# c135f6ff 17-Dec-2024 Florian Hahn <flo@fhahn.com>

[TySan] Add initial Type Sanitizer support to Clang) (#76260)

This patch introduces the Clang components of type sanitizer: a
sanitizer for type-based aliasing violations.

It is based on Hal Fin

[TySan] Add initial Type Sanitizer support to Clang) (#76260)

This patch introduces the Clang components of type sanitizer: a
sanitizer for type-based aliasing violations.

It is based on Hal Finkel's https://reviews.llvm.org/D32198.

The Clang changes are mostly formulaic, the one specific change being
that when the TBAA sanitizer is enabled, TBAA is always generated, even
at -O0.

It goes together with the corresponding LLVM changes
(https://github.com/llvm/llvm-project/pull/76259) and compiler-rt
changes (https://github.com/llvm/llvm-project/pull/76261)

PR: https://github.com/llvm/llvm-project/pull/76260

show more ...


Revision tags: llvmorg-19.1.6
# 0f776f1d 13-Dec-2024 Chris Apple <cja-private@pm.me>

[rtsan][clang] NFC: Move rtsan init to addSanitizers (#119904)


# 4a658614 13-Dec-2024 Chris Apple <cja-private@pm.me>

[rtsan][llvm] Remove function pass, only support module pass (#119739)

Most of the other sanitizers are now only module level passes. This
moves all functionality into the module pass, and removes t

[rtsan][llvm] Remove function pass, only support module pass (#119739)

Most of the other sanitizers are now only module level passes. This
moves all functionality into the module pass, and removes the function
pass.

show more ...


# 7787328d 08-Dec-2024 Vitaly Buka <vitalybuka@google.com>

[ubsan] Improve lowering of @llvm.allow.ubsan.check (#119013)

This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up
to

[ubsan] Improve lowering of @llvm.allow.ubsan.check (#119013)

This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up
to 50% (deppedes on `cutoff-hot` value) .

`ScalarOptimizerLateEPCallback` was happening during
CGSCC walk, after each inlining, but this is effectively
after inlining.

Example, order in comments:

```
static void overflow() {
// 1. Inline get/set if possible
// 2. Simplify
// 3. LowerAllowCheckPass
set(get() + get());
}

void test() {
// 4. Inline
// 5. Nothing for LowerAllowCheckPass
overflow();
}
```

With this patch it will look like:
```
static void overflow() {
// 1. Inline get/set if possible
// 2. Simplify
set(get() + get());
}

void test() {
// 3. Inline
// 4. Simplify
overflow();
}

// Later, after inliner CGSCC walk complete:
// 5. LowerAllowCheckPass for `overflow`
// 6. LowerAllowCheckPass for `test`
```

show more ...


# ca3180ad 06-Dec-2024 Chris Apple <cja-private@pm.me>

[LLVM][rtsan] Add module pass to initialize rtsan (#118989)

This allows shared libraries instrumented with RTSan to be initialized.

This approach directly mirrors the approach in Tsan, Asan and man

[LLVM][rtsan] Add module pass to initialize rtsan (#118989)

This allows shared libraries instrumented with RTSan to be initialized.

This approach directly mirrors the approach in Tsan, Asan and many of
the other sanitizers

show more ...


Revision tags: llvmorg-19.1.5, llvmorg-19.1.4
# e8a66243 16-Nov-2024 Kazu Hirata <kazu@google.com>

[CodeGen] Remove unused includes (NFC) (#116459)

Identified with misc-include-cleaner.


# 390300d9 04-Nov-2024 Shilei Tian <i@tianshilei.me>

[PassBuilder] Add `ThinOrFullLTOPhase` to optimizer pipeline (#114577)


# dc45ff1d 04-Nov-2024 Shilei Tian <i@tianshilei.me>

[PassBuilder] Add `ThinOrFullLTOPhase` to early simplication EP call backs (#114547)

The early simplication pipeline is used in non-LTO and (Thin/Full)LTO
pre-link
stage. There are some passes tha

[PassBuilder] Add `ThinOrFullLTOPhase` to early simplication EP call backs (#114547)

The early simplication pipeline is used in non-LTO and (Thin/Full)LTO
pre-link
stage. There are some passes that we want them in non-LTO mode, but not
at LTO
pre-link stage. The control is missing currently. This PR adds the
support. To
demonstrate the use, we only enable the internalization pass in non-LTO
mode for
AMDGPU because having it run in pre-link stage causes some issues.

show more ...


# b01e2a8b 30-Oct-2024 Paul Kirth <paulkirth@google.com>

[llvm] Allow always dropping all llvm.type.test sequences

Currently, the `DropTypeTests` parameter only fully works with phi nodes
and llvm.assume instructions. However, we'd like CFI to work in
con

[llvm] Allow always dropping all llvm.type.test sequences

Currently, the `DropTypeTests` parameter only fully works with phi nodes
and llvm.assume instructions. However, we'd like CFI to work in
conjunction with FatLTO, in so far as the bitcode section should be able
to contain the CFI instrumentation, while any incompatible bits are
dropped when compiling the object code.

To do that, we need to drop the llvm.type.test instructions everywhere,
and not just their uses in phi nodes. This patch updates the
LowerTypeTest pass so that uses are removed, and replaced with `true` in
all cases, and not just in phi nodes.

Addressing this will allow us to fix #112053 by modifying the FatLTO
pipeline.

Reviewers: pcc, nikic

Reviewed By: pcc

Pull Request: https://github.com/llvm/llvm-project/pull/112787

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2
# dc85d526 09-Oct-2024 Kyungwoo Lee <kyulee@meta.com>

[CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (#90933)

This feature is enabled by `-codegen-data-thinlto-two-rounds`, which
effectively runs the `-codegen-data-generate` and `-codegen-

[CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (#90933)

This feature is enabled by `-codegen-data-thinlto-two-rounds`, which
effectively runs the `-codegen-data-generate` and `-codegen-data-use` in
two rounds to enable global outlining with ThinLTO.
1. The first round: Run both optimization + codegen with a scratch
output.
Before running codegen, we serialize the optimized bitcode modules to a
temporary path.
2. From the scratch object files, we merge them into the codegen data.
3. The second round: Read the optimized bitcode modules and start the
codegen only this time.
Using the codegen data, the machine outliner effectively performs the
global outlining.

Depends on #90934, #110461 and #110463.
This is a patch for
https://discourse.llvm.org/t/rfc-enhanced-machine-outliner-part-2-thinlto-nolto/78753.

show more ...


12345678910>>...35