Commit Graph

9461 Commits

Author SHA1 Message Date
James Henderson c975668ffc Fix llvm-strip --only-keep-debug documentation for ELF
The functionality (and llvm-objcopy's corresponding documentation) was
added in
5ad0103d8a.
It looks like the llvm-strip docs to match were missed.

Reviewed by: gbreynoo

Differential Revision: https://reviews.llvm.org/D121902
2022-03-18 06:49:05 +00:00
Paul Kirth 964398ccb1 Revert "Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics"""
This reverts commit 6cf560d69a.
2022-03-18 00:21:33 +00:00
Paul Kirth 6cf560d69a Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics""
I mistakenly reverted my commit, so I'm relanding it.

This reverts commit 10866a1df4.
2022-03-18 00:04:22 +00:00
Paul Kirth 10866a1df4 Revert "[misexpect] Re-implement MisExpect Diagnostics"
This reverts commit e7749d4713.
2022-03-17 23:54:26 +00:00
Paul Kirth e7749d4713 [misexpect] Re-implement MisExpect Diagnostics
Reimplements MisExpect diagnostics from D66324 to reconstruct its
original checking methodology only using MD_prof branch_weights
metadata.

New checks rely on 2 invariants:

1) For frontend instrumentation, MD_prof branch_weights will always be
   populated before llvm.expect intrinsics are lowered.

2) for IR and sample profiling, llvm.expect intrinsics will always be
   lowered before branch_weights are populated from the IR profiles.

These invariants allow the checking to assume how the existing branch
weights are populated depending on the profiling method used, and emit
the correct diagnostics. If these invariants are ever invalidated, the
MisExpect related checks would need to be updated, potentially by
re-introducing MD_misexpect metadata, and ensuring it always will be
transformed the same way as branch_weights in other optimization passes.

Frontend based profiling is now enabled without using LLVM Args, by
introducing a new CodeGen option, and checking if the -Wmisexpect flag
has been passed on the command line.

Differential Revision: https://reviews.llvm.org/D115907
2022-03-17 23:46:23 +00:00
Alina Sbirlea 6c4931e7d0 [docs] Fix codeblock. 2022-03-17 15:53:20 -07:00
Alina Sbirlea 187a5f230f [docs] Add details to MemorySSA docs.
Add more details to the docs regarding optimized accesses for Uses and Defs.
Include incoming changes from https://reviews.llvm.org/D121381.

Differential Revision: https://reviews.llvm.org/D121740
2022-03-17 15:25:09 -07:00
Mehdi Amini 6316129e06 Add a cmake flag to turn `llvm_unreachable()` into builtin_trap() when assertions are disabled
Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121750
2022-03-17 22:21:14 +00:00
Johannes Doerfert 88c3c346f6
Add another office hour 2022-03-17 12:48:13 -05:00
Julian Lettner 22570bac69 Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO
For MachO, lower `@llvm.global_dtors` into `@llvm_global_ctors` with
`__cxa_atexit` calls to avoid emitting the deprecated `__mod_term_func`.

Reuse the existing `WebAssemblyLowerGlobalDtors.cpp` to accomplish this.

Enable fallback to the old behavior via Clang driver flag
(`-fregister-global-dtors-with-atexit`) or llc / code generation flag
(`-lower-global-dtors-via-cxa-atexit`).  This escape hatch will be
removed in the future.

Differential Revision: https://reviews.llvm.org/D121736
2022-03-17 10:47:13 -07:00
Craig Topper dc516ce6c8 [RISCV] Mention Zvfh extension in release notes. NFC 2022-03-17 10:12:50 -07:00
Stanislav Mekhanoshin 3a37d08b35 [AMDGPU] Correct gfx940 memory model documentation.
Differential Revision: https://reviews.llvm.org/D121397
2022-03-16 11:59:40 -07:00
Bill Wendling 114a8903b8 [docs] Fix typo in tutorial
Use "operands" instead of "operators"

Closes #54397
2022-03-16 11:44:23 -07:00
Tobias Nießen eaafa70017 [libfuzzer] improve introductory sentence
This merely adds a missing "an" in the introductory sentence.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D121760
2022-03-15 17:19:20 -07:00
Simon Pilgrim 7262eacd41 Revert rG9c542a5a4e1ba36c24e48185712779df52b7f7a6 "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"
Mane of the build bots are complaining: Unknown command line argument '-lower-global-dtors'
2022-03-15 13:01:35 +00:00
Keith Smiley 6541d3e979 [test] Add lit helper for windows paths
This adds 2 new lit helpers `%{fs-src-root}` and `%{fs-sep}`, these
allow writing tests that correctly handle slashes on Windows. In the
case of tests like clang/test/CodeGen/debug-prefix-map.c, these are
unable to correctly test behavior on both platforms, unless they fork
and add OS requirements, because the relevant logic hits host specific
codepaths like checking if paths are absolute.

Differential Revision: https://reviews.llvm.org/D111457
2022-03-14 20:05:55 -07:00
Julian Lettner 9c542a5a4e Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO
For MachO, lower `@llvm.global_dtors` into `@llvm_global_ctors` with
`__cxa_atexit` calls to avoid emitting the deprecated `__mod_term_func`.

Reuse the existing `WebAssemblyLowerGlobalDtors.cpp` to accomplish this.

Enable fallback to the old behavior via Clang driver flag
(`-fregister-global-dtors-with-atexit`) or llc / code generation flag
(`-lower-global-dtors-via-cxa-atexit`).  This escape hatch will be
removed in the future.

Differential Revision: https://reviews.llvm.org/D121327
2022-03-14 17:51:18 -07:00
Stanislav Mekhanoshin 47bac63d3f [AMDGPU] gfx940 memory model
Differential Revision: https://reviews.llvm.org/D121242
2022-03-14 15:01:46 -07:00
sstwcw 65a3712af6 [yamlio] Allow parsing an entire mapping as an enumeration
For when we want to change a configuration option from an enum into a
struct.  The need arose when working on D119599.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D120363
2022-03-14 04:41:40 +00:00
Nikita Popov 374bb6dd80 [docs] Update opaque pointers transition state (NFC)
Bitcode is now supported.
2022-03-11 09:35:38 +01:00
Sylvestre Ledru 54d7fde46e llvm-ifs doc: Replace a utf-8 char by a more classic one
Fails on old python (like on ubuntu bionic) otherwise with:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2130: ordinal not in range(128)
2022-03-10 22:45:05 +01:00
Aaron Ballman 11407c58a2 Fix the dates for the C and C++ language working group
It's 1st and 3rd Wed of the month instead of every other.
2022-03-10 13:09:00 -05:00
Lorenzo Albano 28cfa764c2 [VP] Strided loads/stores
This patch introduces two new experimental IR intrinsics and SDAG nodes
to represent vector strided loads and stores.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D114884
2022-03-10 18:46:54 +01:00
Xiang1 Zhang c31014322c TLS loads opimization (hoist)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120000
2022-03-10 09:29:06 +08:00
Aaron Ballman c233c1acf8 Add the C and C++ Language Working Group meeting info 2022-03-09 10:19:06 -05:00
Aaron Ballman 338dfcd60f Update my office hours
Adds "frontend attributes" to the list of things to come talk about,
removes the extra timezone information to hopefully reduce confusion
about daylight savings time.
2022-03-09 07:57:30 -05:00
Tom Stellard 9cb0605c0e docs: Update instructions for requesting backports to the release branches
Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D120974
2022-03-08 16:28:02 -08:00
Jacob Lambert 5160447f58 [AMDGPU] Add gfx10 assembler directive to specify shared VGPR count
Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D105507
2022-03-07 14:27:41 -08:00
Petr Hosek b5f1a8cfc3 [llvm-cov] New parameters to set coverage coverage_watermark
Add a pairs of parameters to set coverage watermark for llvm-cov, and
user can change the percentage thresholds marked with different colors
in the report.

Patch By: tanjinhua

Differential Revision: https://reviews.llvm.org/D116876
2022-03-04 22:21:40 -08:00
Tanya Lattner ca8432f1ee Update references to the mailing list to reference Discourse. Also update references to LLVM Bugzilla as we have moved to GitHub issues.
Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D120833
2022-03-04 14:27:50 -08:00
Augie Fackler d664c4b73c Attributes: add a new allocalign attribute
This will let us start moving away from hard-coded attributes in
MemoryBuiltins.cpp and put the knowledge about various attribute
functions in the compilers that emit those calls where it probably
belongs.

Differential Revision: https://reviews.llvm.org/D117921
2022-03-04 15:57:53 -05:00
Arthur Eubanks f0b61f7957 Revert "[GlobalOpt] Don't replace alias with aliasee if either alias/aliasee may be preemptible"
This reverts commit 30e8f83c84.

Causes huge compile time regressions on certain large files. Will followup offline with author.
2022-03-03 11:04:14 -08:00
Aakanksha 840695814a [AMDGPU] Add gfx1036 target
Differential Revision: https://reviews.llvm.org/D120846
2022-03-02 23:26:38 +00:00
Stanislav Mekhanoshin 2e2e64df4a [AMDGPU] Add gfx940 target
This is target definition only.

Differential Revision: https://reviews.llvm.org/D120688
2022-03-02 13:54:48 -08:00
Simon Moll d05ddb86f6 [VP] vp.sitofp cast intrinsic and docs
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D119922
2022-03-02 10:16:19 +01:00
Simon Moll febf548129 [VP] Fix vp.fptosi LangRef example
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D120068
2022-03-02 10:15:32 +01:00
Zequan Wu 5c9e20d7d0 [PDB] Add char8_t type
Differential Revision: https://reviews.llvm.org/D120690
2022-03-01 13:39:51 -08:00
Tong Zhang 17ce89fa80 [SanitizerBounds] Add support for NoSanitizeBounds function
Currently adding attribute no_sanitize("bounds") isn't disabling
-fsanitize=local-bounds (also enabled in -fsanitize=bounds). The Clang
frontend handles fsanitize=array-bounds which can already be disabled by
no_sanitize("bounds"). However, instrumentation added by the
BoundsChecking pass in the middle-end cannot be disabled by the
attribute.

The fix is very similar to D102772 that added the ability to selectively
disable sanitizer pass on certain functions.

In this patch, if no_sanitize("bounds") is provided, an additional
function attribute (NoSanitizeBounds) is attached to IR to let the
BoundsChecking pass know we want to disable local-bounds checking. In
order to support this feature, the IR is extended (similar to D102772)
to make Clang able to preserve the information and let BoundsChecking
pass know bounds checking is disabled for certain function.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D119816
2022-03-01 18:47:02 +01:00
Haowei Wu 8ada9b570d [doc] Add llvm-ifs commandline guide
This patch adds llvm-ifs commandline guide

Differential Review: https://reviews.llvm.org/D118514
2022-02-28 11:18:09 -08:00
Changpeng Fang ca62b1db9f [AMDGPU][NFC]: Emit metadata for hidden_heap_v1 kernarg
Summary:
  Emit metadata for hidden_heap_v1 kernarg

Reviewers:
  sameerds, b-sumner

Fixes:
  SWDEV-307188

Differential Revision:
  https://reviews.llvm.org/D119027
2022-02-25 10:45:35 -08:00
Daniel Thornburgh 565add5a62 [Debuginfod] Add BUILD_ID syntax to llvm-symbolizer.
This adds a BUILD_ID prefix to the llvm-symbolizer stdin and argument
syntax. The prefix causes the given binary name to be interpreted as a
build ID instead of an object file path. The semantics are analagous to
the behavior of --obj and --build-id.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D119901
2022-02-25 00:39:13 +00:00
Aaron Ballman 14536ce007 Add myself to the office hours; correct small typo in prose 2022-02-23 08:14:11 -05:00
Alina Sbirlea ed69e3266c [Docs]Add office hours. 2022-02-22 16:40:01 -08:00
Adrian Prantl 621e2de138 Add a (nonfunctional) -dyld_info flag to llvm-objdump.
Darwin otool implements this flag as a one-stop solution for
displaying bind and rebase info. As I am working on upstreaming
chained fixup support this command will be useful to write testcases.

Differential Revision: https://reviews.llvm.org/D113573
2022-02-22 11:06:27 -08:00
Tanya Lattner b4990ac330 Update references to the mailing lists that have moved to Discourse. 2022-02-21 18:58:48 -08:00
Kristof Beyls 7a837d38bd Create office hours documentation.
Differential Revision: https://reviews.llvm.org/D120036
2022-02-21 20:21:16 +01:00
Alex Bradbury 8d894270a6 [docs] Update ReleaseNotes template
This change makes several updates to the ReleaseNotes template:

* Orders the backend/target updates alphabetically
* Adds RISC-V to the list
* Uses "Backend" rather than a mix of "Target" and "Backend" (I don't
  have a strong view on which term is used, but we should be
  consistent!)
* Uses * ... as the placeholder text, as this matches the format
  actually used for most updates in recent releases

Differential Revision: https://reviews.llvm.org/D120043
2022-02-20 19:42:07 +00:00
Nuno Lopes 35b92c1464 [docs] fix typo 2022-02-20 18:43:30 +00:00
Nuno Lopes 8608650a76 [docs] Frotend perf tips: mention poison vs undef and noundef attribute 2022-02-20 11:59:04 +00:00
Nuno Lopes da23fc966b [docs] Simplify the description of poison values 2022-02-20 11:41:49 +00:00
Nuno Lopes 5c404049b5 [docs] Add a note saying that the use of poison is preferred to the use of undef
Plus fix a few wrong examples with undef
2022-02-20 11:33:47 +00:00
fourdim bc53ebbda8 [docs] HowToCrossCompileLLVM.rst: update cmake options
This patch updates the cmake options suggested when cross compiling. This should fix [#52819](https://github.com/llvm/llvm-project/issues/52819).

Brad King (Member of CMake) says:

The linked [CMAKE_CROSSCOMPILING](https://cmake.org/cmake/help/v3.22/variable/CMAKE_CROSSCOMPILING.html) documentation says:

This variable will be set to true by CMake if the `CMAKE_SYSTEM_NAME` variable has been set manually (i.e. in a toolchain file or as a cache entry from the cmake command line).

It is not meant to be set by project code or toolchain files. It is always set automatically. Don't put `set(CMAKE_CROSSCOMPILING ON)` anywhere in your code.

`CMAKE_CROSSCOMPILING` indicates only whether `CMAKE_SYSTEM_NAME` was set by the user/project/toolchain-file instead of by CMake.

In LLVM project, `CMAKE_CROSSCOMPILING` is used to determine whether to execute some tests on the host machine.

LLVM needs to use another method for that. `CMAKE_CROSSCOMPILING` is not a reliable indicator of whether produced binaries will run on the host, and does not claim so in its documentation. If one sets `CMAKE_SYSTEM_NAME` to Linux in a toolchain file, and builds on a Linux host, that doesn't mean the target architecture or minimum glibc version is the same.

Reviewed By: rengolin

Differential Revision: https://reviews.llvm.org/D119804
2022-02-19 20:37:12 +08:00
Arthur Eubanks bfdf28f963 [docs][NewPM] Remove buildDefaultAAPipeline() in example
With D113210 we're already using the default AA pipeline by default.
2022-02-18 10:43:26 -08:00
zhijian fd3ba1f862 Title: Export unique symbol list with llvm-nm new option "--export-symbols"
Summary:

the patch implement of following functionality.
1. export the symbols from archive or object files.
2. sort the export symbols. (based on same symbol name and visibility)
3. delete the duplicate export symbols (based on same symbol name and visibility)
4. print out the  unique and sorted export symbols (print the symbol name and visibility).

there are two new options are add in the patch
1. --export-symbols (enable the functionality of export unique symbol)
2. --no-rsrc (exclude the symbol name begin with "__rsrc" from be exporting from xcoff object file)

Export symbol list for xcoff object file has the same functionality as
The patch has the same functionality as
https://www.ibm.com/docs/en/xl-c-aix/13.1.0?topic=library-exporting-symbols-createexportlist-utility

Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D112735
2022-02-17 11:37:33 -05:00
Nikita Popov dce3b403a7 [Docs] Use correct rst syntax 2022-02-17 14:08:46 +01:00
Nikita Popov 4846568191 [Docs] Update opaque pointers docs
Expand migration instructions.
2022-02-17 13:03:33 +01:00
Jacob Lambert 7470244475 [AMDGPU] Add agpr_count to metadata and AsmParser
gfx90a allows the number of ACC registers (AGPRs) to be set
independently to the VGPR registers. For both HSA and PAL metadata, we
now include an "agpr_count" key to report the number of AGPRs set for
supported devices (gfx90a, gfx908, as determined by hasMAIInsts()).
This is collected from SIProgramInfo.NumAccVGPR for both HSA and PAL.
The AsmParser also now recognizes ".kernel.agpr_count" for supported
devices.

Differential Revision: https://reviews.llvm.org/D116140
2022-02-16 15:17:23 -08:00
Kristof Beyls 520a925272 Fix 2 RestructuredText warnings. 2022-02-16 14:16:52 +01:00
Simon Moll 03e83cc8eb [VP] vp.fptosi cast intrinsic and docs
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D119535
2022-02-15 18:17:19 +01:00
zhijian 0135aa7b98 [llvm-nm] add a new option -X to specify the type of object file llvm-nm should examine
Summary:
Added a new option "-X" to specify, which type of object file should be examine.

For example:

1. "llvm-nm -X64 archive.a" only deal with the 64bit object files in the archive.a ,ignore the all 32bit object files in the archive.a
2. "llvm-nm -X32 xcoffobj32.o xcoffobj64.o " only deal with the 32bit object file "xcoffobj32.o" , 64bit object file "xcoffobj64.o" will be ignored

Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D118193
2022-02-15 09:43:31 -05:00
David Spickett 8d4d0f7d1a [lldb] Remove memory region non-address change from release notes
This is now on 14.x as af19ae529271f9ae96927662d7d876489115fb26
so it is not new to 15.
2022-02-15 11:36:55 +00:00
Markus Böck db8ae2fef1 [llvm][doc] Update comments and documentation of custom stackmap formats in GC
Since https://reviews.llvm.org/D53892 it is possible to emit a custom stackmap by overwriting the emitStackMaps method of GCMetadataPrinter. That way even AOT compilers can generate a more efficient and more suitable format for their needs.

This patch updates documentation and stale comments in source code. In particular it removes the issue from the issue list in the Statepoints documentation and adjusts comments in GCStrategy.

Differential Revision: https://reviews.llvm.org/D119660
2022-02-15 12:17:19 +01:00
Ahmed Bougacha c703f852c9 [IR] Define "ptrauth" operand bundle.
This introduces a new "ptrauth" operand bundle to be used in
call/invoke. At the IR level, it's semantically equivalent to an
@llvm.ptrauth.auth followed by an indirect call, but it additionally
provides additional hardening, by preventing the intermediate raw
pointer from being exposed.

This mostly adds the IR definition, verifier checks, and support in
a couple of general helper functions. Clang IRGen and backend support
will come separately.

Note that we'll eventually want to support this bundle in indirectbr as
well, for similar reasons.  indirectbr currently doesn't support bundles
at all, and the IR data structures need to be updated to allow that.

Differential Revision: https://reviews.llvm.org/D113685
2022-02-14 11:27:35 -08:00
Momchil Velikov 6398903ac8 Extend the `uwtable` attribute with unwind table kind
We have the `clang -cc1` command-line option `-funwind-tables=1|2` and
the codegen option `VALUE_CODEGENOPT(UnwindTables, 2, 0) ///< Unwind
tables (1) or asynchronous unwind tables (2)`. However, this is
encoded in LLVM IR by the presence or the absence of the `uwtable`
attribute, i.e.  we lose the information whether to generate want just
some unwind tables or asynchronous unwind tables.

Asynchronous unwind tables take more space in the runtime image, I'd
estimate something like 80-90% more, as the difference is adding
roughly the same number of CFI directives as for prologues, only a bit
simpler (e.g. `.cfi_offset reg, off` vs. `.cfi_restore reg`). Or even
more, if you consider tail duplication of epilogue blocks.
Asynchronous unwind tables could also restrict code generation to
having only a finite number of frame pointer adjustments (an example
of *not* having a finite number of `SP` adjustments is on AArch64 when
untagging the stack (MTE) in some cases the compiler can modify `SP`
in a loop).
Having the CFI precise up to an instruction generally also means one
cannot bundle together CFI instructions once the prologue is done,
they need to be interspersed with ordinary instructions, which means
extra `DW_CFA_advance_loc` commands, further increasing the unwind
tables size.

That is to say, async unwind tables impose a non-negligible overhead,
yet for the most common use cases (like C++ exceptions), they are not
even needed.

This patch extends the `uwtable` attribute with an optional
value:
      -  `uwtable` (default to `async`)
      -  `uwtable(sync)`, synchronous unwind tables
      -  `uwtable(async)`, asynchronous (instruction precise) unwind tables

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D114543
2022-02-14 14:35:02 +00:00
Nikita Popov 5a43a278f7 [Docs] Update OpaquePointers transition state (NFC)
We're at a point where working optimized binaries can be produced
in opaque pointer mode.
2022-02-14 12:55:58 +01:00
Markus Böck e101eb5c7b [llvm][doc] Add Aarch64 to list of architectures supporting statepoints
Fixes https://github.com/llvm/llvm-project/issues/53655

Differential Revision: https://reviews.llvm.org/D119659
2022-02-13 20:35:15 +01:00
YASHASVI KHATAVKAR f9f78a2c40 Fix build broken by missing empty line in SourceLevelDebugging.rst 2022-02-11 15:19:07 -05:00
YASHASVI KHATAVKAR 70fdbf35de Adding DiBuilder interface for assumed length strings 2022-02-11 14:40:02 -05:00
Julien Pages dcb2da13f1 [AMDGPU] Add a new intrinsic to control fp_trunc rounding mode
Add a new llvm.fptrunc.round intrinsic to precisely control
the rounding mode when converting from f32 to f16.

Differential Revision: https://reviews.llvm.org/D110579
2022-02-11 12:08:23 -05:00
Louis Dionne 6a7f6e9404 [docs] Fix missing space in the GettingStarted documentation 2022-02-11 09:17:37 -05:00
Arthur Eubanks 2fa87ab524 [docs] Replace `opt -analyze` with better alternatives.
`opt -analyze` is legacy PM-specific. Show better ways of doing the same
thing, generally with some sort of `-passes=print<foo>`.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D119486
2022-02-10 15:38:31 -08:00
YASHASVI KHATAVKAR 93d1a623ce Reverting an entire stack of changes causing build failures 2022-02-10 17:58:22 -05:00
YASHASVI KHATAVKAR ac15cd7af6 Modified SourceLevelDebugging.rst to include information about memory location exp 2022-02-10 15:24:51 -05:00
Louis Dionne 4ae83bb2b1 Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS
We are moving away from building the runtimes with LLVM_ENABLE_PROJECTS,
however the documentation was largely outdated. This commit updates all
the documentation I could find to use LLVM_ENABLE_RUNTIMES instead of
LLVM_ENABLE_PROJECTS for building runtimes.

Note that in the near future, libcxx, libcxxabi and libunwind will stop
supporting being built with LLVM_ENABLE_PROJECTS altogether. I don't know
what the plans are for other runtimes like libc, openmp and compiler-rt,
so I didn't make any changes to the documentation that would imply
something for those projects.

Once this lands, I will also cherry-pick this on the release/14.x branch
to make sure that LLVM's documentation is up-to-date and reflects what
we intend to support in the future.

Differential Revision: https://reviews.llvm.org/D119351
2022-02-10 15:05:23 -05:00
David Spickett 2937b28218 Reland "[lldb] Remove non address bits when looking up memory regions"
This reverts commit 0df522969a.

Additional checks are added to fix the detection of the last memory region
in GetMemoryRegions or repeating the "memory region" command when the
target has non-address bits.

Normally you keep reading from address 0, looking up each region's end
address until you get LLDB_INVALID_ADDR as the region end address.
(0xffffffffffffffff)

This is what the remote will return once you go beyond the last mapped region:
[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
[0x0001000000000000-0xffffffffffffffff) ---

Problem is that when we "fix" the lookup address, we remove some bits
from it. On an AArch64 system we have 48 bit virtual addresses, so when
we fix the end address of the [stack] region the result is 0.
So we loop back to the start.

[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
[0x0000000000000000-0x0000000000400000) ---

To fix this I added an additional check for the last range.
If the end address of the region is different once you apply
FixDataAddress, we are at the last region.

Since the end of the last region will be the last valid mappable
address, plus 1. That 1 will be removed by the ABI plugin.

The only side effect is that on systems with non-address bits, you
won't get that last catch all unmapped region from the max virtual
address up to 0xf...f.

[0x0000fffff8000000-0x0000fffffffdf000) ---
[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
<ends here>

Though in some way this is more correct because that region is not
just unmapped, it's not mappable at all.

No extra testing is needed because this is already covered by
TestMemoryRegion.py, I simply forgot to run it on system that had
both top byte ignore and pointer authentication.

This change has been tested on a qemu VM with top byte ignore,
memory tagging and pointer authentication enabled.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D115508
2022-02-10 10:42:49 +00:00
Lu Weining 42fd2bfc90 [LoongArch 1/6] Add triples loongarch{32,64} for the upcoming LoongArch target
This is the first patch to incrementally add an MC layer for LoongArch to LLVM.
This patch also adds unit testcases for these new triples.

RFC for adding this new backend:
https://lists.llvm.org/pipermail/llvm-dev/2021-December/154371.html

Differential revision: https://reviews.llvm.org/D115857
2022-02-10 10:23:34 +00:00
Daniel Thornburgh 694f384553 [Debuginfod] Flag-determine debuginfod lookups in llvm-symbolizer.
This change adds a pair of flags controlling whether llvm-symbolizer
attempts debuginfod lookups. Lookups are attempted if --debuginfod is
passed and disabled if --no-debuginfod is passed.

The default behavior is made more nuanced: debuginfod lookups are now
only attempted if an HTTP client is compiled in and at least one backing
debuginfod URL was configured via environment variable. Previously,
debuginfod lookups would always be attempted, even if there were no
chance that they could succeed.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D118665
2022-02-09 22:20:54 +00:00
Craig Topper 60745fb16f [VP] llvm.vp.fneg intrinsic and LangRef
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D119262
2022-02-09 07:54:36 -08:00
Daniel Thornburgh dcd4950d42 [Symbolizer] Add Build ID flag to llvm-symbolizer.
This adds a --build-id=<hex build ID> flag to llvm-symbolizer. If --obj
is unspecified, this will attempt to look up the provided build ID using
whatever mechanisms are available to the Symbolizer (typically,
debuginfod). The semantics are then as if the found binary were given
using the --obj flag.

Reviewed By: jhenderson, phosek

Differential Revision: https://reviews.llvm.org/D118633
2022-02-08 23:08:18 +00:00
Lancelot Six 046017291f [AMDGPU][NFC] AMDGPUUsage.rst: fix wording. 2022-02-07 20:06:17 -05:00
Craig Topper cef177d186 [VP] llvm.vp.fma intrinsic and LangRef
Differential Revision: https://reviews.llvm.org/D119185
2022-02-07 15:53:27 -08:00
Keith Smiley 4c12a75e69 [llvm-libtool-darwin] Add -warnings_as_errors
libtool can currently produce 2 warnings:

1. No symbols were in the object file
2. An object file with the same basename was specified multiple times

The first warning here is often harmless and may just mean you have some
translation units with no symbols for the target you're building for.
The second warning can lead to real issues like those mentioned in
https://reviews.llvm.org/D113130 where ODR violations can slip in.

This introduces a new -warnings_as_errors flag that can be used by build
systems that want to verify they never hit these warnings. For example
with bazel the libtool caller first uniques names to make sure the
duplicate base name case is not possible, but if that doesn't work as
expected, having it fail would be preferred.

It's also worth noting that llvm-libtool-darwin works around an issue
that cctools libtool experiences related to debug info and duplicate
basenames, the workaround is described here:
30baa5d2a4/llvm/lib/Object/ArchiveWriter.cpp (L424-L465)
And it avoids this bug:
f0cbbb1c37/DuplicateBasenameIssue

Differential Revision: https://reviews.llvm.org/D118931
2022-02-07 14:39:21 -08:00
Mark Murray 3d7662142d [ARM] Undeprecate complex IT blocks
AArch32/Armv8A  introduced the performance deprecation of certain patterns
of IT instructions.  After some debate internal to ARM, this is now being
reverted; i.e. no IT instruction patterns are performance deprecated
anymore, as the perfomance degredation is not significant enough.

This reverts the following:

"ARMv8-A deprecates some uses of the T32 IT instruction. All uses of
IT that apply to instructions other than a single subsequent 16-bit
instruction from a restricted set are deprecated, as are explicit
references to the PC within that single 16-bit instruction. This permits
the non-deprecated forms of IT and subsequent instructions to be treated
as a single 32-bit conditional instruction."

The deprecation no longer applies, but the behaviour may be controlled
by the -arm-restrict-it and -arm-no-restrict-it command-line options,
with the latter being the default. No warnings about complex IT blocks
will be generated.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D118044
2022-02-07 15:47:53 +00:00
Volodymyr Turanskyy c127ba25fb Add LLVM Embedded Toolchains call to the table of sync ups.
LLVM Embedded Toolchains working group regular sync up calls to start in early
March, adding details to the table of sync ups for general reference.

Differential Revision: https://reviews.llvm.org/D118884
2022-02-07 16:38:42 +01:00
Dmitry Preobrazhensky 95a52b376a [AMDGPU][GFX9][DOC][NFC] Corrected description of registers available via getreg/setreg
This is to reflect changes introduced by https://reviews.llvm.org/D118860.
2022-02-04 17:55:32 +03:00
Nikita Popov e990e591c9 [LangRef] Require elementtype attribute for gc.statepoint intrinsic
The gc.statepoint intrinsic currently determines the target function
type based on the pointer element type of the argument. In order to
support opaque pointers, require that the argument is annotated with
an elementtype attribute.

Here's an example of the change:

    ; Before:
      %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0)

    ; After:
      %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)

    ; After with opaque pointers:
      %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)

Differential Revision: https://reviews.llvm.org/D117890
2022-02-04 09:47:31 +01:00
Changpeng Fang 022c8d4a3f AMDGPU [NFC]: Fix a few typos in docs AMDGPUUsage.rst
Summery:
  Fix a few typos in docs AMDGPUUsage.rst

Differential Revision:
  https://reviews.llvm.org/D118272
2022-02-02 14:22:52 -08:00
Lancelot SIX 73ed118eda [Docs][NFC] Contributing.rst: fix wording
Fix a sentence containing two consecutive 'and'.
2022-02-02 13:49:03 +01:00
Tom Stellard a2601c9887 Bump the trunk major version to 15 2022-02-01 23:54:52 -08:00
Tom Stellard e80c52986e [docs] Remove hard-coded version numbers from sphinx configs
This updates all the non-runtime project release notes to use the
version number from CMake instead of the hard-coded version numbers
in conf.py.

It also hides warnings about pre-releases when the git suffix
is dropped from the LLVM version in CMake.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112181
2022-02-01 23:14:12 -08:00
Tanya Lattner 1b12e92c80 Update status on migration again. Add note about issues with reply by email from emails pre-migration. 2022-02-01 22:25:31 -08:00
Tanya Lattner bbc5b62e85 Add new status of the move to Discourse. 2022-02-01 18:30:46 -08:00
Tanya Lattner e36afc6511 Update discourse migration status. 2022-02-01 18:09:31 -08:00
Tanya Lattner 769d634789 Update status of move. 2022-02-01 10:45:40 -08:00
Fangrui Song 30e8f83c84 [GlobalOpt] Don't replace alias with aliasee if either alias/aliasee may be preemptible
Generalize D99629 for ELF. A default visibility non-local symbol is preemptible
in a -shared link. `isInterposable` is an insufficient condition.

Moreover, a non-preemptible alias may be referenced in a sub constant expression
which intends to lower to a PC-relative relocation. Replacing the alias with a
preemptible aliasee may introduce a linker error.

Respect dso_preemptable and suppress optimization to fix the abose issues. With
the change, `alias = 345` will not be rewritten to use aliasee in a `-fpic`
compile.
```
int aliasee;
extern int alias __attribute__((alias("aliasee"), visibility("hidden")));
void foo() { alias = 345; } // intended to access the local copy
```

While here, refine the condition for the alias as well.

For some binary formats like COFF, `isInterposable` is a sufficient condition.
But I think canonicalization for the changed case has little advantage, so I
don't bother to add the `Triple(M.getTargetTriple()).isOSBinFormatELF()` or
`getPICLevel/getPIELevel` complexity.

For instrumentations, it's recommended not to create aliases that refer to
globals that have a weak linkage or is preemptible. However, the following is
supported and the IR needs to handle such cases.
```
int aliasee __attribute__((weak));
extern int alias __attribute__((alias("aliasee")));
```

There are other places where GlobalAlias isInterposable usage may need to be
fixed.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D107249
2022-02-01 10:41:16 -08:00
Fangrui Song dd6e7e0d57 [llvm-ar] Add --thin for creating a thin archive
In GNU ar (since 2008), the modifier 'T' means creating a thin archive.
In many other ar implementations (FreeBSD, macOS, elfutils, etc), -T
means "allow filename truncation of extracted files", as specified by
X/Open System Interface.

For portability, 'T' with thin archive semantics should be avoided.

See https://sourceware.org/bugzilla/show_bug.cgi?id=28759 binutils 2.38
will deprecate 'T' (without diagnostic) and add --thin.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D116979
2022-02-01 09:56:50 -08:00
Tanya Lattner acef496b5e Add status of migration. 2022-01-31 19:03:29 -08:00
Changpeng Fang 1194b9cdda AMDGPU {NFC}: Add code object v5 support and generate metadata for implicit kernel args
Summary:
  Add code object v5 support (deafult is still v4)
  Generate metadata for implicit kernel args for the new ABI
  Set the metadata version to be 1.2

Reviewers:
  t-tye, b-sumner, arsenm, and bcahoon

Fixes:
  SWDEV-307188, SWDEV-307189

Differential Revision:
  https://reviews.llvm.org/D118272
2022-01-31 18:07:47 -08:00
Daniel McIntosh 0ee7a2c304 [docs] Update Prolog/Epilog Code Insertion docs to show it's still incomplete
Compact Unwind is a subsection, but that was lost in rGff9feeb520a32d076c3095468208ae116c428285

Reviewed By: void

Differential Revision: https://reviews.llvm.org/D118499
2022-01-31 15:25:46 -05:00
Jeff Bailey f86844da49 Remove reference to LLVMLibC as the doc has moved.
https://reviews.llvm.org/D117436 caused a build failure
due to this error.

Tested:
ninja docs-llvm-libc builds

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D118537
2022-01-29 23:39:03 +00:00
Simon Pilgrim 058c5dfc78 Raise the minimum Visual Studio version to VS2019
As raised here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153881.html

Now that VS2022 is on general release, LLVM is expected to build on VS2017, VS2019 and VS2022, which is proving hazardous to maintain due to changes in behaviour including preprocessor and constexpr changes. Plus of the few developers that work with VS, many have already moved to VS2019/22.

This patch proposes to raise the minimum supported version to VS2019 (16.x) - I've made the hard limit 16.0 or later, with the soft limit VS2019 16.7 - older versions of VS2019 are "allowed" (at your own risk) via the LLVM_FORCE_USE_OLD_TOOLCHAIN cmake flag.

Differential Revision: https://reviews.llvm.org/D114639
2022-01-29 10:56:41 +00:00
Jeff Bailey 4465c29906 Move LLVM Proposal to doc directory, create index
The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project.  This changes
puts the pieces into the right place so that the webpage can be
created.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D117436
2022-01-29 00:29:31 +00:00
Ahmed Bougacha 634ca7349d [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.
Currently, the clang.arc.attachedcall bundle takes an optional function
argument.  Depending on whether the argument is present, calls with this
bundle have the following semantics:

- on x86, with the argument present, the call is lowered to:
    call _target
    mov rax, rdi
    call _objc_retainAutoreleasedReturnValue

- on AArch64, without the argument, the call is lowered to:
    bl _target
    mov x29, x29

  and the objc runtime call is expected to be emitted separately.

That's because, on x86, the objc runtime checks for both the mov and
the call on x86, and treats the combination as the ARC autorelease elision
marker.

But on AArch64, it only checks for the dedicated NOP marker, as that's
historically been sufficiently unique.  Thanks to that, the runtime call
wasn't required to be adjacent to the NOP marker, so it wasn't emitted
as part of the bundle sequence.

This patch unifies both architectures: on AArch64, we now emit all
3 instructions for the bundle.  This guarantees that the runtime call
is adjacent to the marker in the sequence, and that's information the
runtime can use to further optimize this.

This helps simplify some of the handling, in particular
BundledRetainClaimRVs, which no longer needs to know whether the bundle
is sufficient or not: it now always should be.

Note that this does not include an AutoUpgrade for the nullary bundles,
as they are only produced in ObjCContract as part of the obj/asm emission
pipeline, and are not expected to be in bitcode.

Differential Revision: https://reviews.llvm.org/D118214
2022-01-28 12:41:45 -08:00
Ellis Hoag 11d3074267 [InstrProf] Add single byte coverage mode
Use the llvm flag `-pgo-function-entry-coverage` to create single byte "counters" to track functions coverage. This mode has significantly less size overhead in both code and data because
  * We mark a function as "covered" with a store instead of an increment which generally requires fewer assembly instructions
  * We use a single byte per function rather than 8 bytes per block

The trade off of course is that this mode only tells you if a function has been covered. This is useful, for example, to detect dead code.

When combined with debug info correlation [0] we are able to create an instrumented Clang binary that is only 150M (the vanilla Clang binary is 143M). That is an overhead of 7M (4.9%) compared to the default instrumentation (without value profiling) which has an overhead of 31M (21.7%).

[0] https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D116180
2022-01-27 17:38:55 -08:00
Tanya Lattner 586759cee5 Add email addresses to create a topic via email in a specific category. 2022-01-26 23:22:04 -08:00
Aaron Ballman f3e22946e5 Update the Bug Life Cycle docs for the switch to GitHub issues
This updates the Bug Life Cycle docs now that we've switched to GitHub
issues. The intent is to retain the same general process we used to
use for triaging bugs under Bugzilla, but with the facilities we have
available in GitHub.
2022-01-26 15:55:36 -05:00
Matt Arsenault e6564f39c7 AMDGPU: Emit user sgpr count directives in text asm
We were emitting these in the object file but not printing them.
2022-01-26 13:51:12 -05:00
David Spickett 070090d08e [lldb] Add option to show memory tags in memory read output
This adds an option --show-tags to "memory read".

(lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags
0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0)
0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1)

Tags are printed on the end of each line, if that
line has any tags associated with it. Meaning that
untagged memory output is unchanged.

Tags are printed based on the granule(s) of memory that
a line covers. So you may have lines with 1 tag, with many
tags, no tags or partially tagged lines.

In the case of partially tagged lines, untagged granules
will show "<no tag>" so that the ordering is obvious.
For example, a line that covers 2 granules where the first
is not tagged:

(lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)

Untagged lines will just not have the "(tags: ..." at all.
Though they may be part of a larger output that does have
some tagged lines.

To do this I've extended DumpDataExtractor to also print
memory tags where it has a valid execution context and
is asked to print them.

There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
in DumpDataExtractor.

We use MakeTaggedRanges to find all the tagged memory
in the current dump, then read all that into a MemoryTagMap.

The tag map is populated once in DumpDataExtractor and re-used
for each subsequently printed line (or recursive call of
DumpDataExtractor, which some formats do).

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D107140
2022-01-26 14:40:39 +00:00
Fangrui Song d2cc23a337 [docs] HowToCrossCompileLLVM.rst: prefer --target= over legacy -target 2022-01-25 12:39:32 -08:00
Hsiangkai Wang 901dd53cbf [docs] There are more than three bit storage containers.
To avoid listing all the bit containers in the title and do not use the
specific number for the number of bit containers.

Differential Revision: https://reviews.llvm.org/D117849
2022-01-25 10:09:18 +00:00
Hsiangkai Wang 48f763edb4 [docs] Refine the description in Set-Like and Map-Like container options.
In "Other Set-Like Container Options":
* Drops the references to C++ TR1 and SGI and hash_set.
* Drops the worry about portability (this was a problem with hash_set, but
std::unordered_set has worked portably since LLVM started depending
on C++11).

It is similar in "Other Map-Like Container Options" section.

Differential Revision: https://reviews.llvm.org/D117858
2022-01-25 10:09:18 +00:00
Changpeng Fang 4cfea311cb [AMDGPU][NFC] Update to AMDGPUUsage for default Code Object Version
Summary:
  Update the documentation for default code object version (from v3 to v4).

Reviewers:
  kzhuravl

Differential Revision:
  https://reviews.llvm.org/D117845
2022-01-24 14:33:12 -08:00
David Spickett 473aa8e10c [llvm][docs] Fix code-block in the testing guide
Without a langauge name it's an error (with some verisons of Sphinx
it seems) or the block is simply missing in the output.
2022-01-24 14:56:31 +00:00
David Spickett 3e6be0241b [lldb] Update release notes with non-address bit handling changes
This adds the "memory find" (https://reviews.llvm.org/D117299)
and "memory tag" (https://reviews.llvm.org/D117672) commands
and puts them all in one list.
2022-01-24 11:19:49 +00:00
Sanjay Patel 2e26633af0 [IR] document and update ctlz/cttz intrinsics to optionally return poison rather than undef
The behavior in Analysis (knownbits) implements poison semantics already,
and we expect the transforms (for example, in instcombine) derived from
those semantics, so this patch changes the LangRef and remaining code to
be consistent. This is one more step in removing "undef" from LLVM.

Without this, I think https://github.com/llvm/llvm-project/issues/53330
has a legitimate complaint because that report wants to allow subsequent
code to mask off bits, and that is allowed with undef values. The clang
builtins are not actually documented anywhere AFAICT, but we might want
to add that to remove more uncertainty.

Differential Revision: https://reviews.llvm.org/D117912
2022-01-23 11:22:48 -05:00
Kristof Beyls 4d82ae67b2 Add security group 2021 transparency report.
Differential Revision:  https://reviews.llvm.org/D117872
2022-01-21 15:43:17 +01:00
Simon Pilgrim 0ca426d6ac [llvm-mca] Improve barriers for strict region marking (PR52198)
As suggested on the bug, to help (but not completely....) stop folded instructions crossing the inline asm barriers used for llvm-mca analysis, we should recommend tagging with memory captures/attributes.

Differential Revision: https://reviews.llvm.org/D117788
2022-01-21 11:25:05 +00:00
Sameer Rahmani 329feeb938 [ORC][docs] Describe removing JITDylibs, using custom program representations.
Add documentation around:
* Removing JITDylib from the session
* Add support for custom program representation

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D116476
2022-01-21 22:05:17 +11:00
Hsiangkai Wang d93ffa1b37 [docs] Fix typo in the example code in ProgrammersManual.
Differential Revision: https://reviews.llvm.org/D117665
2022-01-20 01:25:49 +00:00
Hsiangkai Wang 70cef70b13 [docs] Put define DEBUG_TYPE after include directives.
Differential Revision: https://reviews.llvm.org/D117666
2022-01-20 01:18:35 +00:00
Luís Marques 771613295d [docs][lli] Fix lli rst docs formatting
Differential Revision: https://reviews.llvm.org/D109092
2022-01-19 21:54:15 +00:00
Fraser Cormack b8cb79404b [LangRef] Mangle all vector operands in insert/extract intrinsics
This better matches the canonical mangling of these intrinsics.

Reviewed By: peterwaller-arm

Differential Revision: https://reviews.llvm.org/D117675
2022-01-19 15:23:15 +00:00
Chuanqi Xu c8ecf12bc3 [Coroutines] Offering llvm.coro.align intrinsic
It is a known problem that we can't align the switch-based coroutine
frame if the alignment exceeds std::max_align_t (which is 16 usually).

We could solve the problem on the middle-end by dynamically transforming
or in the frontend by emitting aligned allocation function.

If we need to solve it in the frontend, the middle end need to offer an
intrinsic to tell the alignment at least. This patch tries to offer such
an intrinsic called llvm.coro.align.

Reviewed By: https://reviews.llvm.org/D117542

Differential revision: https://reviews.llvm.org/D117542
2022-01-19 09:52:45 +08:00
minglotus-6 76b74236c7 Update bitcode format doc to mention that a multi-module bitcode file is
valid.

Differential Revision: https://reviews.llvm.org/D117067
2022-01-18 17:49:34 -08:00
Philip Reames 17beee44e1 [LangRef] Clarify that inaccessiblememonly functions are allowed noalias returns
Confusion over this point came up in a couple of recent changes (D117180, e20b32ff3). Current tone of discussion seems to be that we think inaccessiblememonly was always legal on allocation functions, so this change takes the form of a clarification instead of a change.

Differential Revision: https://reviews.llvm.org/D117571
2022-01-18 14:47:46 -08:00
Fraser Cormack c8e33978fb [VP] Propagate align parameter attr on VP gather/scatter to ISel
This patch fixes a case where the 'align' parameter attribute on the
pointer operands to llvm.vp.gather and llvm.vp.scatter was being dropped
during the conversion to the SelectionDAG. The default alignment equal
to the ABI type alignment of the vector type was kept. It also updates
the documentation to reflect the fact that the parameter attribute is
now properly supported.

The default alignment of these intrinsics was previously documented as
being equal to the ABI alignment of the *scalar* type, when in fact that
wasn't the case: the ABI alignment of the vector type was used instead.
This has also been fixed in this patch.

Reviewed By: simoll, craig.topper

Differential Revision: https://reviews.llvm.org/D114423
2022-01-18 17:33:24 +00:00
Tony Tye 8ba5043dbf [AMDGPU][NFC] Add DWARF extension support for SIMD execution
- Add current iteration to the context of a DWARF expression evaluation.
- Add DW_AT_LLVM_iterations attribute to specify the number of
  iterations executing concurrently.
- Add DF_OP_LLVM_push_iteration to support optimizations that result in
  multiple iterations executing concurrently.
- Add DW_OP_LLVM_overlay and DW_OP_LLVM_bit_overlay to support
  expressing the location of arrays that are promoted to vector
  registers in SIMD vectorized loops.
- Generally clarify the difference between SIMT and SIMD execution.
- Change the DW_AT_LLVM_active_lane attribute to take location
  description expression so that a loclist can be used to express
  different vales at different program locations.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D117572
2022-01-18 17:36:39 +00:00
Dmitry Preobrazhensky c7ca4c6365 [AMDGPU][GFX10][MC] Updated symbolic names of internal HW registers
GFX10 no longer support HW_ID. It has been replaced with HW_ID1 and HW_ID2.
See bug 52904: https://github.com/llvm/llvm-project/issues/52904

Differential Revision: https://reviews.llvm.org/D117313
2022-01-17 20:29:10 +03:00
Nikita Popov a2261e399a [Docs] Use anonymous reference (NFC)
Hopefully fixes the build failure. Also fix a typo.
2022-01-14 18:01:06 +01:00
Nikita Popov 3bbf7f5ed8 [Docs] Update opaque pointer docs (NFC)
Mention -opaque-pointers, write a bit more about migration pitfalls
and update the open issues.
2022-01-14 17:42:43 +01:00
Hans Wennborg 2bc57d85eb Don't override __attribute__((no_stack_protector)) by inlining (PR52886)
Since 26c6a3e736, LLVM's inliner will "upgrade" the caller's stack protector
attribute based on the callee. This lead to surprising results with Clang's
no_stack_protector attribute added in 4fbf84c173 (D46300). Consider the
following code compiled with clang -fstack-protector-strong -Os
(https://godbolt.org/z/7s3rW7a1q).

  extern void h(int* p);

  inline __attribute__((always_inline)) int g() {
    return 0;
  }

  int __attribute__((__no_stack_protector__)) f() {
    int a[1];
    h(a);
    return g();
  }

LLVM will inline g() into f(), and f() would get a stack protector, against the
users explicit wishes, potentially breaking the program e.g. if h() changes the
value of the stack cookie. That's a miscompile.

More recently, bc044a88ee (D91816) addressed this problem by preventing
inlining when the stack protector is disabled in the caller and enabled in the
callee or vice versa. However, the problem remained if the callee is marked
always_inline as in the example above. This affected users, see e.g.
http://crbug.com/1274129 and http://llvm.org/pr52886.

One way to fix this would be to prevent inlining also in the always_inline
case. Despite the name, always_inline does not guarantee inlining, so this
would be legal but potentially surprising to users.

However, I think the better fix is to not enable the stack protector in a
caller based on the callee. The motivation for the old behaviour is unclear, it
seems counter-intuitive, and causes real problems as we've seen.

This commit implements that fix, which means in the example above, g() gets
inlined into f() (also without always_inline), and f() is emitted without stack
protector. I think that matches most developers' expectations, and that's also
what GCC does.

Another effect of this change is that a no_stack_protector function can now be
inlined into a stack protected function, e.g. (https://godbolt.org/z/hafP6W856):

  extern void h(int* p);

  inline int __attribute__((__no_stack_protector__)) __attribute__((always_inline)) g() {
    return 0;
  }

  int f() {
    int a[1];
    h(a);
    return g();
  }

I think that's fine. Such code would be unusual since no_stack_protector is
normally applied to a program entry point which sets up the stack canary. And
even if such code exists, inlining doesn't change the semantics: there is still
no stack cookie setup/check around entry/exit of the g() code region, but there
may be in the surrounding context, as there was before inlining. This also
matches GCC.

See also the discussion at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94722

Differential revision: https://reviews.llvm.org/D116589
2022-01-13 12:04:49 +01:00
Sebastian Neubauer f4139440f1 [Docs] Fix IR and TableGen grammar inconsistencies
IR:
- globals (and functions, ifuncs, aliases) can have a partition
- catchret has a `to` before the label
- the sint/int types do not exist
- signext comes after the type
- a variable was missing its type

TableGen:
- The second value after a `#` concatenation is optional
  See e.g. llvm/lib/Target/X86/X86InstrAVX512.td:L3351
- IncludeDirective and PreprocessorDirective were never referenced in
  the grammar
- Add some missing ;
- Parent classes of multiclasses can have generic arguments.
  Reuse the `ParentClassList` that is already used in other places.

MIR:
- liveins only allows physical registers, which start with a $

Differential Revision: https://reviews.llvm.org/D116674
2022-01-13 11:55:13 +01:00
Pietro Albini c8c3021e9f Update Pietro Albini's employer
Differential Revision: https://reviews.llvm.org/D117027
2022-01-12 14:46:06 +01:00
Simon Moll 33efbc8184 [VP] llvm.vp.merge intrinsic and LangRef
llvm.vp.merge interprets the %evl operand differently than the other vp
intrinsics: all lanes at positions greater or equal than the %evl
operand are passed through from the second vector input. Otherwise it
behaves like llvm.vp.select.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116725
2022-01-12 14:06:56 +01:00
Patrick Holland 85e6e748d4 [MCA] Switching from conservatively guessing which instructions are
memory-barrier instructions to providing targets and developers a convenient
way to explicitly declare which instructions are memory-barriers.

Differential Revision: https://reviews.llvm.org/D116779
2022-01-11 13:50:14 -08:00
Dimitry Andric 593b4d7a1c [Nomination] Adding Intel representatives to security group
We would like to nominate Andy Kaylor and Sergey Maslov to join the LLVM security group as a representative of Intel.  Both are members of the Intel compiler team, and would like to register as vendor contacts.  Intel packages and distributes LLVM-based toolchains as part of our compiler products.   As such, we would like to be aware of any security vulnerability found in the compiler, and would like to contribute to the resolution of such issues.

Please let us know if anything is missing from the nomination.

Reviewed By: apilipenko, dim, george.burgess.iv, kristof.beyls, mattdr, nikhgupt, probinson, peter.smith, pietroalbini, steveklabnik

Differential Revision: https://reviews.llvm.org/D115657
2022-01-11 17:30:44 +01:00
David Spickett 88fdce5be6 [lldb] Remove non address bits from memory read arguments
Addresses on AArch64 can have top byte tags, memory tags and pointer
authentication signatures in the upper bits.

While testing memory tagging I found that memory read couldn't
read a range if the two addresses had different tags. The same
could apply to signed pointers given the right circumstance.

(lldb) memory read mte_buf_alt_tag mte_buf+16
error: end address (0x900fffff7ff8010) must be greater than the start
address (0xa00fffff7ff8000).

Or it would try to read a lot more memory than expected.

(lldb) memory read mte_buf mte_buf_alt_tag+16
error: Normally, 'memory read' will not read over 1024 bytes of data.
error: Please use --force to override this restriction just once.
error: or set target.max-memory-read-size if you will often need a
larger limit.

Fix this by removing non address bits before we calculate the read
range. A test is added for AArch64 Linux that confirms this by using
the top byte ignore feature.

This means that if you do read with a tagged pointer the output
does not include those tags. This is potentially confusing but I think
overall it's better that we don't pretend that we're reading memory
from a range that the process is unable to map.

(lldb) p ptr1
(char *) $4 = 0x3400fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) p ptr2
(char *) $5 = 0x5600fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) memory read ptr1 ptr2+16
0xfffffffff140: 80 f1 ff ff ff ff 00 00 38 70 bc f7 ff ff 00 00  ........8p......

Reviewed By: omjavaid, danielkiss

Differential Revision: https://reviews.llvm.org/D103626
2022-01-11 13:24:09 +00:00
David Sherwood 51497dc0b2 [IR] Change vector.splice intrinsic to reject out-of-bounds indices
I've changed the definition of the experimental.vector.splice
instrinsic to reject indices that are known to be or possibly
out-of-bounds. In practice, this means changing the definition so that
the index is now only valid in the range [-VL, VL-1] where VL is the
known minimum vector length. We use the vscale_range attribute to
take the minimum vscale value into account so that we can permit
more indices when the attribute is present.

The splice intrinsic is currently only ever generated by the vectoriser,
which will never attempt to splice vectors with out-of-bounds values.
Changing the definition also makes things simpler for codegen since we
can always assume that the index is valid.

This patch was created in response to review comments on D115863

Differential Revision: https://reviews.llvm.org/D115933
2022-01-11 09:37:39 +00:00
Keith Smiley bfeb92cb9c docs: update some bug tracker references (NFC)
Fixes https://github.com/llvm/llvm-project/issues/53091

Differential Revision: https://reviews.llvm.org/D116898
2022-01-10 15:59:08 -08:00
Martin Storsjö 392aa97acc [llvm-objcopy] Implement the PE-COFF specific --subsystem option
This implements the parsing of the highly PE-COFF specific option
in ConfigManager.cpp, setting Optional<> values in COFFConfig, which
then are used in COFFObjcopy.

This should fix https://github.com/mstorsjo/llvm-mingw/issues/239.

Differential Revision: https://reviews.llvm.org/D116556
2022-01-10 14:44:15 +02:00
Tanya Lattner 645c845d45 Add first draft of the discourse migration guide. 2022-01-07 20:24:35 -08:00
John Ericson feeff8a37c [llvm] Use `GNUInstallDirs` to support custom installation dirs
This is the patch for LLVM proper in my series for adding GNUInstallDirs support in all project.

Additionally:

Create a new `CACHE STRING` variable, `LLVM_EXAMPLES_INSTALL_DIR`, to control where the examples are installed on analogy with the other variables.

---

This patch supersedes D28234, which tried to do the same thing but hand-rolled without GNUInstallDirs.

This patch nearly reverts commit 3 0fc88bf1dc15a72e2d9809d28019d386b7a7cc0, which was a revert of a prior attempt."

(I had to add a space here or else Phabricator detects a reference cycle and won't let me do the form submit.)

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2022-01-08 00:47:31 +00:00
Chuanqi Xu bbce75e352 Update Bug report URL to Github Issues
Although we moved to Github Issues. The bug report message refers to
Bugzilla still. This patch tries to update these URLs.

Reviewed By: MaskRay, Quuxplusone, jhenderson, libunwind, libc++

Differential Revision: https://reviews.llvm.org/D116351
2022-01-06 17:33:25 +08:00
Luís Ferreira 34435fd105 [llvm] Add support for DW_TAG_immutable_type
Added documentation about DW_TAG_immutable_type too.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D113633
2022-01-05 19:17:08 +00:00
Chuanqi Xu c75cedc237 [Coroutines] Set presplit attribute in Clang and mlir
This fixes bug49264.

Simply, coroutine shouldn't be inlined before CoroSplit. And the marker
for pre-splited coroutine is created in CoroEarly pass, which ran after
AlwaysInliner Pass in O0 pipeline. So that the AlwaysInliner couldn't
detect it shouldn't inline a coroutine. So here is the error.

This patch set the presplit attribute in clang and mlir. So the inliner
would always detect the attribute before splitting.

Reviewed By: rjmccall, ezhulenev

Differential Revision: https://reviews.llvm.org/D115790
2022-01-05 10:25:02 +08:00
Nikita Popov 8484bab9cd [LangRef] Require elementtype attribute for indirect inline asm operands
Indirect inline asm operands may require the materialization of a
memory access according to the pointer element type. As this will
no longer be available with opaque pointers, we require it to be
explicitly annotated using the elementtype attribute, for example:

    define void @test(i32* %p, i32 %x) {
      call void asm "addl $1, $0", "=*rm,r"(i32* elementtype(i32) %p, i32 %x)
      ret void
    }

This patch only includes the LangRef change and Verifier updates to
allow adding the elementtype attribute in this position. It does not
yet enforce this, as this will require changes on the clang side
(and test updates) first.

Something I'm a bit unsure about is whether we really need the
elementtype for all indirect constraints, rather than only indirect
register constraints. I think indirect memory constraints might not
strictly need it (though the backend code is written in a way that
does require it). I think it's okay to just make this a general
requirement though, as this means we don't need to carefully deal
with multiple or alternative constraints. In addition, I believe
that MemorySanitizer benefits from having the element type even in
cases where it may not be strictly necessary for normal lowering
(cd2b050fa4/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp (L4066)).

Differential Revision: https://reviews.llvm.org/D116531
2022-01-04 10:02:06 +01:00
Fraser Cormack d762794040 [IR] Allow the 'align' param attr on vectors of pointers
This patch extends the available uses of the 'align' parameter attribute
to include vectors of pointers. The attribute specifies pointer
alignment element-wise.

This change was previously requested and discussed in D87304.

The vector predication (VP) intrinsics intend to use this for scatter
and gather operations, as they lack the explicit alignment parameter
that the masked versions use.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D115161
2022-01-03 12:32:46 +00:00
Nuno Lopes b23669123a [docs] Mark @llvm.sideeffect() as willreturn
Changed by https://reviews.llvm.org/D65455
2022-01-01 18:04:04 +00:00
Fangrui Song 25ff448aac [docs][llvm-profdata] Prefer double-dash long options
To match the `--help` message and most other utilities.

While here, change `option:: -output=output` to `option:: --output=<output>` and
omit the value name for the short options (convention of other utilities).

Reviewed By: snehasish

Differential Revision: https://reviews.llvm.org/D116353
2021-12-30 10:37:17 -08:00
Fangrui Song dd2fbbbb2d [llvm-profdata][docs] Use `` instead of ` 2021-12-28 18:03:28 -08:00
Kyungwoo Lee 4ecf15b789 [llvm-profdata] Make -debug-info visible
Add the option comment in .rst.

Reviewed By: ellis

Differential Revision: https://reviews.llvm.org/D116348
2021-12-28 17:35:08 -08:00
Renato Golin c5e8eb9783 Documentation for the process of adding new targets
Plenty of new targets nowadays and I found myself repeating the same
thing over and over, so this is more or less what we said over the last
few years, but condensed in an ordered fashion and easy to digest.

This does not change any of the recommendations, only documents what we
have been saying for years.
2021-12-28 21:00:26 +00:00
Tony Tye 0ac939f3e2 [AMDGPU][NFC] Update to DWARF extension for heterogeneous debugging
- Update documentation on the DWARF extension for heterogeneous
  debugging to better reference the DWARF Version 5 standard.
- Numerous other corrections.

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D116275
2021-12-28 17:13:45 +00:00
Tony Tye 4360207a21 [AMDGPU][NFC] Update DWARF extension allowing locations on stack
Add changes to the DWARF Version 5 standard to the DWARF extension to
allow locations on the evaluation stack documentation.

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D116265
2021-12-28 17:12:20 +00:00
Simon Moll 3d36da7702 [VE] Add manuals to CompilerWriterInfo
Reference VE manual and documentations in CompilerWriterInfo.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D116212
2021-12-23 14:14:37 +01:00
Philip Reames 157d565502 [docs] Update new builder instructions to starting on the staging buildmaster
This adds a step in the instructions to switch to the production buildmaster at the very end (after explicit approval), and updates the early instruction to start with the builder pointed at the staging buildmaster.

Differential Revision: https://reviews.llvm.org/D116129
2021-12-22 18:21:17 -08:00
Tony Tye 0a3258febf [AMDGPU][NFC] Update DWARF extension for locations on the stack
- Improve extension description.
- Rename "What is DWARF?" section to better reflect what it is
  describing.

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D116077
2021-12-21 05:58:11 +00:00
Esme-Yi b66328701a [PowerPC][llvm-objdump] enable --symbolize-operands for PowerPC ELF/XCOFF.
Summary: When disassembling, symbolize a branch target operand
to print a label instead of a real address.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D114492
2021-12-21 04:17:57 +00:00
Tom Stellard f819db11de docs: Clarify licensing rules for the project
Reviewed By: lattner, kristof.beyls

Differential Revision: https://reviews.llvm.org/D113427
2021-12-20 17:03:31 -08:00
Jinsong Ji 557a17eec0 [docs]LLVM Tutorial: fix the typo in Cpu0 URL
jonathan2251.github.com/lbd/ is 404. Update the URL to .io one according
to https://github.com/Jonathan2251/lbd/blob/master/README.md.
2021-12-20 21:45:57 +00:00
Sami Tolvanen 5dc8aaac39 [llvm][IR] Add no_cfi constant
With Control-Flow Integrity (CFI), the LowerTypeTests pass replaces
function references with CFI jump table references, which is a problem
for low-level code that needs the address of the actual function body.

For example, in the Linux kernel, the code that sets up interrupt
handlers needs to take the address of the interrupt handler function
instead of the CFI jump table, as the jump table may not even be mapped
into memory when an interrupt is triggered.

This change adds the no_cfi constant type, which wraps function
references in a value that LowerTypeTestsModule::replaceCfiUses does not
replace.

Link: https://github.com/ClangBuiltLinux/linux/issues/1353

Reviewed By: nickdesaulniers, pcc

Differential Revision: https://reviews.llvm.org/D108478
2021-12-20 12:55:32 -08:00
Noah Shutty c9509b03a1 [llvm] Fix small typos in Programmer's Manual and Chrono.h.
The Programmer's Manual guidance on the StringRef class (https://llvm.org/docs/ProgrammersManual.html#the-stringref-class) refers to `iterator StringRef::find(StringRef Key)` which does not exist. Based on context this is surely a small typo meant to be `iterator StringMap::find(StringRef Key)`.

This also corrects some small typos in the comments of llvm/include/llvm/Support/Chrono.h

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D113462
2021-12-16 19:20:25 +00:00
David Spickett 2dbe5898d7 [llvm][docs] Describe how to work with patch series on Phabricator
Reviewed By: awarzynski, jhenderson

Differential Revision: https://reviews.llvm.org/D115519
2021-12-16 15:32:26 +00:00
Fraser Cormack 8002fa6760 [LangRef] Remove incorrect vector alignment rules
The LangRef incorrectly says that if no exact match is found when
seeking alignment for a vector type, the largest vector type smaller
than the sought-after vector type. This is incorrect as vector types
require an exact match, else they fall back to reporting the natural
alignment.

The corrected rule was not added in its place, as rules for other types
(e.g., floating-point types) aren't documented.

A unit test was added to demonstrate this.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D112463
2021-12-14 14:35:40 +00:00
Tony Tye c6be2ad73a [AMDGPU][NFC] Add documentation for location description DWARF extension
Add documentation for the DWARF extension to allow location descriptions
on the DWARF expression stack. This is part of the "DWARF Extensions For
Heterogeneous Debugging" used by the AMD GPU target.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D115587
2021-12-14 00:58:17 +00:00
Alina Sbirlea ac994f831c [MemorySSA] Document details regarding MemorySSA's precision. 2021-12-13 16:49:24 -08:00
Fraser Cormack 2d60bc87a2 [VP] [NFC] Fix vp_store signature and vp_gather examples
Reviewed By: frasercrmck, simoll

Differential Revision: https://reviews.llvm.org/D115027
2021-12-13 17:53:19 +00:00
Med Ismail Bennani 30fc88bf1d Revert "Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"""
This reverts commit 492de35df4.

I tried to apply John's changes in 8d897ec915 that were expected to
fix his patch but that didn't work unfortunately.

Reverting this again to fix the macOS bots and leave him more time to
investigate the issue.
2021-12-10 17:33:54 -08:00
Jayson Yan 1f35d7b5de [llvm-readobj] Add JSONScopedPrinter to llvm-readelf
Adds JSONScopedPrinter to llvm-readelf. It includes an empty
JSONELFDumper class which will be used to override any LLVMELFDumper
methods which utilize startLine() which JSONScopedPrinter cannot
provide.

This introduces a change where calls to llvm-readelf with non-ELF object
files that specify --elf-output-style=GNU will now print file summary
information where it previously didn't.

Fixes previous Windows test failure which occured due to JSON escaping
of '\' by not relying on LIT substitution.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D114225
2021-12-10 23:34:27 +00:00
Jon Roelofs d08303e404 [Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC
Differential Revision: https://reviews.llvm.org/D111158
2021-12-10 14:21:28 -08:00
Jayson Yan 2526335595 Revert "[llvm-readobj] Add JSONScopedPrinter to llvm-readelf"
This reverts commit 824eef231a.
file-summary-json.test and pretty-print.test fails on Windows.
2021-12-10 21:01:27 +00:00
John Ericson 492de35df4 Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM""
This reverts commit 797b50d4be.

See the original D99484. @mib who noticed the original problem could not longer
reproduce it, after I tried and also failed. We are threfore hoping it went
away on its own!

Reviewed By: mib

Differential Revision: https://reviews.llvm.org/D115544
2021-12-10 20:59:43 +00:00
Jayson Yan 824eef231a [llvm-readobj] Add JSONScopedPrinter to llvm-readelf
Adds JSONScopedPrinter to llvm-readelf. It includes an empty
 JSONELFDumper class which will be used to override any LLVMELFDumper
 methods which utilize startLine() which JSONScopedPrinter cannot
 provide.

 Reviewed By: jhenderson

 Differential Revision: https://reviews.llvm.org/D114225
2021-12-10 18:57:34 +00:00
Ties Stuij fbf489cd1b Add PACBTI-M support to LLVM release notes.
Clang release note changes will be added once the last PACBTI-M command line
patch lands.

Reviewed By: vhscampos

Differential Revision: https://reviews.llvm.org/D115507
2021-12-10 11:53:42 +00:00
Sameer Sahasrabuddhe 1d0244aed7 Reapply CycleInfo: Introduce cycles as a generalization of loops
Reverts 02940d6d22. Fixes breakage in the modules build.

LLVM loops cannot represent irreducible structures in the CFG. This
change introduce the concept of cycles as a generalization of loops,
along with a CycleInfo analysis that discovers a nested
hierarchy of such cycles. This is based on Havlak (1997), Nesting of
Reducible and Irreducible Loops.

The cycle analysis is implemented as a generic template and then
instatiated for LLVM IR and Machine IR. The template relies on a new
GenericSSAContext template which must be specialized when used for
each IR.

This review is a restart of an older review request:
https://reviews.llvm.org/D83094

Original implementation by Nicolai Hähnle <nicolai.haehnle@amd.com>,
with recent refactoring by Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>

Differential Revision: https://reviews.llvm.org/D112696
2021-12-10 14:36:43 +05:30
Chuanqi Xu b9321d481a [NFC] Format the newly added table for coro.end in coroutines.rst
The intention should be formatted in two lines instead of one.
2021-12-10 15:24:26 +08:00
Ellis Hoag 2204a7bc99 [dsymutil][NFC] Fix typo in help message
Just a simple typo fix that allows me to test landing a commit now that
I have commit access.

Reviewed By: xgupta

Differential Revision: https://reviews.llvm.org/D115414
2021-12-09 10:55:13 -08:00
Chuanqi Xu 320e4efe99 [C++20] [Coroutines] Mark coroutine done if unhandled_exception throws
According to [dcl.fct.def.coroutine]/p14:
> If the evaluation of the expression promise.unhandled_­exception()
> exits via an exception, the coroutine is considered suspended at the
> final suspend point.

But this is not implemented in clang before. This patch would implement
this feature by marking the coroutine as done at the place of
coro.end(frame, /*InUnwindPath=*/true ).

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D115219
2021-12-09 14:58:06 +08:00
Kito Cheng 39c861719b [RISCV] Fix vm operand constraint to fit GCC's behavior
- `vm` constraint is used for masking operand, which always v0.

- Update testcase, only masking operand should use `vm`, vector mask operations
  should just use `vr` for any vector register.

 - Revise the description of `vm` constraint.

- This patch also fix issue on RISCVRegisterInfo.td and RISCVISelLowering.cpp.

  RISCVRegisterInfo.td:
  - The first VT in the list must be the largest total size since the
    SelectionDAGBuilder uses the first register in the list as the canonical
    type for the register.

  RISCVISelLowering.cpp:
  - Fix RISCVTargetLowering::splitValueIntoRegisterParts and
    RISCVTargetLowering::joinRegisterPartsIntoValue for handling vectors
    with different total size, that will happened on fractional LMUL since
    fractional LMUL is always occupy one vector register.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D112599
2021-12-09 14:46:49 +08:00
Chuanqi Xu 352e36e10d [Coroutines] Remove unused coroutine builtin/intrinsics llvm.coro.param (NFC-ish)
I found that the coroutine intrinsic llvm.coro.param in documentation
(https://llvm.org/docs/Coroutines.html#id101) didn't get used actually
since there isn't lowering codes in LLVM. I also checked the
implementation of libstdc++ and libc++. Both of them didn't use
llvm.coro.param. So I am pretty sure that the llvm.coro.param intrinsic
is unused. I think it would be better t to remove it to avoid possible
misleading understandings.

Note: according to [class.copy.elision]/p1.3, this optimization is
allowed by the C++ language specification. Let's make it someday.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D115222
2021-12-09 14:40:25 +08:00
Jonas Devlieghere 02940d6d22 Revert "CycleInfo: Introduce cycles as a generalization of loops"
This reverts commit 0fe61ecc2c because it
breaks the modules build.

https://green.lab.llvm.org/green/job/clang-stage2-rthinlto/4858/
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/39112/
2021-12-07 13:06:34 -08:00
gbreynoo 9094a2285b [llvm-symbolizer][docs] Update --output-style=JSON example
The fields output when using --output-style=JSON has changed but the
guide wasn't updated. This change fixes up the example.

Differential Revision: https://reviews.llvm.org/D115164
2021-12-07 14:21:18 +00:00
Carlos Galvez d40130199f [doc] Fix namespace comment style in Coding Guidelines
The Coding Guidelines specify that the ending brace of a
namespace shall have a comment like:

}  // end namespace clang

However the majority of the code uses a different style:

}  // namespace clang

Indeed:

$ git grep '// end' | wc -l
6724
$ git grep '// namespace' | wc -l
14348

Besides, this is the style enforced automatically by clang-format,
via the FixNamespaceComments option.

Having inconsistencies between the Coding Guidelines and the
code/tooling creates confusion, can lead to bikeshedding during
reviews and overall delays merging code. Therefore, update the
guidelines to reflect current usage. Updating legacy code to the
new standard should be done in a separate patch, if wanted.

Reviewed By: jyknight

Differential Revision: https://reviews.llvm.org/D115115
2021-12-07 13:36:25 +00:00
Fraser Cormack 3460cc2585 [VP] Propagate align parameter attr on VP load/store to ISel
This patch fixes a case where the 'align' parameter attribute on the
pointer operands to llvm.vp.load and llvm.vp.store was being dropped
during the conversion to the SelectionDAG. The default alignment
equal to the ABI type alignment of the vector type was kept. It also
updates the documentation to reflect the fact that the parameter
attribute is now properly supported.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D114422
2021-12-07 10:16:16 +00:00
Cullen Rhodes 698584f89b [IR] Remove unbounded as possible value for vscale_range minimum
The default for min is changed to 1. The behaviour of -mvscale-{min,max}
in Clang is also changed such that 16 is the max vscale when targeting
SVE and no max is specified.

Reviewed By: sdesmalen, paulwalker-arm

Differential Revision: https://reviews.llvm.org/D113294
2021-12-07 09:52:21 +00:00
Sameer Sahasrabuddhe 0fe61ecc2c CycleInfo: Introduce cycles as a generalization of loops
LLVM loops cannot represent irreducible structures in the CFG. This
change introduce the concept of cycles as a generalization of loops,
along with a CycleInfo analysis that discovers a nested
hierarchy of such cycles. This is based on Havlak (1997), Nesting of
Reducible and Irreducible Loops.

The cycle analysis is implemented as a generic template and then
instatiated for LLVM IR and Machine IR. The template relies on a new
GenericSSAContext template which must be specialized when used for
each IR.

This review is a restart of an older review request:
https://reviews.llvm.org/D83094

Original implementation by Nicolai Hähnle <nicolai.haehnle@amd.com>,
with recent refactoring by Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>

Differential Revision: https://reviews.llvm.org/D112696
2021-12-07 12:02:34 +05:30
Shivam Gupta b1eb6a3589 [Docs] Fix a link
current link is pointing to https://llvm.org/docs/CodeGenerator.html#segmented-stacks while it point to https://llvm.org/docs/CodeGenerator.html#tail-call-optimization or id81.

Differential Revision: https://reviews.llvm.org/D115119
2021-12-06 10:02:06 +05:30
Dylan McKay ec15b7307f Add 'LLVM_DEFAULT_TARGET_TRIPLE' to the documented list of CMake variables
I always forget this variable, and the distinction between
'LLVM_TARGET_ARCH', and this variable is only documented on the 'cross
compiling' page, which I never spot and always end up searching through
the codebase for.

This patch adds the variable to the Sphinx CMake documentation so that
it is easily findable in the official LLVM docs.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D96014
2021-12-01 21:38:59 +13:00
Jay Foad 5d602120c3 [AMDGPU] Update docs for nontemporal store
Update the documented GFX10 code sequence for nontemporal stores after
D114351.

Differential Revision: https://reviews.llvm.org/D114707
2021-11-30 09:43:42 +00:00
Jay Foad 65d9dc7f1f [AMDGPU] Fix list indentation in docs 2021-11-29 15:06:01 +00:00
Jay Foad 7319d11586 [AMDGPU] Fix "must generated" typo in docs 2021-11-29 15:01:18 +00:00
Zarko Todorovski 715d2dc126 [llvm-cov][NFC] Add missing character to fix docs buildbot break. 2021-11-26 11:57:10 -05:00
Zarko Todorovski e714394ab8 [LLVM][llvm-cov] Inclusive language: rename option -name-whitelist to -name-allowlist
Renamed the option for llvm-cov and changed variable names to use more
inclusive terms. Also changed the binary for the test.

Reviewed By: alanphipps

Differential Revision: https://reviews.llvm.org/D112816
2021-11-26 11:08:01 -05:00
Quinn Pham a712b661eb [NFC][llvm] Inclusive language: replace master in llvm docs
[NFC] As part of using inclusive language within the llvm project, this patch
removes instances of master in these files.

Reviewed By: ZarkoCA

Differential Revision: https://reviews.llvm.org/D114187
2021-11-25 13:36:51 -06:00
Philip Reames 1a76a3a7e4 [docs] Incorprate first round of feedback on D114325
This builds on the text landed in 73d52ee78, and incorporates the points that Renato brought up.

Differential Revision: https://reviews.llvm.org/D114325
2021-11-22 11:02:38 -08:00
Philip Reames 73d52ee785 Add a best practice section on how to configure a fast builder
This is based on conversations with a couple of folks currently running buildbots. There's a couple pieces which didn't make it in, but this tries to cover the common themes.

Differential Revision: https://reviews.llvm.org/D114325
2021-11-21 08:01:29 -08:00
Matt Morehouse 671f0930fe [X86] Selective relocation relaxation for +tagged-globals
For tagged-globals, we only need to disable relaxation for globals that
we actually tag.  With this patch function pointer relocations, which
we do not instrument, can be relaxed.

This patch also makes tagged-globals work properly with LTO, as
-Wa,-mrelax-relocations=no doesn't work with LTO.

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D113220
2021-11-19 07:18:27 -08:00
Fraser Cormack 92d279fd6d [LangRef][VP] Correct operands' types in vp.select documentation
The types of llvm.vp.select's operands much match the return type.
2021-11-19 12:08:34 +00:00
Bardia Mahjour f27ff7ff0e [docs] Add Loop Optimization WG to the online sync-up page 2021-11-18 16:49:11 -05:00
Florian Hahn 1235ca37bd
[docs] Update outdated mentions of lab.llvm.org:8011.
Some places were still referring to the outdated buildbot URL
http://lab.llvm.org:8011. Update those to use the new URL
http://lab.llvm.org/buildbot/#.
2021-11-18 10:51:47 +00:00
Florian Hahn 09f39862dc
[docs] Remove mention of retired smooshlab IRC bot.
the smooshlab bot has been offline for years. Remove it from the list of
IRC bots.
2021-11-18 10:45:16 +00:00
Carl Ritson 6d28dffb6b [AMDGPU] Update GFX10 memory model to account for MALL
Document memory attached last level (MALL) cache added in GFX10.3.

Reviewed By: t-tye

Differential Revision: https://reviews.llvm.org/D114076
2021-11-18 09:29:30 +09:00
Shao-Ce SUN 0c660256eb [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
Ahmed Bougacha 68854f4e57 [IR] Define ptrauth intrinsics.
This defines the new `@llvm.ptrauth.` pointer authentication intrinsics:
sign, auth, strip, blend, and sign_generic, documented in PointerAuth.md.

Pointer Authentication is a mechanism by which certain pointers are
signed.  When a pointer gets signed, a cryptographic hash of its value
and other values (pepper and salt) is stored in unused bits of that
pointer.

Before the pointer is used, it needs to be authenticated, i.e., have its
signature checked.  This prevents pointer values of unknown origin from
being used to replace the signed pointer value.

sign and auth provide the core operations.  strip removes the ptrauth
bits from a signed pointer without checking them.  sign_generic allows
signing non-pointer values.  Finally, blend combines salt values
("discriminators") to derive more targeted and less reusable ones.

In later patches, we implement primary backend support for these
intrinsics using the AArch64 PAuth feature, and build on that to
implement the arm64e Darwin ABI and ELF PAuth ABI Extension in clang.

For more details, see the docs page, as well as our llvm-dev RFC:
  http://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html
or our 2019 Developers' Meeting talk.

Differential Revision: https://reviews.llvm.org/D90868
2021-11-14 07:59:00 -08:00
Arthur Eubanks 05963a3d66 Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
This reverts commit ee76525698.

Causes crashes, see comments in D104827.
2021-11-09 14:27:55 -08:00
Scott Linder ee76525698 [DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:

* DIExpression can currently be parsed from IR or read from bitcode
  as `distinct`, but this property is silently dropped when printing
  to IR. This causes accepted IR to fail to round-trip. As DIExpression
  appears inline at each use in the canonical form of IR, it cannot
  actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
  restricted to only appearing in contexts where there is no syntax for
  `distinct`, but for consistency it is treated equivalently to
  DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
  along with adding general support for the inverse restriction I went
  ahead and described this in Metadata.def and updated the parser to be
  general. Future nodes which have this restriction can share this
  support.

The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.

The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.

A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:

    !named = !{!0}
    !0 = !DIExpression()

Instead we would only accept the equivalent inlined version:

    !named = !{!DIExpression()}

This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:

    !named = !{!0}
    ; error: 'distinct' not allowed for !DIExpression()
    !0 = distinct !DIExpression()

Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.

Reviewed By: StephenTozer, t-tye

Differential Revision: https://reviews.llvm.org/D104827
2021-11-09 18:19:11 +00:00
Carlos Galvez 7ecec3f0f5 [CUDA] Bump supported CUDA version to 11.5
Differential Revision: https://reviews.llvm.org/D113249
2021-11-09 08:20:53 +00:00
Paul Robinson 38be8f4057 Add llvm-tli-checker
A new tool that compares TargetLibraryInfo's opinion of the availability
of library function calls against the functions actually exported by a
specified set of libraries. Can be helpful in verifying the correctness
of TLI for a given target, and avoid mishaps such as had to be addressed
in D107509 and 94b4598d.

The tool currently supports ELF object files only, although it's unlikely
to be hard to add support for other formats.

Re-commits 62dd488 with changes to use pre-generated objects, as not all
bots have ld.lld available.

Differential Revision: https://reviews.llvm.org/D111358
2021-11-08 16:29:28 -08:00
Paul Robinson 1297c21406 Revert "Add llvm-tli-checker"
Not all bots have ld.lld available.
This reverts commit 62dd488164.
2021-11-08 15:48:29 -08:00
Paul Robinson 62dd488164 Add llvm-tli-checker
A new tool that compares TargetLibraryInfo's opinion of the availability
of library function calls against the functions actually exported by a
specified set of libraries. Can be helpful in verifying the correctness
of TLI for a given target, and avoid mishaps such as had to be addressed
in D107509 and 94b4598d.

The tool currently supports ELF object files only, although it's unlikely
to be hard to add support for other formats.

Differential Revision: https://reviews.llvm.org/D111358
2021-11-08 14:59:13 -08:00
Quinn Pham c3b15b71ce [NFC] Inclusive Language: change master to main for .chm files
[NFC] As part of using inclusive language within the llvm project,
this patch replaces master with main when referring to `.chm` files.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D113299
2021-11-08 08:23:04 -06:00
Quinn Pham c71fbdd87b [NFC] Inclusive language: Remove instances of master in URLs
[NFC] This patch fixes URLs containing "master". Old URLs were either broken or
redirecting to the new URL.

Reviewed By: #libc, ldionne, mehdi_amini

Differential Revision: https://reviews.llvm.org/D113186
2021-11-05 08:48:41 -05:00
Fraser Cormack 3a11fb572c [LangRef][VP] Document vp.gather and vp.scatter intrinsics
This patch fleshes out the missing documentation for the final two VP
intrinsics introduced in D99355: `llvm.vp.gather` and `llvm.vp.scatter`.
It does so mostly by deferring to the `llvm.masked.gather` and
`llvm.masked.scatter` intrinsics, respectively.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D112997
2021-11-05 11:36:03 +00:00
Fraser Cormack 93e1802af3 [LangRef][VP] Document vp.load and vp.store intrinsics
This patch fleshes out the missing documentation for two of the VP
intrinsics introduced in D99355: `llvm.vp.load` and `llvm.vp.store`. It
does so mostly by deferring to the `llvm.masked.load` and
`llvm.masked.store` intrinsics, respectively.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D112930
2021-11-05 10:39:34 +00:00
Philip Reames ab4375e999 [docs] Update new builder instructions to default to building each change
We generally prefer build bots which build each change as they come in as long as they can keep up. This generates much higher quality feedback to a developer. However, the code structure is such that we currently default new builders to batching.

This change updates the getting started instruction for a builder to explicitly advocate for not collapsing requests.

Differential Revision: https://reviews.llvm.org/D112776
2021-11-04 09:36:53 -07:00
Fangrui Song ab270e4c7c [docs] Mention --leading-lines instead of --no-leading-lines 2021-11-03 10:21:13 -07:00
Shivam Gupta 2a7c3f8b02 [Docs] Document scripts that are use to generate assertion in test cases
This patch document llvm/utils/update_*  python scripts that are used to generate
assertions in many of the LLVM regression test cases.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112936
2021-11-03 22:24:10 +05:30
Med Ismail Bennani 797b50d4be Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"
This reverts commit 6fd2db04d0 since it
broke GreenDragon LLDB-Incremental bot:

https://green.lab.llvm.org/green/job/lldb-cmake/37560/console

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-11-02 19:11:44 +01:00
Arthur Eubanks e2024d72fa Revert "[NFC] Remove LinkAll*.h"
This reverts commit fe364e5dc7.

Causes breakages, e.g. https://lab.llvm.org/buildbot/#/builders/188/builds/5266
2021-11-02 09:08:09 -07:00
Arthur Eubanks fe364e5dc7 [NFC] Remove LinkAll*.h
These were added to prevent functions from being removed by WPO.

But that doesn't make sense, correct WPO will not remove functions we actually use.

I noticed these because compiling cc1_main.cpp was pulling in random LLVM pass headers.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112971
2021-11-02 08:43:17 -07:00
Fraser Cormack 6fb41c3dea [LangRef][VP] Correct mask type in vp.slice documentation
The mask type for the llvm.experimental.vp.splice intrinsics must have
the same number of elements as the result type.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D112924
2021-11-02 14:48:23 +00:00
John Ericson 6fd2db04d0 Use `GNUInstallDirs` to support custom installation dirs. -- LLVM
This is a new draft of D28234. I previously did the unorthodox thing of
pushing to it when I wasn't the original author, but since this version

- Uses `GNUInstallDirs`, rather than mimics it, as the original author
  was hesitant to do but others requested.

- Is much broader, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I am using this patch (and many back-ports) as the basis of
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It
looked like people were generally on board in D28234, but I make note of
this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM
already has some partial support for these sorts of things. For example
`LLVM_LIBDIR_SUFFIX`, or `COMPILER_RT_INSTALL_PATH`. Because it's not
quite clear yet what to do about those, we are holding off on changing
libdirs and `compiler-rt`. for this initial PR.

---

On the advice of @lebedev.ri, I am splitting this up a bit per
subproject, starting with LLVM. To allow it to be more easily reviewed. This and the subsequent patch must be landed together, as this will not build alone. But the rest can be landed on their own.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2021-11-02 10:23:30 -04:00
Miguel Raz Guzmán Macedo 03eddbc714 [doc] Typo fix in NewPassManager.rst
Simple typo fix.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D112780
2021-10-29 13:11:11 -07:00
Quinn Pham 9668e19e0c [docs] Inclusive language: replace master with main
[NFC] As part of using inclusive language within the llvm
project and be consistent with the renamed branch,
replace master with main.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D112746
2021-10-29 10:21:27 -05:00
Louis Dionne 2912f53699 Officially deprecate LLVM_ENABLE_PROJECTS for libc++, libc++abi and libunwind
This updates the LLVM wide documentation for building LLVM and the runtimes
and adds a CMake warning when folks specify libcxx, libcxxabi or libunwind
in LLVM_ENABLE_PROJECTS, pointing them to the updated instructions for
building the runtimes.

Differential Revision: https://reviews.llvm.org/D112724
2021-10-29 08:53:03 -04:00
Philip Reames 386633a041 [doc] Update a broken link in buildbot instructions 2021-10-28 18:46:51 -07:00
Philip Reames a70a5636a8 [docs] Expand a bit on the basics of a buildbot policy
We don't have much publicly documented about how build bots are maintained, and who has what responsibility with regards to the bots themselves and failures they report.

This change adds some basic framing on the topic. It is intended to simplify document long standing practice, and to avoid introducing any new policy elements. I do want to propose a couple of changes, but those will happen with their own review and broader discussion.

Differential Revision: https://reviews.llvm.org/D112755
2021-10-28 14:51:18 -07:00
Louis Dionne abb2a91b89 [docs][NFC] Strip trailing whitespace from GettingStarted.rst 2021-10-28 10:45:13 -04:00
zhijian 158083f0de [AIX][XCOFF] parsing xcoff object file auxiliary header
Summary:

The patch supports parsing the xcoff object file auxiliary header with llvm-readobj with option "auxiliary-headers"

the format of auxiliary header as
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/filesreference/XCOFF.html#XCOFF__fyovh386shar

Reviewers: James Henderson, Jason Liu, Hubert Tong, Esme yi, Sean Fertile.

Differential Revision: https://reviews.llvm.org/D82549
2021-10-26 10:40:25 -04:00
Fraser Cormack c3dce37a55 [LangRef] Document that DataLayout defaults to little-endian
Little-endian has apparently been the default since 2014.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112316
2021-10-26 10:54:23 +01:00
Arthur Eubanks ce304a452a [docs][NewPM] Add example C++ code on how to actually use the new PM
Differential Revision: https://reviews.llvm.org/D112477
2021-10-25 13:24:20 -07:00
David Blaikie 68cac47c26 Add release notes for the LLDB impact from the array type name change
Changing the array type printing from `int [N]` to `int[N]` impacts lldb
pretty printer registration & may need to be updated to handle the
dropped space between type and dimensions.
2021-10-25 10:17:44 -07:00
David Blaikie aecf698644 Remove referenced to deleted parallel-libs project 2021-10-25 10:17:26 -07:00
Chris Bieneman b2544fb9c5 Document `LLVM_USE_SPLIT_DWARF` option
This patch adds a documentation note about the LLVM_USE_SPLIT_DWARF
CMake option which is useful to reduce linker memory usage.
2021-10-25 18:50:55 +05:30
Kazu Hirata d8e4170b0a Ensure newlines at the end of files (NFC) 2021-10-23 08:45:29 -07:00
Shivam Gupta 7088da480c [NFC] Correct arc draft option 2021-10-23 12:25:46 +05:30
Matt Arsenault 8d4b74ac3f AMDGPU: Don't consider whether amdgpu-flat-work-group-size was set
It should be semantically identical if it was set to the same value as
the default. Also improve the documentation.
2021-10-22 16:23:50 -04:00
Duncan P. N. Exon Smith 27181cad0d Support: Add Expected<T>::moveInto() to avoid extra names
Expected<T>::moveInto() takes as an out parameter any `OtherT&` that's
assignable from `T&&`. It moves any stored value before returning
takeError().

Since moveInto() consumes both the Error and the value, it's only
anticipated that we'd use call it on temporaries/rvalues, with naming
the Expected first likely to be an anti-pattern of sorts (either you
want to deal with both at the same time, or you don't). As such,
starting it out as `&&`-qualified... but it'd probably be fine to drop
that if there's a good use case for lvalues that appears.

There are two common patterns that moveInto() cleans up:
```
  // If the variable is new:
  Expected<std::unique_ptr<int>> ExpectedP = makePointer();
  if (!ExpectedP)
    return ExpectedP.takeError();
  std::unique_ptr<int> P = std::move(*ExpectedP);

  // If the target variable already exists:
  if (Expected<T> ExpectedP = makePointer())
    P = std::move(*ExpectedP);
  else
    return ExpectedP.takeError();
```
moveInto() takes less typing and avoids needing to name (or leak into
the scope) an extra variable.
```
  // If the variable is new:
  std::unique_ptr<int> P;
  if (Error E = makePointer().moveInto(P))
    return E;

  // If the target variable already exists:
  if (Error E = makePointer().moveInto(P))
    return E;
```

It also seems useful for unit tests, to log errors (but continue) when
there's an unexpected failure. E.g.:
```
  // Crash on error, or undefined in non-asserts builds.
  std::unique_ptr<MemoryBuffer> MB = cantFail(makeMemoryBuffer());

  // Avoid crashing on error without moveInto() :(.
  Expected<std::unique_ptr<MemoryBuffer>>
      ExpectedMB = makeMemoryBuffer();
  ASSERT_THAT_ERROR(ExpectedMB.takeError(), Succeeded());
  std::unique_ptr<MemoryBuffer> MB = std::move(ExpectedMB);

  // Avoid crashing on error with moveInto() :).
  std::unique_ptr<MemoryBuffer> MB;
  ASSERT_THAT_ERROR(makeMemoryBuffer().moveInto(MB), Succeeded());
```

Differential Revision: https://reviews.llvm.org/D112278
2021-10-22 11:47:03 -07:00
Sylvestre Ledru fd5e3f36f2 Replace references to Makefile.sphinx
and fix some typos

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D112299
2021-10-22 15:32:12 +02:00
Florian Hahn d465315679
[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.
IRBuilder has been updated to support preserving metdata in a more
general manner. This patch adds `LLVMAddMetadataToInst` and
deprecates `LLVMSetInstDebugLocation` in favor of the more
general function.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D93454
2021-10-22 11:21:28 +01:00
Tom Stellard c16655f138 [docs] Remove Makefile.sphinx files
Does anyone still use these?  I want to make some changes to the sphinx
html generation and I don't want to have to implement the changes in
two places.

Reviewed By: sylvestre.ledru, #libc, ldionne

Differential Revision: https://reviews.llvm.org/D112030
2021-10-21 16:04:52 -07:00
David Blaikie db0486c46f Remove unused parallel-libs project
Differential Revision: https://reviews.llvm.org/D112265
2021-10-21 14:34:39 -07:00
Frederic Cambus 9635b2951d [docs] Fix broken link rendering in the LLVM Coding Standards. 2021-10-21 11:12:33 +02:00
David Sherwood 23db763b7d Fix documentation errors introduced by 607fb1bb8c 2021-10-19 15:12:03 +01:00
David Sherwood 607fb1bb8c [AArch64] Always add -tune-cpu argument to -cc1 driver
This patch ensures that we always tune for a given CPU on AArch64
targets when the user specifies the "-mtune=xyz" flag. In the
AArch64Subtarget if the tune flag is unset we use the CPU value
instead.

I've updated the release notes here:

  llvm/docs/ReleaseNotes.rst

and added tests here:

  clang/test/Driver/aarch64-mtune.c

Differential Revision: https://reviews.llvm.org/D110258
2021-10-19 14:57:51 +01:00
Christian Kühnel dcc91dd2a7 first draft of a written policy around git repos
This is a frist draft of a set of policies around new git repos and how we grant write access to our GitHub organisation.

This proposal is based on the discussions in:
https://github.com/llvm/llvm-iwg/issues/40
https://github.com/llvm/llvm-iwg/issues/51

Differential Revision: https://reviews.llvm.org/D111723
2021-10-19 08:05:37 +00:00
Frederic Cambus 4d7c7d87e4
[docs] Mention DragonFlyBSD as a supported platform for LLVM.
Differential Revision: https://reviews.llvm.org/D111758
2021-10-16 13:20:10 +02:00
Tom Stellard 509fe20fbc docs: Document workaround for arcanist failures
Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D110976
2021-10-14 03:25:36 +00:00
William Woodruff 86a4a93a1c [docs] [NFC] Clarify the datalayout documentation
This patch fixes a couple of small oversights in the documentation for
the datalayout specification:

* The v and f specifications are subject to the same constraints on <size>
as i is.
* The p[n] specification didn't mark <idx> as optional, despite
being documented and parsed as such.
* Similarly, none of the alignment specifications require <pref>.
2021-10-12 23:21:48 +05:30
Victor Campos 3e7cf33a83 [docs] List support for Armv9-A, Armv9.1-A and Armv9.2-A in LLVM and Clang
Reviewed By: pratlucas

Differential Revision: https://reviews.llvm.org/D110241
2021-10-12 08:41:07 +01:00
modimo ef643617b8 [NFC][LangRef] Update description for FuncFlags
Add the additional flags from D36850 as well as noInline/alwaysInline from previous changes.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D111600
2021-10-11 22:03:53 -07:00
Arthur Eubanks b41cfbfcbb [docs] Mention in release notes that we now support 2^32 alignment
Missed in D110451.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D111472
2021-10-11 10:23:15 -07:00
Yuanfang Chen 8e3b9f453f [LangRef] Fix a typo in DISubrange section 2021-10-08 16:46:31 -07:00
Fangrui Song f66b1b2717 [LangRef] Update ifunc syntax
Extracted from Itay Bookstein's D108872.
2021-10-07 11:14:40 -07:00
Jay Foad 548b01c7a6 [MIRParser] Add support for IsInlineAsmBrIndirectTarget
Print this basic block flag as inlineasm-br-indirect-target and parse
it. This allows you to write MIR test cases for INLINEASM_BR. The test
case I added is one that I wanted to precommit anyway for D110834.

Differential Revision: https://reviews.llvm.org/D111291
2021-10-07 19:08:01 +01:00
gbreynoo 14d76a376a [llvm-readelf][docs] Add missing options and details to the help output and the command guide
This change is to keep the help text and command guide of llvm-readelf
in tandem.

 - In the help text mention that --section-data, --section-relocations,
   --section-symbols and --stack-sizes have no effect on GNU style
   output; give the accepted values for --elf-output-style and update
   the description of --gnu-hash-table to use the command guide
   description.
 - In the command guide add the missing options -a,
   --dependant-libraries,--no-demangle, --wide and -W. Also update the
   description of --symbols so it matches the help text.

Differential Revision: https://reviews.llvm.org/D111240
2021-10-07 17:11:02 +01:00
gbreynoo 3a5aa57c9b [llvm-objdump][docs] Add details to the help output and command guide
This change is to add some missing details, clarifies some options and
brings the help text and command guide of objdump closer together.

- Added to the help that --all-headers also outputs symbols and
  relocations to match the command guide.
- Added to the help that --debug-vars accepts an optional
  ascii/unicode format to match the command guide.
- Changed the help descriptions for --disassemble,
  --disassemble-all, --dwarf=<value>, --fault-map-section,
  --line-numbers, --no-leading-addr and --source descriptions to
  match the command guide.
- Added to the help that --start-address and --stop-address also
  effect relocation entries and the symbol table output to match
  the command guide.
- Added a note to the command guide that --unwind-info and -u
  are not available for the elf format.

Differential Revision: https://reviews.llvm.org/D110633
2021-10-07 16:30:12 +01:00
Kinuko Yasuda bafdf2b1ef [docs] Fix typo and minor text changes in MyFirstTypoFix
Reviewed By: kuhnel

Differential Revision: https://reviews.llvm.org/D111211
2021-10-06 08:31:56 +00:00
Philip Reames d60bfa6f19 Address a rst format error caught by buildbot 2021-10-05 18:58:08 -07:00
Philip Reames e2f150c3cf [docs] Expand the pre-merge testing description a bit
Core changes are:

    Be explicit about desired balance between missing true positives and reporting false positives.
    Mention the opt-out mechanism.
    Provide links to background, and give description of who to contact if needed.

Differential Revision: https://reviews.llvm.org/D110873
2021-10-05 18:41:24 -07:00
Simon Moll 72a08c0b94 [VP] Vector predicated vector splice intrinsic
This patch introduces the vector-predicated version of the
experimental_vector_splice intrinsic [1] at the IR level. It considers
the active vector length for both vectors and and uses a vector mask to
disable certain lanes in the result.

[1] https://reviews.llvm.org/D94708

Change originally authored by Vineet Kumar <vineet.kumar@bsc.es>

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D103898
2021-09-29 10:43:36 +02:00
Arthur Eubanks aa53785f23 Reland [clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall"
attribute into "dontcall-warn" and "dontcall-error", and also add the
frontend attribute value as the LLVM attribute value. This gives us all
the information to report diagnostics we need from within the IR (aside
from access to the original source).

One downside is we directly use LLVM's demangler rather than using the
existing Clang diagnostic pretty printing of symbols.

Previous revisions didn't properly declare the new dependencies.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D110364
2021-09-28 15:31:30 -07:00
Arthur Eubanks 7833d20f1f Revert "[clang] Rework dontcall attributes"
This reverts commit 2943071e2e.

Breaks bots
2021-09-28 14:49:27 -07:00
Arthur Eubanks 2943071e2e [clang] Rework dontcall attributes
To avoid using the AST when emitting diagnostics, split the "dontcall"
attribute into "dontcall-warn" and "dontcall-error", and also add the
frontend attribute value as the LLVM attribute value. This gives us all
the information to report diagnostics we need from within the IR (aside
from access to the original source).

One downside is we directly use LLVM's demangler rather than using the
existing Clang diagnostic pretty printing of symbols.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D110364
2021-09-28 14:21:10 -07:00
Mehdi Amini 90babc86c3 Fix URLs to the prod/staging buildbot master in the doc
Differential Revision: https://reviews.llvm.org/D110565
2021-09-28 06:18:26 +00:00
gbreynoo 05b1c7aebf [llvm-dwarfdump][docs] Add missing options to the help output and the command guide
This change is to add some missing details to the help text and command
guide:

- Added a note to the command guide that --debug-macro also dumps
  .debug_macinfo.
- Added a note to the command guide that --debug-frame and --eh_frame
  are aliases, and in cases where both sections are present one command
  outputs both.
- Changed the wording in the help output for --ignore-case and --regex to
  closer match the command guide.
2021-09-27 14:28:31 +01:00
Anirudh Prasad e09a1dc475 [SystemZ][z/OS] Add GOFF Support to the DataLayout
- This patch adds in the GOFF mangling support to the LLVM data layout string. A corresponding additional line has been added into the data layout section in the language reference documentation.
- Furthermore, this patch also sets the right data layout string for the z/OS target in the SystemZ backend.

Reviewed By: uweigand, Kai, abhina.sreeskantharajan, MaskRay

Differential Revision: https://reviews.llvm.org/D109362
2021-09-24 14:09:01 -04:00
gbreynoo 3bad9616aa [llvm-objcopy][docs] Add missing options to the help output and the command guide
This change is to keep the help text and command guide of objcopy in
tandem.

- In the help output the options --rename-section and
  --set-section-flags were missing the flag exclude, which is found in
  the command guide.
- In the command guide the alias -G for --keep-global-symbol was
    missing, which is found in the help output.

Differential Revision: https://reviews.llvm.org/D110340
2021-09-24 09:44:46 +01:00
Frederic Cambus 4ed05312a1 [docs] Document the --print-passes flag in opt.
Reviewed By: aeubanks, asbirlea

Differential Revision: https://reviews.llvm.org/D109663
2021-09-24 08:57:15 +05:30
OGINO Masanori 17a26f5851 [NFC] Update the list of subprojects in docs.
The updated list is based on the output of
cmake -G Ninja -S llvm -B build -DLLVM_ENABLE_PROJECTS='foo'.

Differential Revision: https://reviews.llvm.org/D110124
2021-09-21 17:27:13 +02:00
Sylvestre Ledru 8919e7b251 llvm doc: remove the old reference to subversion and add a link to the GH repo instead 2021-09-18 12:45:32 +02:00
Sylvestre Ledru 23763dd7c9 llvm doc: subversion isn't necessary in this example 2021-09-18 12:42:09 +02:00
Sylvestre Ledru 2790498178 Adjust the doc after the renaming of debuginfo-tests => cross-project-tests 2021-09-18 09:55:57 +02:00
Alok Kumar Sharma a5b72abc9e [DebugInfo] Enhance DIImportedEntity to accept children entities
New field `elements` is added to '!DIImportedEntity', representing
list of aliased entities.
This is needed to dump optimized debugging information where all names
in a module are imported, but a few names are imported with overriding
aliases.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D109343
2021-09-16 10:41:55 +05:30
Craig Topper 2fd180bbb9 [IR] Reduce max supported integer from 2^24-1 to 2^23.
SelectionDAG will promote illegal types up to a power of 2 before
splitting down to a legal type. This will create an IntegerType
with a bit width that must be <= MAX_INT_BITS. This places an
effective upper limit on any type of 2^23 so that we don't try
create a 2^24 type.

I considered putting a fatal error somewhere in the path from
TargetLowering::getTypeConversion down to IntegerType::get, but
limiting the type in IR seemed better.

This breaks backwards compatibility with IR that is using a really
large type. I suspect such IR is going to be very rare due to the
the compile time costs such a type likely incurs.

Prevents the ICE in PR51829.

Reviewed By: efriedma, aaron.ballman

Differential Revision: https://reviews.llvm.org/D109721
2021-09-14 07:52:10 -07:00
Arthur Eubanks 096d9814aa [opt] Remove some legacy PM flags
Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D109664
2021-09-13 15:50:03 -07:00
Keith Smiley f7062f6dfb [docs] Improve description of LLVM_BUILD_TESTS
This makes it clear that this only has an effect if you use the all
build target.

Differential Revision: https://reviews.llvm.org/D109113
2021-09-10 18:01:38 -07:00
Akira Hatanaka dea6f71af0 [ObjC][ARC] Use the addresses of the ARC runtime functions instead of
integer 0/1 for the operand of bundle "clang.arc.attachedcall"

https://reviews.llvm.org/D102996 changes the operand of bundle
"clang.arc.attachedcall". This patch makes changes to llvm that are
needed to handle the new IR.

This should make it easier to understand what the IR is doing and also
simplify some of the passes as they no longer have to translate the
integer values to the runtime functions.

Differential Revision: https://reviews.llvm.org/D103000
2021-09-08 11:58:03 -07:00
Brad Smith 0954e2b2d0 Mention OpenBSD in the documentation 2021-09-07 04:38:52 -04:00
Chris Bieneman 2856719d74 [CMake] Add targets for generating coverage reports
This is a pretty small bit of CMake goop to generate code coverage
reports. I always forget the right script invocation and end up
fumbling around too much.

Wouldn't it be great to have targets that "Just Work"?

Well, I thought so.

At present this only really works correctly for LLVM, but I'll extend
it in subsequent patches to work for subprojects.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D109019
2021-09-03 10:45:55 -05:00
Dmitry Preobrazhensky 9e3f86e273 [AMDGPU][MC][NFC][DOC] Updated description of registers
Corrected list of available register tuples to reflect changes introduced by
commits https://reviews.llvm.org/D103672 and https://reviews.llvm.org/D103800

See bug https://bugs.llvm.org/show_bug.cgi?id=51388
2021-09-03 13:09:54 +03:00
Yuichi Yoshida 1708d17423 Reformulate OrcJIT tutorial doc to make it more clear.
Fixed a minor writing error. The text was hard to understand.

Reviewed By: lhames, mehdi_amini

Differential Revision: https://reviews.llvm.org/D106235
2021-09-03 04:59:37 +00:00
Roman Lebedev 3f1f08f0ed
Revert @llvm.isnan intrinsic patchset.
Please refer to
https://lists.llvm.org/pipermail/llvm-dev/2021-September/152440.html
(and that whole thread.)

TLDR: the original patch had no prior RFC, yet it had some changes that
really need a proper RFC discussion. It won't be productive to discuss
such an RFC, once it's actually posted, while said patch is already
committed, because that introduces bias towards already-committed stuff,
and the tree is potentially in broken state meanwhile.

While the end result of discussion may lead back to the current design,
it may also not lead to the current design.

Therefore i take it upon myself
to revert the tree back to last known good state.

This reverts commit 4c4093e6e3.
This reverts commit 0a2b1ba33a.
This reverts commit d9873711cb.
This reverts commit 791006fb8c.
This reverts commit c22b64ef66.
This reverts commit 72ebcd3198.
This reverts commit 5fa6039a5f.
This reverts commit 9efda541bf.
This reverts commit 94d3ff09cf.
2021-09-02 13:53:56 +03:00
Simon Moll ea2cdbf5e6 [VP] Declaration and docs for vp.select intrinsic
llvm.vp.select extends the regular select instruction with an explicit
vector length (%evl).

All lanes with indexes at and above %evl are
undefined. Lanes below %evl are taken from the first input where the
mask is true and from the second input otherwise.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D105351
2021-09-02 11:17:14 +02:00
Arthur Eubanks 2413d6063b [docs] Mention that the legacy PM is deprecated and will be removed after 14
Per https://lists.llvm.org/pipermail/llvm-dev/2021-August/152305.html.

Reviewed By: MaskRay, fhahn

Differential Revision: https://reviews.llvm.org/D109080
2021-09-01 23:31:48 -07:00
Scott Linder 0022426917 [AMDGPU] Update Call Convention docs for GFX90A
Document the CSR AGPRs for GFX90A.

Remove the TODO for gfx908, as the answer is that we don't mark any
AGPRs as callee-saved except for GFX90A, i.e. the docs as-is are correct
for gfx908.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D109009
2021-09-01 20:02:41 +00:00
Sylvestre Ledru d396d09fc2 Document LLVM_ENABLE_RUNTIMES
Reviewed By: phosek, MaskRay

Differential Revision: https://reviews.llvm.org/D108890
2021-09-01 08:45:40 +02:00
Sylvestre Ledru c28473fe4a Fix some typos in the llvm docs 2021-08-31 21:31:20 +02:00
Shivam Gupta 8254f4afcb [Docs][Phabricator] Mention how to create a draft revision
https://llvm.org/docs/Phabricator.html have two links to Arcnist guide but
none of them mention how to create a draft revision. It would create some less noise if
developers create draft revisoin in this(--draft) way instead of [WIP] tag way.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D108970
2021-08-31 11:43:04 +05:30
Shivam Gupta 387a8dea72 [Docs] Remove subversion reference from MyFirstTypoFix.rst 2021-08-31 11:33:30 +05:30
pooja2299 843da6f408 [docs][GlobalISel]Adding info for G_JUMP_TABLE generic opcode
Added description of jump table and G_JUMP_TABLE opcode.

Differential Revision: https://reviews.llvm.org/D107630
2021-08-31 00:41:28 +05:30
Shivam Gupta 3a6b722db8 [docs] Add a new tutorial that talk about how to make a change to llvm
This tutorial will guide you through the process of making a change to LLVM, and contributing it back to the LLVM project.
We'll be making a change to Clang, but the steps for other parts of LLVM are the same. Even though the change we'll be making is simple,
we're going to cover steps like building LLVM, running the tests, and code review. This is good practice, and you'll be prepared for making larger changes.

Authors: @meikeb , @gribozavr
Commit: Zhiqian Xia

PS - This is a duplicate revision of https://reviews.llvm.org/D100714 which was actually used for patch review.

Reviewed By: kuhnel

Differential Revision: https://reviews.llvm.org/D108267
2021-08-30 07:01:04 +00:00
Kazu Hirata 5294a0f7c3 [llvm] Fix typos in documentation (NFC) 2021-08-28 06:37:03 -07:00
Michał Górny 2f69c82cec [llvm] [lit] Support forcing lexical test order
Add a new --order option to choose between available test orders:
the default "smart" order, predictable "lexical" order or "random"
order.  Default to using lexical order and one job in the lit test
suite.

Differential Revision: https://reviews.llvm.org/D107695
2021-08-27 20:47:11 +02:00
Dmitry Preobrazhensky 8ea3e9d9a2 [AMDGPU][MC][NFC][DOC] Updated AMD GPU assembler syntax description.
Summary of changes:
- Added f16 omod modifier (bug 51386).
- Corrected names of data types (bug 48638).
- Enabled a16 with most GFX10 MIMG opcodes (see https://reviews.llvm.org/D102231).
- Corrected description of integer operands (bug 51130).
- Corrected description of 8-bit DS offsets (bug 51536).
- Improved PERMLANE op_sel description.
- Corrected *SAD* opcode types.
2021-08-27 17:23:20 +03:00
Yaron Keren 692ebe5395 [docs] Add DIA register instructions to Getting Started with Visual Studio page
Since Visual Studio 2017 the DIA libs are not registered by default, see:
https://docs.microsoft.com/en-us/visualstudio/extensibility/breaking-changes-2017?view=vs-2019#change-reduce-registry-impact
LLDB building instruction already specify registering these DLLs, required
both the LLVM PDB tests and LLDB build.

Differential Revision: https://reviews.llvm.org/D108811
2021-08-27 13:10:19 +03:00
Matt Arsenault 088cc63640 AMDGPU: Invert AMDGPUAttributor
Switch to using BitIntegerState for each of the inputs, and invert
their meanings.

This now diverges more from the old AMDGPUAnnotateKernelFeatures, but
this isn't used yet anyway.
2021-08-26 21:32:13 -04:00
Fangrui Song a42bd1b560 [CMake] Change -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=off to -DLLVM_ENABLE_NEW_PASS_MANAGER=off
LLVM_ENABLE_NEW_PASS_MANAGER is set to ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER, so
-DLLVM_ENABLE_NEW_PASS_MANAGER=off has no effect.

Change the cache variable to LLVM_ENABLE_NEW_PASS_MANAGER instead.
A user opting out the new PM needs to switch from
-DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=off to
-DLLVM_ENABLE_NEW_PASS_MANAGER=off.

Also give a warning that -DLLVM_ENABLE_NEW_PASS_MANAGER=off is deprecated.

Reviewed By: aeubanks, phosek

Differential Revision: https://reviews.llvm.org/D108775
2021-08-26 14:25:31 -07:00
RamNalamothu 9b9e7f6f4e [docs, AMDGPU] Fix typo in dwarf register number mapping
Reviewed By: xgupta

Differential Revision: https://reviews.llvm.org/D108557
2021-08-26 23:55:29 +05:30
Yaron Keren 1958575859 [docs] Update Getting Started with Visual Studio guide
Update this document for 2021.

Reviewed By: aaron.ballman, kuhnel, amccarth

Differential Revision: https://reviews.llvm.org/D108513
2021-08-26 21:21:36 +03:00