SuccessChanges

Summary

  1. [HIP] Fix spack detection (details)
  2. Make `mlir::OpState::operator bool` explicit (details)
  3. [HWASan] Don't build alias mode on non-x86. (details)
  4. [LoopIdiom] 'logical right-shift until zero' ('count active bits') "on steroids" idiom recognition. (details)
  5. [LLDB] Switch from using member_clang_type.GetByteSize() to member_type->GetByteSize() in ParseSingleMember (details)
  6. [NewPM] Add C bindings for new pass manager (details)
  7. Reset the wakeup timeout when we re-enter the continue wait. (details)
  8. Revert "[NewPM] Add C bindings for new pass manager" (details)
  9. [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable (details)
  10. [analyzer] Engine: fix crash with SEH __leave keyword (details)
  11. Merge with mainline. (details)
  12. [lld/mac] Honor REFERENCED_DYAMICALLY, set it on __mh_execute_header (details)
Commit 18cb17ce4cd54b9971550840b6f0b872de0d4c8c by Yaxun.Liu
[HIP] Fix spack detection

Missing or duplicate spack package should not cause error, since
users may only installed llvm/clang package, or users may installed
duplicate HIP package but will use environment variable or compiler
option to choose HIP path.

The message about missing or duplicate spack package is informational,
therefore should be emitted only when -v is specified.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D102556
The file was modifiedclang/test/Driver/rocm-detect.hip (diff)
The file was modifiedclang/lib/Driver/ToolChains/ROCm.h (diff)
The file was modifiedclang/lib/Driver/ToolChains/AMDGPU.cpp (diff)
Commit 43f6e04258aaece5b45c18986e0e6c3e690fa82e by joker.eph
Make `mlir::OpState::operator bool` explicit

This change makes the conversion of an mlir::OpState to bool `explicit`. Idiomatic boolean uses continue to work as before, but questionable implicit uses (e.g. accumulating over a range of OpStates to count "true" states) become ill-formed. This makes the class interface a lilttle less error-prone.

I tested this change on our internal (fairly large) codebase, and only one fix was needed, which was ultimately an improvement of the affected code.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D101989
The file was modifiedmlir/include/mlir/IR/OpDefinition.h (diff)
Commit d97bab65118558ec8376749529338477b5768866 by mascasa
[HWASan] Don't build alias mode on non-x86.

Alias mode is not expected work on non-x86, so don't build it there.
Should fix the aarch64 bot.
The file was modifiedcompiler-rt/lib/hwasan/CMakeLists.txt (diff)
Commit 0633d5ce7bd9339228d301d4b1ee49fbd0a78b56 by lebedev.ri
[LoopIdiom] 'logical right-shift until zero' ('count active bits') "on steroids" idiom recognition.

I think i've added exhaustive test coverage, and i have verified that alive2 is happy with all the tests,
so in principle i'm fine with landing this without review, but just in case..

This adds support for the "count active bits" pattern, i.e.:
```
int countActiveBits(unsigned val) {
    int cnt = 0;
    for( ; (val >> cnt) != 0; ++cnt)
        ;
    return cnt;
}
```
but a somewhat more general one, since that is what i need:
```
int countActiveBits(unsigned val, int start, int off) {
    int cnt;
    for (cnt = start; val >> (cnt + off); cnt++)
        ;
    return cnt;
}
```

I've followed in footstep of 'left-shift until bittest' idiom (D91038),
in the sense that iff the `ctlz` intrinsic is cheap, we'll transform,
regardless of all other factors.

This can have a shocking effect on certain benchmarks:
```
raw.pixls.us-unique/Olympus/XZ-1$ /repositories/googlebenchmark/tools/compare.py -a benchmarks ~/rawspeed/build-{old,new}/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 p1319978.orf
RUNNING: /home/lebedevri/rawspeed/build-old/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 p1319978.orf --benchmark_display_aggregates_only=true --benchmark_out=/tmp/tmp49_28zcm
2021-05-09T01:06:05+03:00
Running /home/lebedevri/rawspeed/build-old/src/utilities/rsbench/rsbench
Run on (32 X 3600.24 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 512 KiB (x16)
  L3 Unified 32768 KiB (x2)
Load Average: 5.26, 6.29, 3.49
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                      Time             CPU   Iterations  CPUTime,s CPUTime/WallTime     Pixels Pixels/CPUTime Pixels/WallTime Raws/CPUTime Raws/WallTime WallTime,s
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
p1319978.orf/threads:32/process_time/real_time_mean          145 ms          145 ms          128   0.145319         0.999981   10.1568M       69.8949M        69.8936M      6.88159       6.88146   0.145322
p1319978.orf/threads:32/process_time/real_time_median        145 ms          145 ms          128   0.145317         0.999986   10.1568M       69.8941M        69.8931M      6.88151       6.88141   0.145319
p1319978.orf/threads:32/process_time/real_time_stddev      0.766 ms        0.766 ms          128   766.586u         15.1302u          0       354.167k        354.098k    0.0348699     0.0348631   766.469u
RUNNING: /home/lebedevri/rawspeed/build-new/src/utilities/rsbench/rsbench --benchmark_counters_tabular=true --benchmark_min_time=0.00000001 --benchmark_repetitions=128 p1319978.orf --benchmark_display_aggregates_only=true --benchmark_out=/tmp/tmpwb9sw2x0
2021-05-09T01:06:24+03:00
Running /home/lebedevri/rawspeed/build-new/src/utilities/rsbench/rsbench
Run on (32 X 3599.95 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 512 KiB (x16)
  L3 Unified 32768 KiB (x2)
Load Average: 4.05, 5.95, 3.43
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                      Time             CPU   Iterations  CPUTime,s CPUTime/WallTime     Pixels Pixels/CPUTime Pixels/WallTime Raws/CPUTime Raws/WallTime WallTime,s
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
p1319978.orf/threads:32/process_time/real_time_mean         99.8 ms         99.8 ms          128  0.0997758         0.999972   10.1568M       101.797M        101.794M      10.0225       10.0222  0.0997786
p1319978.orf/threads:32/process_time/real_time_median       99.7 ms         99.7 ms          128  0.0997165         0.999985   10.1568M       101.857M        101.854M      10.0284       10.0281  0.0997195
p1319978.orf/threads:32/process_time/real_time_stddev      0.224 ms        0.224 ms          128   224.166u          34.345u          0        226.81k        227.231k    0.0223309     0.0223723   224.586u
Comparing /home/lebedevri/rawspeed/build-old/src/utilities/rsbench/rsbench to /home/lebedevri/rawspeed/build-new/src/utilities/rsbench/rsbench
Benchmark                                                               Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------
p1319978.orf/threads:32/process_time/real_time_pvalue                 0.0000          0.0000      U Test, Repetitions: 128 vs 128
p1319978.orf/threads:32/process_time/real_time_mean                  -0.3134         -0.3134           145           100           145           100
p1319978.orf/threads:32/process_time/real_time_median                -0.3138         -0.3138           145           100           145           100
p1319978.orf/threads:32/process_time/real_time_stddev                -0.7073         -0.7078             1             0             1             0

```

Reviewed By: craig.topper, zhuhan0

Differential Revision: https://reviews.llvm.org/D102116
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero-debuginfo.ll (diff)
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (diff)
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/logical-right-shift-until-zero.ll (diff)
Commit 2182eda3062471e2e6994307c46ffcca7e39ecff by Shafik Yaghmour
[LLDB] Switch from using member_clang_type.GetByteSize() to member_type->GetByteSize() in ParseSingleMember

We have a bug in which using member_clang_type.GetByteSize() triggers record
layout and during this process since the record was not yet complete we ended
up reaching a record that had not been layed out yet.
Using member_type->GetByteSize() avoids this situation since it relies on size
from DWARF and will not trigger record layout.

For reference: rdar://77293040

Differential Revision: https://reviews.llvm.org/D102445
The file was modifiedlldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (diff)
Commit cd220a06782c3da13a53de2fdf10d928eef6460c by aeubanks
[NewPM] Add C bindings for new pass manager

This patch contains the bare minimum to run the new Pass Manager from the LLVM-C APIs. It does not feature PGOOptions, PassPlugins or Debugify in its current state. Bugzilla: PR48499

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D102136
The file was addedllvm/include/llvm-c/Transforms/PassBuilder.h
The file was addedllvm/lib/Passes/PassBuilderBindings.cpp
The file was addedllvm/unittests/Passes/PassBuilderBindingsTest.cpp
The file was modifiedllvm/lib/Passes/CMakeLists.txt (diff)
The file was modifiedllvm/unittests/Passes/CMakeLists.txt (diff)
Commit bd5751f3d249ec0798060bd98c07272174c52af0 by jingham
Reset the wakeup timeout when we re-enter the continue wait.

Differential Revision: https://reviews.llvm.org/D102562
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp (diff)
Commit 0b339778722207528ad7299b0fc77314c26efb33 by thakis
Revert "[NewPM] Add C bindings for new pass manager"

This reverts commit cd220a06782c3da13a53de2fdf10d928eef6460c.
Doesn't build.
The file was removedllvm/unittests/Passes/PassBuilderBindingsTest.cpp
The file was removedllvm/include/llvm-c/Transforms/PassBuilder.h
The file was removedllvm/lib/Passes/PassBuilderBindings.cpp
The file was modifiedllvm/unittests/Passes/CMakeLists.txt (diff)
The file was modifiedllvm/lib/Passes/CMakeLists.txt (diff)
Commit 14dfb3831c425c7f22540a2160424224008c257e by aeubanks
[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

These are intended to mimic warnings available in gcc.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D100581
The file was modifiedclang/test/CodeGen/2007-10-30-Volatile.c (diff)
The file was modifiedclang/include/clang/Sema/Sema.h (diff)
The file was modifiedclang/test/SemaCXX/goto.cpp (diff)
The file was modifiedclang/test/CodeGen/builtins-riscv.c (diff)
The file was modifiedclang/test/CodeGen/X86/x86_64-xsave.c (diff)
The file was addedclang/test/SemaCXX/warn-unused-but-set-parameters-cpp.cpp
The file was addedclang/test/SemaCXX/warn-unused-but-set-variables-cpp.cpp
The file was modifiedclang/test/Sema/vector-gcc-compat.c (diff)
The file was modifiedclang/test/Misc/warning-wall.c (diff)
The file was modifiedclang/lib/Sema/SemaDecl.cpp (diff)
The file was modifiedclang/lib/Sema/SemaExpr.cpp (diff)
The file was modifiedclang/test/SemaCXX/shift.cpp (diff)
The file was modifiedclang/test/CodeGen/builtins-arm.c (diff)
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp (diff)
The file was modifiedclang/test/SemaCXX/sizeless-1.cpp (diff)
The file was modifiedclang/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp (diff)
The file was modifiedclang/test/SemaObjC/foreach.m (diff)
The file was modifiedclang/test/Sema/shift.c (diff)
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td (diff)
The file was modifiedclang/include/clang/Basic/DiagnosticGroups.td (diff)
The file was modifiedclang/test/Sema/vector-gcc-compat.cpp (diff)
The file was modifiedclang/test/CodeGen/X86/x86_32-xsave.c (diff)
The file was addedclang/test/Sema/warn-unused-but-set-parameters.c
The file was addedclang/test/Sema/warn-unused-but-set-variables.c
The file was modifiedclang/test/FixIt/fixit.cpp (diff)
Commit ebcf030efc5ef149e423f8fa2ca705b590a129ed by balazs.benics
[analyzer] Engine: fix crash with SEH __leave keyword

MSVC has a `try-except` statement.
This statement could containt a `__leave` keyword, which is similar to
`goto` to the end of the try block. The semantic of this keyword is not
implemented.

We should at least parse such code without crashing.

https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement?view=msvc-160

Patch By: AbbasSabra!

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D102280
The file was addedclang/test/Analysis/ms-seh.cpp
The file was modifiedclang/lib/StaticAnalyzer/Core/CoreEngine.cpp (diff)
Commit 648f34a2840b75f4081884052f2ccb11f62f8209 by clattner
Merge with mainline.

Differential Revision: https://reviews.llvm.org/D102636
The file was addedmlir/test/Transforms/canonicalize-td.mlir
The file was modifiedmlir/include/mlir/Transforms/FoldUtils.h (diff)
The file was modifiedmlir/docs/PatternRewriter.md (diff)
The file was modifiedmlir/include/mlir/Transforms/Passes.td (diff)
The file was modifiedmlir/lib/Transforms/Utils/FoldUtils.cpp (diff)
The file was modifiedmlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp (diff)
The file was modifiedmlir/lib/Transforms/Canonicalizer.cpp (diff)
The file was modifiedmlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h (diff)
Commit 4a12248ee27631c86c2c29d203b22599339ced92 by thakis
[lld/mac] Honor REFERENCED_DYAMICALLY, set it on __mh_execute_header

Has the effect that `__mh_execute_header` stays in the symbol table of
outputs even after running `strip` on the output. I don't know if that's
important for anything -- my motivation for the patch is just is to make
the output more similar to ld64.

(Corresponds to symbolTableInAndNeverStrip in ld64.)

Differential Revision: https://reviews.llvm.org/D102619
The file was modifiedlld/MachO/InputFiles.cpp (diff)
The file was modifiedlld/MachO/SymbolTable.cpp (diff)
The file was modifiedlld/test/MachO/stabs.s (diff)
The file was modifiedlld/MachO/MergedOutputSection.cpp (diff)
The file was modifiedlld/MachO/UnwindInfoSection.cpp (diff)
The file was modifiedlld/MachO/Symbols.h (diff)
The file was modifiedlld/MachO/SyntheticSections.cpp (diff)
The file was modifiedlld/test/MachO/symtab.s (diff)
The file was modifiedlld/MachO/Driver.cpp (diff)
The file was modifiedlld/MachO/SymbolTable.h (diff)
The file was addedlld/test/MachO/referenced-dynamically.s