Changes

Summary

  1. [ORC][examples] Fix segfault in LLJITWithTargetProcessControl (details)
  2. [Sema] Fix a null pointer reference crash. (details)
  3. [AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders (details)
  4. Pass some DataLayout arguments by const-ref (details)
  5. Fix buildbot error. (details)
  6. Support: Fix missing whitespace in comment for inconvertibleErrorCode(), NFC (details)
  7. [x86] add AVX run to tests of fcmp logic; NFC (details)
  8. [lldb] [gdb-remote] Refactor getting remote regs to use local vector (details)
  9. [lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs (details)
  10. [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils. (details)
  11. [RegAlloc] Cast uint8_t to unsigned before printing it. (details)
  12. [SampleFDO] Remove redundant declarations (NFC) (details)
  13. [PowerPC] Add range checks for P10 Vector Builtins (details)
  14. [libc++] Use CMake interface targets to setup benchmark flags (details)
  15. [LiveIntervals] Fix repairOldRegInRange for simple def cases (details)
  16. Revert "[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs" (details)
  17. Revert "[lldb] [gdb-remote] Refactor getting remote regs to use local vector" (details)
  18. Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion (details)
  19. [JumpThreading] Ignore free instructions (details)
  20. [fir][NFC] rename canBePointerOrHeapElementType to cannotBePointerOrHeapElementType (details)
  21. Revert "[LiveIntervals] Fix repairOldRegInRange for simple def cases" (details)
  22. [fir][NFC] Remove fir.cmpf replaced by mlir.cmpf (details)
  23. [ARM] Extra tests for unpredicated qr MVE intrinsics. (details)
  24. [libc++] Remove unused macro in __config (details)
  25. [flang] Implement READ(SIZE=) and INQUIRE(IOLENGTH=) in runtime (details)
  26. [compiler-rt][profile] Add padding after binary IDs (details)
  27. [lldb] Add a C language REPL to test LLDB's REPL infrastructure (details)
Commit 828422747d65ab6f0e3cdd75ed9a35f0afedf589 by Stefan Gränitz
[ORC][examples] Fix segfault in LLJITWithTargetProcessControl

Issue reported during review D110260
The file was modifiedllvm/examples/OrcV2Examples/LLJITWithTargetProcessControl/LLJITWithTargetProcessControl.cpp
Commit 3778c1cd6ef5a3286d5d49e842a2c65fffb8f3a6 by hokein.wu
[Sema] Fix a null pointer reference crash.

Differential Revision: https://reviews.llvm.org/D110315
The file was addedclang/test/SemaCXX/rounding-math-crash.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
Commit 2ac53fffaeda809df34e3fb2c442b0fd85d4b0ff by Piotr Sobczak
[AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders

The pass amdgpu-propagate-attributes ("Early/Late propagate attributes
from kernels to functions") is currently run also for shaders, where
it does nothing. Modify the check so the pass only processes functions
for kernels.

Differential Revision: https://reviews.llvm.org/D109961
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
Commit 5f2c53bdf4c58a488c098ed42c26dfcd369dd15e by llvm-dev
Pass some DataLayout arguments by const-ref

Avoid unnecessary copies, reported by MSVC static analyzer.
The file was modifiedllvm/tools/llvm-exegesis/lib/Assembler.cpp
The file was modifiedllvm/lib/Transforms/Coroutines/CoroFrame.cpp
The file was modifiedllvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
Commit 8ecf3660f2de3b88d10db0fd52d0bc80bda33dcc by hokein.wu
Fix buildbot error.

-frounding-math is not available for all targets.
The file was modifiedclang/test/SemaCXX/rounding-math-crash.cpp
Commit 87689657e28cd78faf2e07e859fb5b96f7a1f8fc by Duncan P. N. Exon Smith
Support: Fix missing whitespace in comment for inconvertibleErrorCode(), NFC
The file was modifiedllvm/include/llvm/Support/Error.h
Commit b240a2980b6e3777d6659d993f3ba60a3ca84bcb by spatel
[x86] add AVX run to tests of fcmp logic; NFC

The ISA before AVX has predicate gaps for both fcmp
codegen alternatives, so that requires a more
complicated fix to get ideal asm in all cases.
The file was modifiedllvm/test/CodeGen/X86/fcmp-logic.ll
Commit b03e701c145365ba339657ead54a2e0cc5c02776 by mgorny
[lldb] [gdb-remote] Refactor getting remote regs to use local vector

Refactor remote register getters to collect them into a local
std::vector rather than adding them straight into DynamicRegisterInfo.
The purpose of this change is to lay groundwork for switching value_regs
and invalidate_regs to use local LLDB register numbers rather than
remote numbers.

Differential Revision: https://reviews.llvm.org/D110025
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit 6fbed33d4a7de2229c40e6318f223092d3a23848 by mgorny
[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs

Switch the gdb-remote client logic to use local (LLDB) register numbers
in value_regs/invalidate_regs rather than remote regnos. This involves
translating regnos received from lldb-server.

Differential Revision: https://reviews.llvm.org/D110027
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
The file was modifiedlldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit 7f5ca8cc2158debe66663f09eb19b4613e75e124 by shivam98.tkg
[clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D110041
The file was modifiedclang/utils/make-ast-dump-check.sh
The file was modifiedclang/tools/diag-build/diag-build.sh
Commit d5c67bba62d3abc96ac501f45cabc33a100b00e8 by craig.topper
[RegAlloc] Cast uint8_t to unsigned before printing it.

raw_ostream interprets uint8_t as wanting to print a character
with that ASCII value. In this case the uint8_t is an integer
that we want to print.
The file was modifiedllvm/lib/CodeGen/RegAllocGreedy.cpp
Commit a95061691e43fd9a4216e60917715bdc58660d17 by kazu
[SampleFDO] Remove redundant declarations (NFC)

Note that these are declared in SampleProfileLoaderBaseUtil.h, which
SampleProfileLoaderBaseImpl.h includes.
The file was modifiedllvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
Commit f9912fe4eac91f27965c22d015b3109c5158d050 by quinn.pham
[PowerPC] Add range checks for P10 Vector Builtins

This patch adds range checking for some Power10 altivec builtins and
changes the signature of a builtin to match documentation. For `vec_cntm`,
range checking is done via SemaChecking. For `vec_splati_ins`, the second
argument is masked to extract the 0th bit so that we always receive either a `0`
or a `1`.

Reviewed By: lei, amyk

Differential Revision: https://reviews.llvm.org/D109710
The file was modifiedclang/test/CodeGen/builtins-ppc-p10vector.c
The file was modifiedclang/lib/Headers/altivec.h
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was addedclang/test/CodeGen/builtins-ppc-p10vector-error.c
Commit fd04fd9ac92d705f7d144b77109b8bcec950c04f by Louis Dionne
[libc++] Use CMake interface targets to setup benchmark flags

This is a re-application of da0592e4c8df which was reverted in
1454018dc1d9 because it was incompatible with older CMakes.
Instead, disable the benchmarks when CMake is too old to
support those idioms.

Differential Revision: https://reviews.llvm.org/D110285
The file was modifiedlibcxx/benchmarks/CMakeLists.txt
Commit 8229cb74125322ff337cfe316ab35c6ebf412bde by jay.foad
[LiveIntervals] Fix repairOldRegInRange for simple def cases

The fix applied in D23303 "LiveIntervalAnalysis: fix a crash in repairOldRegInRange"
was over-zealous. It would bail out when the end of the range to be
repaired was in the middle of the first segment of the live range of
Reg, which was always the case when the range contained a single def of
Reg.

This patch fixes it as suggested by Matthias Braun in post-commit review
on the original patch, and tests it by adding -early-live-intervals to
a selection of existing lit tests that now pass.

(Note that D23303 was originally applied to fix a crash in
SILoadStoreOptimizer, but that is now moot since D23814 updated
SILoadStoreOptimizer to run before scheduling so it no longer has to
update live intervals.)

Differential Revision: https://reviews.llvm.org/D110238
The file was modifiedllvm/test/CodeGen/ARM/signext-inreg.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/extract-load-i1.ll
The file was addedllvm/test/CodeGen/AMDGPU/twoaddr-regsequence.mir
The file was modifiedllvm/test/CodeGen/X86/mul-shift-reassoc.ll
The file was modifiedllvm/lib/CodeGen/LiveIntervals.cpp
Commit 12504f50729a338fb37c1c1863e7125b607e11d7 by mgorny
Revert "[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs"

This reverts commit 6fbed33d4a7de2229c40e6318f223092d3a23848.
The prerequisite commit is causing regressions.
The file was modifiedlldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit bcb6b97cde84b6acd67d5551302683234c09337c by mgorny
Revert "[lldb] [gdb-remote] Refactor getting remote regs to use local vector"

This reverts commit b03e701c145365ba339657ead54a2e0cc5c02776.  This is
causing regressions when XML support is disabled.
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit 1a6e1ee42a6af255d45e3fd2fe87021dd31f79bb by i
Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion

While both GlobalAlias and GlobalIFunc are GlobalIndirectSymbol, their
`getIndirectSymbol()` usage is quite different (GlobalIFunc's resolver
is an entity different from GlobalIFunc itself).

As discussed on https://lists.llvm.org/pipermail/llvm-dev/2020-September/144904.html
("[IR] Modelling of GlobalIFunc"), the name `getBaseObject` is confusing when
used with GlobalIFunc.

To resolve the confusion:

* Move GloalIndirectSymol::getBaseObject to GlobalAlias:: (GlobalIFunc should use `getResolver` instead)
* Change GlobalValue::getBaseObject not to inspect GlobalIFunc. Note: the function has 7 references.
* Add GlobalIFunc::getResolverFunction to peel off potential ConstantExpr indirection
  (`strlen` in `test/LTO/Resolution/X86/ifunc.ll`)

Note: GlobalIFunc::getResolver (like GlobalAlias::getAliasee which does not peel
off ConstantExpr indirection) is kept to be used by ValueEnumerator.

Reviewed By: ibookstein

Differential Revision: https://reviews.llvm.org/D109792
The file was modifiedllvm/lib/Transforms/Utils/SplitModule.cpp
The file was modifiedllvm/lib/IR/Globals.cpp
The file was modifiedllvm/lib/Object/IRSymtab.cpp
The file was modifiedllvm/lib/Object/ModuleSymbolTable.cpp
The file was modifiedllvm/include/llvm/IR/GlobalIFunc.h
The file was modifiedllvm/test/LTO/Resolution/X86/ifunc.ll
The file was modifiedllvm/include/llvm/IR/GlobalAlias.h
Commit 1e3c6fc7cb9d2ee6a5328881f95d6643afeadbff by nikita.ppv
[JumpThreading] Ignore free instructions

This is basically D108837 but for jump threading. Free instructions
should be ignored for the threading decision. JumpThreading already
skips some free instructions (like pointer bitcasts), but does not
skip various free intrinsics -- in fact, it currently gives them a
fairly large cost of 2.

Differential Revision: https://reviews.llvm.org/D110290
The file was modifiedllvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
The file was modifiedllvm/include/llvm/Transforms/Scalar/JumpThreading.h
The file was modifiedllvm/test/Transforms/JumpThreading/free_instructions.ll
The file was modifiedllvm/lib/Transforms/Scalar/JumpThreading.cpp
Commit bbc74a11bc15f4ce962ac7f915309145dcfc2582 by clementval
[fir][NFC] rename canBePointerOrHeapElementType to cannotBePointerOrHeapElementType

This patch is part of the upstreaming effort from fir-dev branch.
Rename the function so the name conveys better what it does.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D110323

Co-authored-by: schweitz
Co-authored-by: jeanPerier
The file was modifiedflang/lib/Optimizer/Dialect/FIRType.cpp
Commit deb2ca566ae70303042e3ab9296978895a817bf8 by jay.foad
Revert "[LiveIntervals] Fix repairOldRegInRange for simple def cases"

This reverts commit 8229cb74125322ff337cfe316ab35c6ebf412bde.

It was failing on buildbots with expensive checks enabled.
The file was modifiedllvm/test/CodeGen/ARM/signext-inreg.ll
The file was removedllvm/test/CodeGen/AMDGPU/twoaddr-regsequence.mir
The file was modifiedllvm/test/CodeGen/X86/mul-shift-reassoc.ll
The file was modifiedllvm/lib/CodeGen/LiveIntervals.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/extract-load-i1.ll
Commit 2155aa79d7019b620906d94ae6be72179bfd4880 by clementval
[fir][NFC] Remove fir.cmpf replaced by mlir.cmpf

fir.cmpf op is not necessary anymore as it is replaced by mlir.cmpf.
This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D110327

Co-authored-by: schweitzpgi
Co-authored-by: jeanPerier
The file was modifiedflang/test/Fir/fir-ops.fir
The file was modifiedflang/lib/Optimizer/Dialect/FIROps.cpp
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROps.td
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROps.h
The file was modifiedflang/lib/Lower/IntrinsicCall.cpp
Commit e2050f94b65322f886eade488e4398cb38a480df by david.green
[ARM] Extra tests for unpredicated qr MVE intrinsics.
The file was modifiedllvm/test/CodeGen/Thumb2/mve-qrintr.ll
Commit e6126faba060d5341dae6c5cc99a22a80d8c4d23 by Louis Dionne
[libc++] Remove unused macro in __config

That macro was being defined but not used anywhere in libc++, so it
must be safe to remove it.

As a fly-by fix, also remove mentions of this macro in other places
in LLVM, to make sure they were not depending on the value defined in
libc++.

Differential Revision: https://reviews.llvm.org/D110289
The file was modifiedllvm/lib/Support/LockFileManager.cpp
The file was modifiedclang-tools-extra/clangd/unittests/JSONTransportTests.cpp
The file was modifiedlibcxx/include/__config
Commit 4393e3776b41471afbd37cb13fe5b777243fedd1 by pklausler
[flang] Implement READ(SIZE=) and INQUIRE(IOLENGTH=) in runtime

Count input characters corresponding to formatted edit descriptors
for READ(SIZE=); count output bytes for INQUIRE(IOLENGTH=).

The I/O APIs GetSize() and GetLength() were adjusted to return
std::size_t as function results.

Basic unit tests were added (and others fixed).

Differential Revision: https://reviews.llvm.org/D110291
The file was modifiedflang/runtime/descriptor-io.h
The file was modifiedflang/runtime/io-stmt.h
The file was modifiedflang/runtime/edit-input.cpp
The file was modifiedflang/runtime/io-stmt.cpp
The file was modifiedflang/include/flang/Runtime/io-api.h
The file was modifiedflang/runtime/unit.cpp
The file was modifiedflang/unittests/Runtime/ExternalIOTest.cpp
The file was modifiedflang/runtime/io-api.cpp
Commit 6bc9c8dfe32cc4662f2ed9041af527f69dfff13b by leonardchan
[compiler-rt][profile] Add padding after binary IDs

Some tests with binary IDs would fail with error: no profile can be merged.
This is because raw profiles could have unaligned headers when emitting binary
IDs. This means padding should be emitted after binary IDs are emitted to
ensure everything else is aligned. This patch accounts for that padding in
__llvm_write_binary_ids.

Differential Revision: https://reviews.llvm.org/D110188
The file was modifiedcompiler-rt/lib/profile/InstrProfilingPlatformLinux.c
Commit c22329972f02f9d51e2f9ea54d9075a4a808ffde by Raphael Isemann
[lldb] Add a C language REPL to test LLDB's REPL infrastructure

LLDB has a bunch of code that implements REPL support, but all that code is
unreachable as no language in master currently has an implemented REPL backend.
The only REPL that exists is in the downstream Swift fork. All patches for this
generic REPL code therefore also only have tests downstream which is clearly not
a good situation.

This patch implements a basic C language REPL on top of LLDB's REPL framework.
Beside implementing the REPL interface and hooking it up into the plugin
manager, the only other small part of this patch is making the `--language` flag
of the expression command compatible with the `--repl` flag. The `--repl` flag
uses the value of `--language` to see which REPL should be started, but right
now the `--language` flag is only available in OptionGroups 1 and 2, but not in
OptionGroup 3 where the `--repl` flag is declared.

The REPL currently can currently only start if a running target exists. I'll add
the 'create and run a dummy executable' logic from Swift (which is requires when
doing `lldb --repl`) when I have time to translate all this logic to something
that will work with Clang.

I should point out that the REPL currently uses the C expression parser's
approach to persistent variables where only result variables and the ones
starting with a '$' are transferred between expressions. I'll fix that in a
follow up patch. Also the REPL currently doesn't work in a non-interactive
terminal. This seems to be fixed in the Swift fork, so I assume one of our many
REPL downstream changes addresses the issue.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D87281
The file was addedlldb/source/Plugins/REPL/Clang/CMakeLists.txt
The file was modifiedlldb/source/Commands/Options.td
The file was addedlldb/test/API/repl/clang/TestClangREPL.py
The file was addedlldb/source/Plugins/REPL/Clang/ClangREPL.h
The file was modifiedlldb/source/Plugins/CMakeLists.txt
The file was addedlldb/test/API/repl/clang/Makefile
The file was addedlldb/source/Plugins/REPL/Clang/ClangREPL.cpp
The file was addedlldb/source/Plugins/REPL/CMakeLists.txt
The file was addedlldb/test/API/repl/clang/main.c