[SCCP] Use mergeInValue instead of markConstant when folding CastInst (#173190)
Fixes #173180
The crash occurs when a vector constant refines its value during
iterative analysis.
In `SCCPInstVisitor::visitCastInst`, the logic for folding constants
through a `CastInst` uses `markConstant`. This function is strictly
designed for initial assignments and contains an assertion that prevents
a lattice element from being updated with a different constant pointer.
During the analysis of loops or complex data flows, a vector constant
may "refine." For example:
First Pass: SCCP identifies a value as `<4 x i64> {poison, poison,
poison, 0}`.
Second Pass: The value refines to `<4 x i64> zeroinitializer`.
[10 lines not shown]
[LV][IRBuilder] Allow implicit truncation of step vector (#173229)
LV can create step vectors that wrap around, e.g. `step-vector i1` with
VF>2. Allow truncation when creating the vector constant to avoid an
assertion failure with https://github.com/llvm/llvm-project/pull/171456.
After https://github.com/llvm/llvm-project/pull/173494 the definition of
the llvm.stepvector intrinsic has been changed to make it have wrapping
semantics, so the semantics for the fixed and scalable case match now.
[LLVM][LangRef] Redefine out-of-range stepvector values as being truncated. (#173494)
The LangRef current defines out-of-range stepvector values as poison.
This property is at odds with both the expansion used for fixed-length
vectors and the equivalent ISD node, both of which implicitly truncate
out-of-range values.
[clangd] Find references to constructors called indirectly via a forwarding function (#169742)
Calls to functions that forward to a constructor, such as make_unique,
are now recorded as references to the called constructor as well, so
that searching for references to a constructor finds such call sites.
Co-authored-by: Nathan Ridge <zeratul976 at hotmail.com>
[clang-tidy] Add fine-grained options to `misc-use-internal-linkage` (#173310)
There were several requests in #172797 to add fine-grained configuration
for this check: here it is. By default, everything is enabled.
Note: I think the tests could be better expressed if they were all in
the same file and used combinations of
`-check-suffixes={VAR,FUNC,TYPE}`, but I imagine merging all the tests
would have made reviewing confusing. Maybe a future PR?
ValueTracking: Avoid calling computeKnownFPClass on matched constant (#173248)
The fmul case already tries to match a literal value, we don't
need to match it twice.
[VPlan] Support binary add/sub in getSCEVExprForVPValue. (NFCI)
Handle binary add/sub in getSCEVExprForVPValue. This means we are able
to compute more replicate recipe costs in the VPlan cost model. It
should produce the same costs.
ValueTracking: Avoid calling computeKnownFPClass on matched constant
The fmul case already tries to match a literal value, we don't
need to match it twice.
ValueTracking: Improve computeKnownFPClass fmul handling (#173247)
Improve known non-nan sign bit tracking. Handle cases with
a known 0 or inf input of indeterminate sign.
The tails of some library functions have sign management
for special cases.