SuccessChanges

Summary

  1. [flang][driver] Add support for `-fsyntax-only` (details)
  2. [IndVars] A test for adding trunc instructions to unwind blocks (details)
  3. Add intrinsics for saturating float to int casts (details)
  4. [clangd] Add hot-reload of compile_commands.json and compile_flags.txt (details)
Commit 7d246cb19db9fce65946fb4bac6e570787dbe78a by andrzej.warzynski
[flang][driver] Add support for `-fsyntax-only`

The behaviour triggered with this flag is consistent with `-fparse-only`
in `flang` (i.e. the throwaway driver). This new spelling is consistent
with Clang and gfortran, and was proposed and agreed on for the new
driver in [1].

This patch also adds some minimal logic to communicate whether the
semantic checks have failed or not. When semantic checks fail, a
frontend driver error is generated. The return code from the frontend
driver is then determined by checking the driver diagnostics - the
presence of driver errors means that the compilation has failed. This
logic is consistent with `clang -cc1`.

[1] http://lists.llvm.org/pipermail/flang-dev/2020-November/000588.html

Differential Revision: https://reviews.llvm.org/D92854
The file was modifiedflang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
The file was addedflang/test/Flang-Driver/syntax-only.f90
The file was modifiedflang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedflang/unittests/Frontend/PrintPreprocessedTest.cpp
The file was modifiedflang/lib/Frontend/FrontendActions.cpp
The file was modifiedflang/include/flang/Frontend/CompilerInstance.h
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedflang/lib/Frontend/CompilerInstance.cpp
The file was modifiedflang/include/flang/Frontend/FrontendActions.h
The file was modifiedflang/include/flang/Frontend/FrontendOptions.h
The file was modifiedflang/lib/Frontend/CMakeLists.txt
Commit 324d96b63759c00804ddb2ad74440afc39c52ebf by yrouban
[IndVars] A test for adding trunc instructions to unwind blocks

Differential Revision: https://reviews.llvm.org/D93521
Reviewed By: skatkov
The file was modifiedllvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll
Commit a89d751fb401540c89189e7c17ff64a6eca98587 by bjorn.a.pettersson
Add intrinsics for saturating float to int casts

This patch adds support for the fptoui.sat and fptosi.sat intrinsics,
which provide basically the same functionality as the existing fptoui
and fptosi instructions, but will saturate (or return 0 for NaN) on
values unrepresentable in the target type, instead of returning
poison. Related mailing list discussion can be found at:
https://groups.google.com/d/msg/llvm-dev/cgDFaBmCnDQ/CZAIMj4IBAAJ

The intrinsics have overloaded source and result type and support
vector operands:

    i32 @llvm.fptoui.sat.i32.f32(float %f)
    i100 @llvm.fptoui.sat.i100.f64(double %f)
    <4 x i32> @llvm.fptoui.sat.v4i32.v4f16(half %f)
    // etc

On the SelectionDAG layer two new ISD opcodes are added,
FP_TO_UINT_SAT and FP_TO_SINT_SAT. These opcodes have two operands
and one result. The second operand is an integer constant specifying
the scalar saturation width. The idea here is that initially the
second operand and the scalar width of the result type are the same,
but they may change during type legalization. For example:

    i19 @llvm.fptsi.sat.i19.f32(float %f)
    // builds
    i19 fp_to_sint_sat f, 19
    // type legalizes (through integer result promotion)
    i32 fp_to_sint_sat f, 19

I went for this approach, because saturated conversion does not
compose well. There is no good way of "adjusting" a saturating
conversion to i32 into one to i19 short of saturating twice.
Specifying the saturation width separately allows directly saturating
to the correct width.

There are two baseline expansions for the fp_to_xint_sat opcodes. If
the integer bounds can be exactly represented in the float type and
fminnum/fmaxnum are legal, we can expand to something like:

    f = fmaxnum f, FP(MIN)
    f = fminnum f, FP(MAX)
    i = fptoxi f
    i = select f uo f, 0, i # unnecessary if unsigned as 0 = MIN

If the bounds cannot be exactly represented, we expand to something
like this instead:

    i = fptoxi f
    i = select f ult FP(MIN), MIN, i
    i = select f ogt FP(MAX), MAX, i
    i = select f uo f, 0, i # unnecessary if unsigned as 0 = MIN

It should be noted that this expansion assumes a non-trapping fptoxi.

Initial tests are for AArch64, x86_64 and ARM. This exercises all of
the scalar and vector legalization. ARM is included to test float
softening.

Original patch by @nikic and @ebevhan (based on D54696).

Differential Revision: https://reviews.llvm.org/D54749
The file was modifiedllvm/docs/LangRef.rst
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
The file was addedllvm/test/CodeGen/AArch64/fptosi-sat-scalar.ll
The file was addedllvm/test/CodeGen/AArch64/fptosi-sat-vector.ll
The file was addedllvm/test/CodeGen/X86/fptoui-sat-scalar.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
The file was modifiedllvm/include/llvm/CodeGen/ISDOpcodes.h
The file was modifiedllvm/include/llvm/Target/TargetSelectionDAG.td
The file was addedllvm/test/CodeGen/AArch64/fptoui-sat-vector.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
The file was addedllvm/test/CodeGen/AArch64/fptoui-sat-scalar.ll
The file was modifiedllvm/include/llvm/CodeGen/TargetLowering.h
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
The file was modifiedllvm/include/llvm/IR/Intrinsics.td
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
The file was modifiedllvm/lib/CodeGen/TargetLoweringBase.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
The file was addedllvm/test/CodeGen/ARM/fptosi-sat-scalar.ll
The file was addedllvm/test/CodeGen/X86/fptosi-sat-scalar.ll
Commit 98993193e9037345ad13720a62974064a5f3d953 by sam.mccall
[clangd] Add hot-reload of compile_commands.json and compile_flags.txt

When querying the CDB, we stat the underlying file to check it hasn't changed.
We don't do this every time, but only if we didn't check within 5 seconds.

This behavior only exists for compile_commands.json and compile_flags.txt.
The CDB plugin system doesn't expose enough information to handle others.

Slight behavior change: we now only look for `build/compile_commands.json`
rather than trying every CDB strategy under `build` subdirectories.

Differential Revision: https://reviews.llvm.org/D92663
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.cpp
The file was modifiedclang-tools-extra/clangd/GlobalCompilationDatabase.cpp
The file was modifiedclang-tools-extra/clangd/tool/Check.cpp
The file was modifiedclang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
The file was modifiedclang-tools-extra/clangd/GlobalCompilationDatabase.h