[LV] Fix crash when forced UserVF and EpilogueVF are ignored (#218282)
`computeBestVF()` assumes/asserts that there should be only 2 vplans as
long as there is a vplan for `UserVF` and when `EpilogueVF` is forced.
It doesn't consider the case when those VFs are ignored because of
invalid costs.
This patch removes the assert and add a check for the vplan size.
[flang][debug] Don't ask for a name table with -gline-directives-only (#218402)
On current main (since #217132), a unit built with
`-gline-directives-only` crashes the backend when DWARF 5 is requested:
```console
$ echo 'end program' > test.f90
$ flang -gdwarf-5 -gline-directives-only -S -o /dev/null test.f90
flang: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h:107:
llvm::MCSymbol *llvm::DwarfUnit::getLabelBegin() const:
Assertion `LabelBegin && "LabelBegin is not initialized"' failed.
```
The version has to be spelled out because flang does not yet default to
DWARF 5. Everything else about the command line is ordinary.
Such a unit emits line directives and no `.debug_info`, so the header of
its compile unit is never written and neither is the label that header
defines. Under DWARF 5 the accelerator table indexes every compile unit
[11 lines not shown]
[KnownFPClass] Move float-to-integer bitcast handling into KnownFPClass [NFC] (#218090)
I moved the float-to-integer bitcast code into a new `KnownBits
bitcastToKnownBits(const fltSemantics &FltSemantics) const;` function.
This allows the code to be unit testable, and allows the code to be
reused elsewhere.
I also have future plans to work on the `KnownBits` deductions for the
float-to-integer bitcast.
AI Disclosure:
I used ChatGPT Codex (sol-5.6) to help move the code which I reviewed.
[Debug Info] Fix a Verifier failure with redeclared nodebug functions (#218070)
When a forward-declard function is used before its definition, and the
definition has a nodebug attribute on it, the existing heuristic in
EmitFuncDeclForCallSite would fail, because it only saw the non-nodebug
forward declaration, thus emitting a conflicting DISubprogram for the
call site.
rdar://184780682
Assisted-by: claude
[AMDGPU] Combine redundant ballot intrinsic calls
Suppose there is a loop where there is a call to @llvm.amdgcn.ballot,
which maps to an instruction involving the exec mask as an operand. This
instruction duplicates if the loop is unrolled. With a higher number of
unrolled iterations, the code bloats with such redundant instructions
with $exec as there is no middle-end/backend pass which could combine
such instructions in a uniform CFG.
This patch introduces a transform in AMDGPUUniformIntrinsicCombine to
combine redundant calls to @llvm.amdgcn.ballot, to mitigate this issue.
The approach is to walk over the dominator tree and collect all calls to
@llvm.amdgcn.ballot. Map the result type and condition to the calls, to
avoid combining calls of different kinds. Calls A and B can be combined
into A iff:
- A and B are identical
- A dominates B
- all paths from A to B are uniform and exec-invariant.
[2 lines not shown]
[KnownFPClass] Improve sign-preservation for `asin` (#216119)
`asin(x)` is negative iff `x` is negative. However, this can be loosened
to `asin(x)` is negative iff `x` is negative-finite since `asin(-inf)`
is `NaN`.
[Remarks] Fix linker warnings from mold
This PR is trying to fix the linker warnings emitted from mold.
```
mold: warning: tools/remarks-shlib/Remarks.exports: cannot assign version `LLVM_24.0` to symbol `LLVMRemarkStringGetData`: symbol not found
```
Fixes #93028.