[analyzer] Use makeNode instead of ExplodedGraph::getNode (#218462)
The method `CoreEngine::makeNode` is the canonical way of creating a new
node in the exploded graph and connecting it to its predecessor. Apply
it in two locations that previously duplicated its logic.
Note that `ExplodedGraph::getNode` always returns a non-null
`ExplodedNode *` (that points to either an old node or the freshly
created node); `inlineCall` had no reason to check whether it returns a
nullpointer.
This change is very close to being NFC, but could technically change the
behavior if the state is `PosteriorlyOverconstrained` (which is
vanishingly rare).
[ADT] Allow SmallVector move construction without move assignment (#219934)
Move-construct inline elements directly instead of using move assignment.
This avoids requiring element types to be move-assignable, only move-constructible.
Such types at the moment forces us to fall back to std::vector, for no good reason other
than an implementation quirks which is fixed here.
Assisted-by: Codex
[clang][bytecode][NFC] Use Func->getDecl() instead of getCallee() (#220230)
We already `assert(Func)` above and use `Func` directly in other places
in this function, so just get the `FunctionDecl` from that instead of
going through the virtual function.
[fir][AddAliasTags] allow usage of AddAliasTag pass after FirToMemref (#219493)
This is a first patch to improve mixed-dialect support in Flang. The
goal is to allow TBAA tags to be generated before codegen even
after FIRToMemRef or ExternalNameConversion has run.
Concretely:
- Treat non-FIR allocation operations as local allocations under the
"allocated data" TBAA subtree. They cannot alias Fortran dummy
arguments. If a conversion pass copied the Fortran variable uniq_name
onto the new allocation, use that name so the access is distinct from other
named allocations; otherwise use the unnamed "allocated data" tag.
- Always look for fir.internal_name when building the TBAA tree, not
only on llvm.func. This removes the assumption that
ExternalNameConversion has not run before AddAliasTags and
makes it possible to place the pass later in new pipelines.
Note that this patch is not enough to generate Fortran TBAA tags in LLVM
IR after FIRToMemRef. MemRef will also need to understand the tbaa
attribute and propagate it through its LLVM lowering.
[VPlan] Don't replicate extractvalues that would require extracting lanes from a struct (#219941)
In the added test cases, we have an extractvalue in a replicate region:
vector.ph:
WIDEN-INTRINSIC ir<%sincos> = call llvm.sincos(ir<0.000000e+00>)
...
pred.store.if:
EMIT vp<%3> = extractelement ir<%sincos>, ir<0>
CLONE ir<%cos> = extractvalue vp<%3>
CLONE store ir<%cos>, ir<%cos_dst>
However the operand
a) doesn't generate per lane
b) isn't defined in the same replicate region
[6 lines not shown]
[Flang][OpenMP] Fix crash on paths where no optional mangler is provided (#220043)
Currently we will ICE in certain test cases where we run the
DoConcurrentConversion or the privatization pass that invokes
getOrGenImplicitDefaultDeclareMapper with no provided mapper. As we will
still invoke the mapper function without checking it's actually
available. Fix this by verifying we have been provided one first before
usage, the fall back path of using the
getCanonicalDefaultDeclareMapperName results remains the same.
Switch to SmallVector with space on stack
SmallVector allows for much larger small sizes than SetVector, so use 256 to match InstructionWorklist.
We don't need to worry about duplicate worklist entries until we add users to the worklist.
[SLP]Vectorize unique scalars of splat gather nodes as separate subtrees
A splat gather (the same instruction in every lane) is emitted as an
expensive insertion sequence. When the unique scalars of several splat
gathers form a vectorizable bundle, build them as a separate subtree and
emit the splat gathers as broadcasts of the vectorized value.
Original Pull Request: https://github.com/llvm/llvm-project/pull/218250
Recommit after revert in b80664df122426d703fd8eb0ad7e8e9c2c19bbf3 with
fixed compiler crashes
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/220250
[Support][vfs] Remove can_write check when replacing file (#219540)
Remove the can_write check when the file is to be replaced. can_write checks the
permission bits of the file itself, but OnDiskOutputFile::keep() will delete and
replace the file for which the permission bits of the parent directory are the
relevant ones. Keep the check in append mode where the file is actually opened
for writing.
The check causes problems with ccache which removes write permission in
hard_link mode to protect its cache. The file can still be replaced.
AMDGPU: Warn if trying to codegen without a subarch
Warn if using the legacy amdgcn name, or amdgpu without a
specified subarch. This is to push all the non-clang frontends
to update to the new system, but this should turn into an error
in the next release.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[lld][riscv] Remove integer check for R_RISCV_SET32 (#219143)
If linker relaxation is enabled, the assembler might emit a
R_RISCV_SET[n]/R_RISCV_SUB[n] relocation pair for symbolic differences in
case of debug info relaxation (i.e. when relaxing DWARF CFA).
During relocation, the linker checks if the value for the R_RISCV_SET32
relocation fits a 32-bit signed integer (and a range error is issued if
it does not). If the symbol's absolute address is high enough (e.g. the
text section starts from 0x80000000), this results in a linker error.
R_RISCV_SET32 is also an absolute relocation type, so this check should
be removed.
[lldb] Guard SourceManager::File's line offsets with a mutex (#219424)
A SourceManager::File is shared by every Target and Process because
Debugger and Process hand out cached instances (see SourceFileCache).
m_offsets is the one member that is computed after the File was
created. CalculateLineOffsets() indexes the file on the first access.
Two threads that read the same source file at the same time therefore
race in the current implementation.
This patch guards m_offsets with a `Guarded` which avoids any potential
races. The shared mutex allows concurrent accesses once the line
offsets were calculated.
assisted-by: claude