Revert "[libc] Support %lc in printf (#169983)"
This reverts commit 1327c50ef199b481f5326cf6ca3710fc111b70b1.
The printf headers are intended to be header-only, this introduces
external symbol dependencies.
Use setExprNeedsCleanups in BuildCXXNew and avoid breaking c++98
This approach is much cleaner, but broke checkICE reporting in c++98.
Stepping through a debugger shows that this happend because the
static_assert test didn not recognize ExprWithCleanups as transparent to
constant evaluation. To addresse this, we update CheckICE to recurse
into the sub-expression, and keep the old behavior.
[MC/DC] Refactor MCDCCoverageBuilder. NFC. (#125409)
- Get rid of the old `DecisionStack` and dissolve it into push/pop
`CurCondIDs` in `VisitBin`, since `VisitBin` is recursive.
- Introduce the new `DecisionStack` with `DecisionState` to handle the
current `Decision` in nested `Decision`s.
- The stack has the sentinel that has `DecisionExpr = nullptr`.
- Split out `checkDecisionRootOrPush` from `pushAndAssignIDs` for
non-BinOp. It assigns `CondID` to `E` (instead of assignment LHS in
`pushAndAssignIDs`).
- The stack is manupilated at the top Decision operator in `VisitBin`.
- The stack grows at the entrance of the Decision with the initial
state.
- In the same level in `VisitBin`, the stack is popped and the
`Decision` record is emitted.
- Introduce `DecisionEndToSince` to sweep `MCDCBranch`es partially in
`cancelDecision`.
[CIR] Upstream CIR method attribute handling (#174640)
This adds code for generating cir.method attributes and lowering them to
LLVM IR to implement support the C++ method pointer variables.
[OpenCL] Set KHR extensions minimum version to OpenCL 1.0 (#175120)
Motivation is similar to 25cfdaa4e9dc. Their spec don't specify a
required OpenCL version. Targets may expose them before OpenCL 1.2.
Set KHR extensions (depth images, mipmaps, subgroups, kernel clock, dot
product, ext_float_atomics, extended_bit_ops, cles_khr_int64) to
availability 1.0.
Changes to opencl-c.h:
* Relax header and test guards to allow extension macros whenever any
OpenCL C version is defined.
* Relax cl_khr_depth_images guard to allow cl_khr_depth_images, OpenCL
C++, or OpenCL C 2.0+, since image2d_depth_t and image2d_array_depth_t
types require that coverage.
* Guard image1d_t, image1d_array_t and image2d_array_t types with OpenCL
C++ or OpenCL C 1.2+ to match with OpenCL C spec.
Relates to https://github.com/KhronosGroup/OpenCL-CTS/pull/2376.
[lldb] Change po fallback messaging (#175847)
When an object description expression fails, instead of emitting an error, mark it as a
warning instead. Additionally, send the more low level details of the failure to the
`expr` log, and show a more user friendly message:
> `po` was unsuccessful, running `p` instead
rdar://165190497
[clang] Use uniform lifetime bounds under exceptions
To do this we have to slightly modify how some expressions are handled
in Sema. Principally, we need to ensure that calls to new for
non-trivial types still have their destructors run. Generally this isn't
an issue, since these just get sunk into the surrounding scope. With
more lifetime annotations being produced for the expressions, we found
that some calls to `new` in an unreachable switch arm would not be
wrapped in ExprWithCleanups. As a result, they remain on the EhStack
when processing the default label, and since the dead arm doesn't
dominate the default label, we can end up with a case where the def-use
chain is broken (e.g. the def doesn't dominate all uses). Technically
this path would be impossible to reach due to the active bit, but it
still failed to satisfy a dominance relationship.
With that in place, we can remove the constraint on only using tighter
lifetimes when exceptions are disabled.
[clang] Use tighter lifetime bounds for C temporary arguments
In C, consecutive statements in the same scope are under
CompoundStmt/CallExpr, while in C++ they typically fall under
CompoundStmt/ExprWithCleanup. This leads to different behavior with
respect to where pushFullExprCleanUp inserts the lifetime end markers
(e.g., at the end of scope).
For these cases, we can track and insert the lifetime end markers right
after the call completes. Allowing the stack space to be reused
immediately. This partially addresses #109204 and #43598 for improving
stack usage.
[lldb] Fix null pointer crash in LibStdcppTupleSyntheticFrontEnd::Update (#175700)
When displaying a backtrace with std::tuple function arguments,
GetChildAtIndex() can return a null ValueObjectSP. The code was
dereferencing this pointer without checking for null, causing a SIGSEGV
crash when LLDB tried to pretty-print function arguments containing
tuples.
This PR fix the crash and add unit test which would crash before this PR
and only pass after this PR.
---------
Co-authored-by: George Hu <georgehuyubo at gmail.com>
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
[win][aarch64] Called globals must match for instructions to be considered identical (#175798)
When trying to enable AArch64 Import Call Optimization for Windows, we
noticed an issue where a call to an incorrect function was happening
after the loader replaced a branch instruction. The root cause of this
was that LLVM had decided to fold two branch instructions into one as
they were both branches to the same register, however the value of the
register would be different in either path as they were branches for
different imported functions.
This change updates `MachineInstr::isIdenticalTo` to also consider any
"called global" that is attached to the instruction, and will consider
two instructions as "not the same" if the globals differ.
Also fixed a possible source of non-determinism: switched from using a
`DenseMap` to using a `vector` for mapping sections to lists of called
globals (we don't expect many sections, so no need to use a map) and
sort the map by section name before emitting.
[CIR] Attempt to fold casts and unary ops during codegen (#175675)
This change introduces basic folding of casts and unary ops as they are
created this is needed in order to allow later codegen pieces, such as
builtin handlers, to more easily identify and examine constant operands.
For example, many X86 builtin functions use a default mask operand of
-1, which was previously generated as a constant 1 and a unary minus.
In some cases, the folding process leaves behind unused constant
operations, so I am also added a simple change to the canonicalize pass
to remove unused constants. We had other places where unused constants
were being generated already, and this change cleans those up too.
[clang][CodeGenCXX] Fix pragma unroll test patterns (NFC) (#175860)
These tests were not testing the loop metadata that they suggest to be
testing. They would define FileCheck variables such as `UNROLL_8` for
metadata nodes and then later redefine instead of use them (redefinition
always succeeds and thus checks nothing). The error was likely
introduced because the earlier loop metadata nodes, which must define
the variables at the first occurrence, were copy-pasted for later loop
metadata nodes, without realizing that the variable definitions in the
FileCheck pattern must be changed to uses to match later occurrences of
the same metadata node. By matching the metadata section with a block of
DAG patterns, we can define variables such as `UNROLL_8` with a pattern
that matches at the metadata node definition, even if it occurs later,
and the loop metadata nodes can be matched with uniform patterns. This
system is also used in the `pragma-loop.cpp` test.
[AArch64][llvm] Improve codegen for svldr_vnum_za/svstr_vnum_za
When compiling `svldr_vnum_za` or `svstr_vnum_za`, the output
assembly has a superfluous `SXTW` instruction (gcc doesn't add
this); this should be excised, see https://godbolt.org/z/sz4s79rf8
In clang we're using int64_t, and `i32` in llvm. The extra `SXTW`
is due to a call to `DAG.getNode(ISD::SIGN_EXTEND...)`. Make them
both 64bit to make the extra `SXTW` go away.
[clang-tools-extra] Update Maintainers for Clang-Doc (#175822)
Currently, Erick Velez has been doing the bulk of clang-doc development.
We're also moving one of the old maintainers that hasn't participated in
almost a year to inactive.
[AArch64] Let LoadStoreOptimizer handle renamable implicit-defs. (#174186)
The LoadStoreOptimizer is very conservative with handling instructions
that have implicit-def operands and only support them for 2
instructions. However, they can be considered when a MachineOperand is
marked explicitly as 'renamable'.
[AArch64] Enable subreg liveness tracking for streaming functions. (#174189)
Most use of subreg liveness tracking will be for streaming SME2
functions where it can use the strided- and contiguous form of the
multi-vector LD1, see #123081 for details.
Any regressions come from disabling coalescing of SUBREG_TO_REG when
sub-reg liveness tracking is enabled, which may introduce some scalar
`mov`s and may limit some peephole optimizations from the load-store
optimizer, but the impact of disabling coalescing seems limited in
practice (empirically from trying this on workloads) and we think the
regressions are offset by improvements to the handling of multi-vector
instructions (tuple registers) in SME2.
PR #174188 addresses these issues in a separate PR.