[profcheck] Expose likely/unlikely weights as constants in MDBuilder (#183252)
Define `kLikelyBranchWeight` and `kUnlikelyBranchWeight` as static
constexpr members in MDBuilder.h and use them in
createLikelyBranchWeights and createUnlikelyBranchWeights. This makes
the weights used for likely/unlikely branches more discoverable and
reusable.
Co-authored-by: Jin Huang <jingold at google.com>
[bazel][libc] Add some deps for layering_check (#183235)
This adds a whole bunch of deps to get things _mostly_ building w/
`layering_check` enabled. It does not yet enable `layering_check`.
I used some tools to add deps to all these targets that break when
enabling the layering check feature, and a few things were added in
between when I ran the script and where trunk is at now. Since this is a
large change, I plan to do a second (and possibly third) pass later to
catch those new changes, at which point it would be safer to actually
enable `layering_check` for this package.
[clang][ARM] Refactor argument handling in `EmitAArch64BuiltinExpr` (3/N) (NFC)
Remove the outstanding calls to `EmitScalarExpr` in
`EmitAArch64BuiltinExpr` that are no longer required.
This is a follow-up for #181794 and #181974 - please refer to that PR
for more context.
[clang] allow canonicalizing assumed template names
Assumed template names are part of error recovery and encode just a
declaration name, making them always canonical. This patch allows
them to be canonicalized, which is trivial.
Fixes #183075
[clang][TypePrinter][NFC] Extract logic that handles AnonymousTagNameStyle::SourceLocation into helper function (#183304)
In https://github.com/llvm/llvm-project/pull/168533 we're adding a new
`AnonymousTagMode` and will be handled in `printAnonymousTagDecl`.
This patch extracts the logic that handles
`AnonymousTagNameStyle::SourceLocation` into a helper function to make
`printAnonymousTagDecl` easier to follow.
Drive-by changes:
* While copying the code into the helper I changed it to use
early-return style.
[clang] create local instantiation scope for matching template template parameters (#183219)
This fixes a bug where a partial substitution from the enclosing scope
is used to prepopulate an unrelated template argument deduction.
Fixes #181166
[lldb][Process/FreeBSDKernel] Add arm support (#180674)
This is LLDB version of
https://cgit.freebsd.org/ports/tree/devel/gdb/files/kgdb/arm-fbsd-kern.c.
This enables selecting arm and reading registers from PCB structure on
core dump and live kernel debugging while trapframe unwinding support
will be implemented in future. Test files using core dump from arm will
be implemented once other kernel debugging improvements are done.
---------
Signed-off-by: Minsoo Choo <minsoochoo0122 at proton.me>
[NFC][RegisterInfoEmitter] Add target name prefix for a few variables (#183074)
Add target name prefix for a few static global variables in the
generated code. Also rework the TargetRegisterInfo constructor a bit to
use a ArrayRef for array of register classes and rename a few
constructor arguments to match the member names they initialize.
AMDGPU: Implement expansion for f64 exp
I asked AI to port the device libs reference implementation.
It mostly worked, though it got the compares wrong and also
missed a fold that happened in compiler. With that fixed I get
identical DAG output, and almost the same globalisel output (differing
by an inverted compare and select). Also adjusted some stylistic choices.
[clang][ARM] Refactor argument handling in `EmitAArch64BuiltinExpr` (3/N) (NFC)
Remove the outstanding calls to `EmitScalarExpr` in
`EmitAArch64BuiltinExpr` that are no longer required.
This is a follow-up for #181794 and #181974 - please refer to that PR
for more context.
[SPIRV] Enable SPV_EXT_relaxed_printf_string_address_space by default for Intel (#183103)
It's easy to hit the address space limitation when using printf locally,
so just enable the extension by default for Intel.
Signed-off-by: Nick Sarnie <nick.sarnie at intel.com>
Rename Thumb1 SetResultRegister to ReturnResult
Also remove the return instructions following it in the main macro,
which aren't needed, since it does the returning itself.
[InstCombine] Replace alloca with undef size with poison instead of null
When an alloca instruction has an undef (or poison) array size, InstCombine
was previously replacing all uses of the alloca with a null pointer. This
caused invalid IR when the alloca was used by @llvm.lifetime intrinsics.
According to the @llvm.lifetime intrinsic specification, the pointer
argument must be either:
- A pointer to an alloca instruction, or
- A poison value
Since null is neither an alloca pointer nor poison, the previous
transformation violated the intrinsic's requirements and produced
invalid IR.
Fix by replacing the alloca with a poison value instead of null, which
satisfies the @llvm.lifetime requirements and produces valid IR.
Rename Thumb1 SetResultRegister to ReturnResult
Also remove the return instructions following it in the main macro,
which aren't needed, since it does the returning itself.
[openmp] Fix bug63197.c test with 3 cores (#183269)
This test assumes that the number of available threads is not 3,
otherwise `#pragma omp parallel` and `#pragma omp parallel
num_thread(3)` are naturally going to do the same thing.
Instead use `omp_get_max_threads() - 1` as the number of threads in the
initial `omp parallel num_thread(N)` and then check that the number of
threads does not match the value in the later `omp parallel`.
[MLIR][CMake] Fix runtime libraries with PCH (#182850)
Some MLIR libraries are intended to be dlopen-ed, but currently all MLIR
libraries link against LLVMSupport. After the recent PCH introduction,
this causes these libraries to implicitly use the LLVMSupport PCH, which
results in the definition of llvm::*ABIBreakingChecks, which results in
a ODR violation when loaded with dlopen.
Conceptually, libraries that are designed to be dlopen-ed should not
simply link against LLVM libraries in non-dylib builds for this reason.
(This apparently was a problem before with mlir_apfloat_wrappers.)
To fix builds, remove LLVMSupport from runtime libraries that don't need
it and, as a workaround, disable PCH for libraries that are in a weird
state (use LLVMSupport but happen to not export symbols currently).
[NFCI] Make all SI_KILL* convergent (#183100)
Add convergent property to SI_KILL*TERMINATOR. Now all SI_KILL* are
convergent. SI_KILL*TERMINATOR were already terminators so they could
not be sunk by machine-sink. Thus, this is probably a NFC.
Signed-off-by: John Lu <John.Lu at amd.com>
[InstCombine] Replace alloca with undef size with poison instead of null
When an alloca instruction has an undef (or poison) array size, InstCombine
was previously replacing all uses of the alloca with a null pointer. This
caused invalid IR when the alloca was used by @llvm.lifetime intrinsics.
According to the @llvm.lifetime intrinsic specification, the pointer
argument must be either:
- A pointer to an alloca instruction, or
- A poison value
Since null is neither an alloca pointer nor poison, the previous
transformation violated the intrinsic's requirements and produced
invalid IR.
Fix by replacing the alloca with a poison value instead of null, which
satisfies the @llvm.lifetime requirements and produces valid IR.
[VPlan] Supported conditionally executed single early exits. (#182395)
Add support for a single early exit that is executed conditionally. To
make sure the mask from any non-exiting control flow is combined with
the early exit condition.
To do so, introduce a MaskedCond VPInstruction, which is inserted as
user of the early-exit condition, at the point of the early-exit branch.
The VPInstruction will get masked automatically if needed by the
predicator, ensuring that we properly account for it when checking
whether the early exit has been taken.
Note that this does not allow for instructions that require predication
after the early exit. This requires additional work in progress:
https://github.com/llvm/llvm-project/pull/172454
As an alternative to MaskedCond, we could also predicate before handling
early exiting blocks: https://github.com/llvm/llvm-project/pull/181830
PR: https://github.com/llvm/llvm-project/pull/182395
[LLVM][TTI] Remove the isVScaleKnownToBeAPowerOfTwo hook. (#183292)
After https://github.com/llvm/llvm-project/pull/183080 this is no longer
a configurable property.
NOTE: No test changes expected beyond
llvm/test/Transforms/LoopVectorize/scalable-predication.ll which has
been removed because it only existed to verfiy the now unsupported
functionality.
[clang-tidy] Fix erroneous warning to make deleted function public (#182577)
This PR fixes #54276 and fixes #135249 by only matching private deleted
functions with a public overload or special member functions.
[CIR][AArch64] Add lowering + tests for predicated SVE svdup_lane builtins
This PR adds CIR lowering + tests for SVE `svdup_lane` builtins on
AArch64. The corresponding ACLE intrinsics are documented at:
https://developer.arm.com/architectures/instruction-sets/intrinsics