SuccessChanges

Summary

  1. [AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC. (details)
  2. Revert 5238e7b302 "[InstCombine] Replace one-use select operand based on condition" (details)
  3. [X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c)) (details)
  4. [mlir] Add `complex.abs`, `complex.div` and `complex.mul` to ComplexOps. (details)
  5. [flang][driver] Add support for `-I` in the new driver (details)
  6. [DebugInfo][dexter] Add dexter tests for merged values (details)
  7. [AArch64][SVE]Add cost model for vector reduce for scalable vector (details)
  8. [SystemZ][z/OS] Fix No such file or directory expression error (details)
Commit 49dce85584e34ee7fb973da9ba617169fd0f103c by jay.foad
[AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC.

Change-Id: Idd7f47647bc0faa3ad6f61f44728c0f20540ec00
The file was modifiedllvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp
The file was modifiedllvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h
Commit 58bdfcfac048563e0dbcecc7c75e4e7897c8da18 by hans
Revert 5238e7b302 "[InstCombine] Replace one-use select operand based on condition"

This caused a miscompile in Chromium, see comments on the codereview for
discussion and pointer to a reproducer.

> InstCombine already performs a fold where X == Y ? f(X) : Z is
> transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However,
> if f(X) only has one use, then we can always directly replace the
> use inside the instruction. To actually be profitable, limit it to
> the case where Y is a non-expr constant.
>
> This could be further extended to replace uses further up a one-use
> instruction chain, but for now this only looks one level up.
>
> Among other things, this also subsumes D94860.
>
> Differential Revision: https://reviews.llvm.org/D94862

This also reverts the follow-up
a003f26539cf4db744655e76c41f4c4a8913f116:

> [llvm] Prevent infinite loop in InstCombine of select statements
>
> This fixes an issue where the RHS and LHS the comparison operation
> creating the predicate were swapped back and forth forever.
>
> Differential Revision: https://reviews.llvm.org/D94934
The file was modifiedllvm/test/Transforms/InstCombine/select-binop-cmp.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
The file was modifiedllvm/test/Transforms/InstCombine/select-safe-transforms.ll
Commit 5626adcd6bbaadd12fe5bf15cd2d39ece2e5c406 by llvm-dev
[X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c))

If a srl doesn't introduce any sign bits into the truncated result, then replace with a sra to let us use a PACKSS truncation - fixes a regression noticed in D56387 on pre-SSE41 targets that don't have PACKUSDW.
The file was modifiedllvm/test/CodeGen/X86/vector-trunc.ll
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 11f4c58c153cedf6fe04cab49d4a4f02d00e3383 by pifon
[mlir] Add `complex.abs`, `complex.div` and `complex.mul` to ComplexOps.

Differential Revision: https://reviews.llvm.org/D94911
The file was modifiedmlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir
The file was modifiedmlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
The file was modifiedmlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
The file was modifiedmlir/test/Dialect/Complex/ops.mlir
Commit 87dfd5e012e147f4bfa3a9a4564e9cbc167278ff by andrzej.warzynski
[flang][driver] Add support for `-I` in the new driver

Add support for option -I in the new Flang driver. This will allow for
included headers and module files in other directories, as the default
search path is currently the working folder. The behaviour of this is
consistent with the current f18 driver, where the current folder (i.e.
".") has the highest priority followed by the order of '-I's taking
priority from first to last.

Summary of changes:
- Add SearchDirectoriesFromDashI to PreprocessorOptions, to be forwarded
  into the parser's searchDirectories
- Add header files and non-functional module files to be used in
  regression tests. The module files are just text files and are used to
  demonstrated that paths specified with `-I` are taken into account when
  searching for .mod files.

Differential Revision: https://reviews.llvm.org/D93453
The file was modifiedflang/lib/Frontend/CompilerInvocation.cpp
The file was addedflang/test/Flang-Driver/Inputs/basictestmoduleone.mod
The file was modifiedflang/test/Flang-Driver/driver-help.f90
The file was modifiedflang/include/flang/Frontend/PreprocessorOptions.h
The file was modifiedflang/test/Flang-Driver/driver-help-hidden.f90
The file was addedflang/test/Flang-Driver/Inputs/basic-header-two.h
The file was modifiedclang/lib/Driver/ToolChains/Flang.cpp
The file was addedflang/test/Flang-Driver/include-header.f90
The file was addedflang/test/Flang-Driver/include-module.f90
The file was addedflang/test/Flang-Driver/Inputs/header-dir/basic-header-one.h
The file was addedflang/test/Flang-Driver/Inputs/module-dir/basictestmoduletwo.mod
The file was modifiedclang/include/clang/Driver/Options.td
The file was addedflang/test/Flang-Driver/Inputs/header-dir/basic-header-two.h
The file was addedflang/test/Flang-Driver/Inputs/basic-header-one.h
Commit b7e516202eb66e004c49b89964bd5b30b287af87 by orlando.hyams
[DebugInfo][dexter] Add dexter tests for merged values

These dexter tests illustrate PR48719, the summary of which is:

Sometimes we insert dbg.values for merged values (PHIs) when promoting
variables, sometimes we don't. Sometimes there is no PHI because the merged
value is never used. It doesn't matter because LiveDebugValues understands these
merged values (implicit or otherwise) and correctly updates the debug
info. Importantly, these merged variable values (which may or may not exist as
PHIs, and may or not be represented with dbg.values) are //always// implicitly
defined by the combination of incoming edges and the incoming variable locations
along those edges by virtue of LiveDebugValues existing. Unfortunately, it is
possible to mess with the CFG and remove / move these edges before
LiveDebugValues runs. In this case our debug info model only works when the
merged value is tracked by a dbg.value. Currently, this is only done rigorously
for variables which are A) promoted in the first round of mem2reg and B) are
used after the merge point.

As an example, compile the following source with -O3 -g and step through with a
debugger. You will see parama=5 throughout the function fun which is incorrect -
we expect to see param=20 after the conditional assignment.

    __attribute__((optnone))
    void esc(int* p) {}

    __attribute__((optnone))
    void fluff() {}

    __attribute__((noinline))
    int fun(int parama, int paramb) {
      if (parama)
        parama = paramb;
      fluff();           // DexLabel('s0')
      esc(&parama);
      return 0;
    }

    int main() {
      return fun(5, 20);
    }

1. parama is escaped by esc(&parama) so it is not promoted by
   SROA/mem2reg (failing condition "A" above).
2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of
   dbg.values (tracking the stored SSA values).
3. InstCombine replaces the two stores to parama's alloca (the initial
   parameter register store in entry and the assignment in if.then) with a
   PHI+store in the common sucessor.
4. SimplifyCFG folds the blocks together and converts the PHI to a
   select.

The debug info is not updated to account for the merged value in the successor
prior to SimplifyCFG when it exists as a PHI, or during when it becomes a
select.

As with D89543, which added some dexter tests for escaped locals, the idea is
to build a set of source-level tests which highlights existing issues and
might be useful in evaluating a new debug info model.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D94761
The file was addeddebuginfo-tests/dexter-tests/memvars/unused-merged-value.c
The file was addeddebuginfo-tests/dexter-tests/memvars/inline-escaping-function.c
The file was addeddebuginfo-tests/dexter-tests/memvars/merged-store.c
Commit 172f1f8952c977c0101ba19e6ecb9474aa3bdd4b by caroline.concatto
[AArch64][SVE]Add cost model for vector reduce for scalable vector

This patch computes the cost for vector.reduce<operand> for scalable vectors.
The cost is split into two parts:  the legalization cost and the horizontal
reduction.

Differential Revision: https://reviews.llvm.org/D93639
The file was modifiedllvm/include/llvm/CodeGen/BasicTTIImpl.h
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
The file was addedllvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-vector-reduce.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
Commit 2c4f6be86c14c28243915ab9eb3a2ff1902fee99 by Abhina.Sreeskantharajan
[SystemZ][z/OS] Fix No such file or directory expression error

On z/OS, the following error message is not matched correctly in lit tests. This patch updates the CHECK expression to match the end period successfully.
```
EDC5129I No such file or directory.
```

Differential Revision: https://reviews.llvm.org/D94239
The file was modifiedclang/test/Frontend/stats-file.c