Commit Graph

374391 Commits

Author SHA1 Message Date
Jessica Paquette 40d1fb2229 [AArch64][GlobalISel] Swap select operands when inverting condition code
This was not obvious when reading the imported tablegen patterns in
AArch64GenDAGISel.

Update select-select.mir.
2020-12-08 14:17:26 -08:00
Anna Thomas 29356e3279 [ScalarizeMaskedMemIntrin] Add new PM support
This patch adds new PM support for the pass and the pass can be now used
during middle-end transforms. The old pass is remamed to
ScalarizeMaskedMemIntrinLegacyPass.

Reviewed-By: skatkov, aeubanks
Differential Revision: https://reviews.llvm.org/D92743
2020-12-08 17:15:22 -05:00
Arthur O'Dwyer 1968804ac7 [libc++] Add _VSTD:: qualifications to ADL-proof <algorithm>.
Relevant blog post: https://quuxplusone.github.io/blog/2019/09/26/uglification-doesnt-stop-adl/

Differential Revision: https://reviews.llvm.org/D92776
2020-12-08 17:05:38 -05:00
Arthur O'Dwyer 35c3b53943 [libc++] ADL-proof __libcpp_is_nothrow_constructible.
The GCC C++20 buildbot hit this ADL call; Clang doesn't,
presumably because it uses a compiler builtin instead of
this codepath in <type_traits>.
https://buildkite.com/llvm-project/libcxx-ci/builds/674
2020-12-08 17:05:38 -05:00
Matt Morehouse 483fb33360 [DFSan] Add pthread and other functions to ABI list.
The non-pthread functions are all clear discard functions.

Some of the pthread ones could clear shadow, but aren't worth writing
custom wrappers for.  I can't think of any reasonable scenario where we
would pass tainted memory to these pthread functions.

Reviewed By: stephan.yichao.zhao

Differential Revision: https://reviews.llvm.org/D92877
2020-12-08 13:55:35 -08:00
Arthur Eubanks 3900f3f18c Pin -loop-reduce to legacy PM
LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll).
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.

We'll delay figuring these issues out until later.

This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D92796
2020-12-08 13:48:23 -08:00
Jessica Paquette 21308c2b4c [AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops
`TryFoldBinOpIntoSelect` didn't have a check for `Optimized`, meaning you could
end up folding twice. (e.g. a select with a G_ADD on the true side, and a G_SUB
on the false side)

Add in the missing `if` and a test.
2020-12-08 13:47:08 -08:00
Duncan P. N. Exon Smith b85c6e5bcd ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry
Simplify the DenseMapInfo for `EditEntry` by migrating from
`FoldingSetNodeID` to `llvm::hash_combine`. Besides the cleanup, this
reduces the diff for a future patch which changes the type of one of the
fields.

There should be no real functionality change here, although I imagine
the hash value will churn since its a different hashing infrastructure.

Differential Revision: https://reviews.llvm.org/D92630
2020-12-08 13:46:21 -08:00
Arthur Eubanks eca13e995c [NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM
Codegen-specific passes are being ported to the NPM. Rename for better
clarity and note that ported passes that fully work with the NPM should
be removed from these lists.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D92818
2020-12-08 13:38:56 -08:00
Kazushi (Jam) Marukawa 95ea50e4ad [VE] Correct LVLGen (LVL instruction insert pass)
SX Aurora VE uses an intermediate representation similar to VP as its MIR.
VE itself uses invidiual VL register as its own vector length register at
the hardware level.  So, LLVM needs to insert load VL (LVL) instruction just
before vector instructions if the value of VL is changed.  This LVLGen pass
generates LVL instructions for such purpose.  Previously, a bug is pointed
out in D91416.  This patch correct this bug and add a regression test.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D92716
2020-12-09 06:33:53 +09:00
Fangrui Song 85c18d3521 [Driver] Add -gno-split-dwarf which can disable debug fission
Currently when -gsplit-dwarf is specified (could be buried in a build system),
there is no convenient way to cancel debug fission without affecting the debug
information amount (all of -g0, -g1 -fsplit-dwarf-inlining and -gline-directives-only
can, but they affect the debug information amount).

Reviewed By: #debug-info, dblaikie

Differential Revision: https://reviews.llvm.org/D92809
2020-12-08 13:24:59 -08:00
Siva Chandra Reddy ab3cbe4bc0 [libc] Raise x87 exceptions by synchronizing with "fwait".
Couple of helper functions enableExcept and disableExcept have been
added. In a later round, they will be used to implemented the GNU
extension functions feenableexcept and fedisableexcept.

Differential Revision: https://reviews.llvm.org/D92821
2020-12-08 13:16:19 -08:00
Saleem Abdulrasool b13f741511 APINotes: add bitcode format schema definitions
This adds the bitcode format schema required for serialization of the
YAML data to a binary format.  APINotes are pre-compiled and re-used in
the binary format from the frontend.  These definitions provide the data
layout representation enabling writing (and eventually) reading of the
data in bitcode format.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D91997
Reviewed By: Gabor Marton
2020-12-08 21:15:41 +00:00
Saleem Abdulrasool 939c8f676c Bitcode: add some convenience helpers for streaming bitcode
This adds a set of metaprogramming helpers to help define records and
serialize them out.  This is motivated by API Notes which use the
bitcode format to serialize out a binary representation of the data.
These helpers are generically useful though and could help simplify some
of the existing bitcode consumers as well.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D88582
2020-12-08 21:15:41 +00:00
Fangrui Song 843f2dbf00 [Driver] Don't make -gsplit-dwarf imply -g2
RFC: http://lists.llvm.org/pipermail/cfe-dev/2020-May/065430.html
Agreement from GCC: https://sourceware.org/pipermail/gcc-patches/2020-May/545688.html

g_flags_Group options generally don't affect the amount of debugging
information. -gsplit-dwarf is an exception. Its order dependency with
other gN_Group options make it inconvenient in a build system:

* -g0 -gsplit-dwarf -> level 2
   -gsplit-dwarf "upgrades" the amount of debugging information despite
   the previous intention (-g0) to drop debugging information
* -g1 -gsplit-dwarf -> level 2
  -gsplit-dwarf "upgrades" the amount of debugging information.
* If we have a higher-level -gN, -gN -gsplit-dwarf will supposedly decrease the
  amount of debugging information. This happens with GCC -g3.

The non-orthogonality has confused many users. GCC 11 will change the semantics
(-gsplit-dwarf no longer implies -g2) despite the backwards compatibility break.
This patch matches its behavior.

New semantics:

* If there is a g_Group, allow split DWARF if useful
  (none of: -g0, -gline-directives-only, -g1 -fno-split-dwarf-inlining)
* Otherwise, no-op.

To restore the original behavior, replace -gsplit-dwarf with -gsplit-dwarf -g.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D80391
2020-12-08 13:14:34 -08:00
Florian Hahn 4c69b1b98a
[AArch64] Fix rottype use in complex instr defs.
It seems like the order here is wrong. Types like i32 do not take any
arguments.

Currently this is not a problem, because the patterns are not actually
used with any nodes, but will fail once it is used with real ISD nodes.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D91345
2020-12-08 21:11:33 +00:00
Harald van Dijk 29c8ea6f1a
[X86] Handle localdynamic TLS model in x32 mode
D92346 added TLS_(base_)addrX32 to handle TLS in x32 mode, but missed the
different TLS models. This diff fixes the logic for the local dynamic model
where `RAX` was used when `EAX` should be, and extends the tests to cover
all four TLS models.

Fixes https://bugs.llvm.org/show_bug.cgi?id=26472.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D92737
2020-12-08 21:06:00 +00:00
Duncan P. N. Exon Smith 51f3432f4b Frontend: Clarify logic for using the preamble in ASTUnit::CodeComplete, almost NFC
Clarify the logic for using the preamble (and overriding the main file
buffer) in `ASTUnit::CodeComplete` by factoring out a couple of lambdas
(`getUniqueID` and `hasSameUniqueID`).  While refactoring the logic,
hoist the check for `Line > 1` and locally check if the filenames are
equal (both to avoid unnecessary `stat` calls) and skip copying out the
filenames to `std::string`.

Besides fewer calls to `stat`, there's no functionality change here.

Differential Revision: https://reviews.llvm.org/D91296
2020-12-08 12:52:17 -08:00
Louis Dionne a65dc08d10 [libc++] Implement missing feature-test macro __cpp_lib_shared_ptr_arrays
This was forgotten when we implemented support for arrays in std::shared_ptr
in https://reviews.llvm.org/D62259.
2020-12-08 15:46:45 -05:00
Louis Dionne 3e46b3a188 [libc++] NFC: Indent feature-test macro script consistently 2020-12-08 15:42:57 -05:00
Nathan James 27553933a8 [clang-tidy] Add support for diagnostics with no location
Add methods for emitting diagnostics with no location as well as a special diagnostic for configuration errors.
These show up in the errors as [clang-tidy-config].
The reason to use a custom name rather than the check name is to distinguish the error isn't the same category as the check that reported it.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D91885
2020-12-08 20:29:31 +00:00
Austin Kerbow 4aa842a800 [AMDGPU] Add new pseudos for indirect addressing with VGPR Indexing
It is possible for copies or spills to be inserted in the middle of indirect
addressing sequences which use VGPR indexing. Spills to accvgprs could be
effected by the indexing mode.

Add new pseudo instructions that are expanded after register allocation to avoid
the problematic spill or copy placement.

Differential Revision: https://reviews.llvm.org/D91048
2020-12-08 12:24:12 -08:00
Craig Topper 98bca0a605 [RISCV] Add isel patterns for SBCLRI/SBSETI/SBINVI(W) instruction
We can use these instructions for single bit immediates that are too large for ANDI/ORI/CLRI.

The _10 test cases are to make sure that we still use ANDI/ORI/CLRI for small immediates.

Differential Revision: https://reviews.llvm.org/D92262
2020-12-08 12:22:40 -08:00
LLVM GN Syncbot abd80ac9b8 [gn build] Port 39431e479f 2020-12-08 20:15:45 +00:00
LLVM GN Syncbot bf14979e34 [gn build] Port 1821265db6 2020-12-08 20:15:44 +00:00
Valentin Clement b53115b6c8 [flang][openacc] Avoid use of init, shutdown and set in compute construct
init, shutdown and set directive are not allowed in compute construct.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D92443
2020-12-08 15:14:44 -05:00
Roman Lebedev 39431e479f
[clang-tidy] Introduce misc No Integer To Pointer Cast check
While casting an (integral) pointer to an integer is obvious - you just get
the integral value of the pointer, casting an integer to an (integral) pointer
is deceivingly different. While you will get a pointer with that integral value,
if you got that integral value via a pointer-to-integer cast originally,
the new pointer will lack the provenance information from the original pointer.

So while (integral) pointer to integer casts are effectively no-ops,
and are transparent to the optimizer, integer to (integral) pointer casts
are *NOT* transparent, and may conceal information from optimizer.

While that may be the intention, it is not always so. For example,
let's take a look at a routine to align the pointer up to the multiple of 16:
The obvious, naive implementation for that is:

```
  char* src(char* maybe_underbiased_ptr) {
    uintptr_t maybe_underbiased_intptr = (uintptr_t)maybe_underbiased_ptr;
    uintptr_t aligned_biased_intptr = maybe_underbiased_intptr + 15;
    uintptr_t aligned_intptr = aligned_biased_intptr & (~15);
    return (char*)aligned_intptr; // warning: avoid integer to pointer casts [misc-no-inttoptr]
  }
```

The check will rightfully diagnose that cast.

But when provenance concealment is not the goal of the code, but an accident,
this example can be rewritten as follows, without using integer to pointer cast:

```
  char*
  tgt(char* maybe_underbiased_ptr) {
      uintptr_t maybe_underbiased_intptr = (uintptr_t)maybe_underbiased_ptr;
      uintptr_t aligned_biased_intptr = maybe_underbiased_intptr + 15;
      uintptr_t aligned_intptr = aligned_biased_intptr & (~15);
      uintptr_t bias = aligned_intptr - maybe_underbiased_intptr;
      return maybe_underbiased_ptr + bias;
  }
```

See also:
* D71499
* [[ https://www.cs.utah.edu/~regehr/oopsla18.pdf | Juneyoung Lee, Chung-Kil Hur, Ralf Jung, Zhengyang Liu, John Regehr, and Nuno P. Lopes. 2018. Reconciling High-Level Optimizations and Low-Level Code in LLVM. Proc. ACM Program. Lang. 2, OOPSLA, Article 125 (November 2018), 28 pages. ]]

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D91055
2020-12-08 22:55:13 +03:00
Chih-Ping Chen 1f67247eea [DebugInfo] Add handling of stringLengthExp operand of DIStringType.
This patch makes DWARF writer emit DW_AT_string_length using
the stringLengthExp operand of DIStringType.

This is part of the effort to add debug info support for
Fortran deferred length strings.

Also updated the tests to exercise the change.

Differential Revision: https://reviews.llvm.org/D92412
2020-12-08 14:49:59 -05:00
Arthur Eubanks dee1e6ac42 [llvm-lto2] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D92870
2020-12-08 11:43:19 -08:00
Raphael Isemann a2c157eb3e [cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build
The LLVM_ENABLE_MODULES builds currently randomly fail due depending on the
headers generated by the intrinsics_gen target, but the current dependency only model
the non-modules dependencies:

```
While building module 'LLVM_ExecutionEngine' imported from llvm-project/llvm/lib/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.cpp:13:
While building module 'LLVM_intrinsic_gen' imported from llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:17:
In file included from <module-includes>:1:
In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:
llvm/include/llvm/IR/Attributes.h:75:14: fatal error: 'llvm/IR/Attributes.inc' file not found
    #include "llvm/IR/Attributes.inc"
             ^~~~~~~~~~~~~~~~~~~~~~~~
```

Depending on whether intrinsics_gen runs before compiling Orc/Shared files we either fail or include an outdated Attributes.inc
in module builds. The Clang modules require these additional dependencies as including/importing one module requires all
includes headers by that module to be parsable.

Differential Revision: https://reviews.llvm.org/D92873
2020-12-08 20:41:35 +01:00
Valentin Clement d553243fe4 [flang][openacc] Update reference to OpenACC 3.1 specification
Update all reference from the specification to the new OpenACC 3.1
document.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D92120
2020-12-08 14:36:38 -05:00
Arthur Eubanks bf30d7de76 [gn build] Move ScalarizeMaskedMemIntrin.cpp 2020-12-08 11:33:45 -08:00
Craig Topper fb5b611af9 [RISCV] Detect more errors when parsing vsetvli in the assembler
-Reject an "mf1" lmul
-Make sure tail agnostic is exactly "tu" or "ta" not just that it starts with "tu" or "ta"
-Make sure mask agnostic is exactly "mu" or "ma" not just that it starts with "mu" or "ma"

Differential Revision: https://reviews.llvm.org/D92805
2020-12-08 11:25:39 -08:00
Craig Topper 88e58939dc [RISCV] When parsing vsetvli in the assembler, use StringRef::getAsInteger instead of APInt's string constructor
APInt's string constructor asserts on error. Since this is the parser and we don't yet know if the string is a valid integer we shouldn't use that.

Instead use StringRef::getAsInteger which returns a bool to indicate success or failure.

Since we no longer need APInt, use 'unsigned' instead.

Differential Revision: https://reviews.llvm.org/D92801
2020-12-08 11:25:39 -08:00
Masoud Ataei fc750f609d [PPC] Fixing a typo in altivec.h. Commenting out an unnecessary macro 2020-12-08 19:21:02 +00:00
Valentin Clement c823d74914 [flang][openacc] Add missing loop construct restriction and validity tests
Add restriction on loop construct associated with DO CONCURRENT. Add couple of tests to ensure
clause validity checks.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D92533
2020-12-08 14:12:12 -05:00
Adam Czachorowski 3c5bed734f [clangd] ExpandAutoType: Do not offer code action on lambdas.
We can't expand lambda types anyway. Now we simply not offer the code
action instead of showing it and then returning an error in apply().

Differential Revision: https://reviews.llvm.org/D92847
2020-12-08 20:03:16 +01:00
Jessica Paquette 5b5d3fa9d9 [AArch64][GlobalISel] Fold G_SELECT cc, %t, (G_ADD %x, 1) -> CSINC %t, %x, cc
This implements

```
G_SELECT cc, %true, (G_ADD %x, 1) -> CSINC %true, %x, cc
G_SELECT cc, (G_ADD %x, 1), %false -> CSINC %x, %false, inv_cc
```

Godbolt example: https://godbolt.org/z/eoPqKq

Differential Revision: https://reviews.llvm.org/D92868
2020-12-08 10:53:37 -08:00
Matt Morehouse 3bd2ad5a08 [DFSan] Add several math functions to ABI list.
These are all straightforward functional entries.

Reviewed By: stephan.yichao.zhao

Differential Revision: https://reviews.llvm.org/D92791
2020-12-08 10:51:05 -08:00
Yuriy Chernyshov b526d87618 [libc++] Add std::hash<char8_t> specialization if char8_t is enabled
Differential Revision: https://reviews.llvm.org/D92325
2020-12-08 13:46:18 -05:00
Jessica Paquette cd9a52b99e [AArch64][GlobalISel] Fold binops on the true side of G_SELECT
This implements the following folds:

```
G_SELECT cc, (G_SUB 0, %x), %false -> CSNEG %x, %false, inv_cc
G_SELECT cc, (G_XOR x, -1), %false -> CSINV %x, %false, inv_cc
```

This is similar to the folds introduced in
5bc0bd05e6.

In 5bc0bd05e6 I mentioned that we may prefer to do
this in AArch64PostLegalizerLowering.

I think that it's probably better to do this in the selector. The way we select
G_SELECT depends on what register banks end up being assigned to it. If we did
this in AArch64PostLegalizerLowering, then we'd end up checking *every* G_SELECT
to see if it's worth swapping operands. Doing it in the selector allows us to
restrict the optimization to only relevant G_SELECTs.

Also fix up some comments in `TryFoldBinOpIntoSelect` which are kind of
confusing IMO.

Example IR: https://godbolt.org/z/3qPGca

Differential Revision: https://reviews.llvm.org/D92860
2020-12-08 10:42:59 -08:00
Jessica Paquette ce199667f6 [AArch64][GlobalISel] Don't explicitly write to the zero register in emitCMN
This case was missed in 78ccb0359d.

Differential Revision: https://reviews.llvm.org/D92438
2020-12-08 10:42:05 -08:00
Nuno Lopes 3c01af9aee DenseMap: fix build with clang in C++20 mode
clang was complaing about this code:
llvm/include/llvm/IR/PassManager.h:715:17: error: ISO C++20 considers use of overloaded operator '!=' to be ambiguous despite there being a unique best viable function with non-reversed arguments [-Werror,-Wambiguous-reversed-operator]
      if (IMapI != IsResultInvalidated.end())
          ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
llvm/include/llvm/ADT/DenseMap.h:1253:8: note: candidate function with non-reversed arguments
  bool operator!=(const ConstIterator &RHS) const {
       ^
llvm/include/llvm/ADT/DenseMap.h:1246:8: note: ambiguous candidate function with reversed arguments
  bool operator==(const ConstIterator &RHS) const {
       ^

The warning is triggered when the DenseMapIterator (lhs) is not const and so
the == operator is applied to different types on lhs/rhs.
Using a template allows the function to be available for both const/non-const
iterator types and gets rid of the warning
2020-12-08 18:39:31 +00:00
Jez Ng 78976bf3da [lld-macho] Support parsing of bitcode within archives
Also error out if we find anything other than an object or bitcode file
in the archive.

Note that we were previously inserting the symbols and sections of the
unpacked ObjFile into the containing ArchiveFile. This was actually
unnecessary -- we can just insert the ObjectFile (or BitcodeFile) into
the `inputFiles` vector. This is the approach taken by LLD-ELF.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D92539
2020-12-08 10:34:32 -08:00
Jez Ng 7b007ac080 [lld-macho][nfc] Move some methods from InputFile to ObjFile
Additionally:
1. Move the helper functions in InputSection.h below the definition of
   `InputSection`, so the important stuff is on top
2. Remove unnecessary `explicit`

Reviewed By: #lld-macho, compnerd

Differential Revision: https://reviews.llvm.org/D92453
2020-12-08 10:34:32 -08:00
Eugene Zhulenev 94e645f9cc [mlir] Async: Add numWorkerThreads argument to createAsyncParallelForPass
Add an option to pass the number of worker threads to select the number of async regions for parallel for transformation.
```
std::unique_ptr<OperationPass<FuncOp>> createAsyncParallelForPass(int numWorkerThreads);
```

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D92835
2020-12-08 10:30:14 -08:00
peter klausler 4fede8bc8a [flang] Implement derived type description table encoding
Define Fortran derived types that describe the characteristics
of derived types, and instantiations of parameterized derived
types, that are of relevance to the runtime language support
library.  Define a suite of corresponding C++ structure types
for the runtime library to use to interpret instances of the
descriptions.

Create instances of these description types in Semantics as
static initializers for compiler-created objects in the scopes
that define or instantiate user derived types.

Delete obsolete code from earlier attempts to package runtime
type information.

Differential Revision: https://reviews.llvm.org/D92802
2020-12-08 10:26:58 -08:00
Craig Topper 3e86fbc971 [RISCV] Replace custom isel code for RISCVISD::READ_CYCLE_WIDE with isel pattern
This node returns 2 results and uses a chain. As long as we use a DAG as part of the pseudo instruction definition where we can use the "set" operator, it looks like tablegen can handle use a pattern for this without a problem. I believe the original implementation was copied from PowerPC.

This also fixes the pseudo instruction so that it is marked as having side effects to match the definition of CSRRS and the RV64 instruction. And we don't need to explicitly clear mayLoad/mayStore since those can be inferred now.

Differential Revision: https://reviews.llvm.org/D92786
2020-12-08 10:23:37 -08:00
Yuanfang Chen 1821265db6 [Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass timing aggregation
Currently, -ftime-report + new pass manager emits one line of report for each
pass run. This potentially causes huge output text especially with regular LTO
or large single file (Obeserved in private tests and was reported in D51276).
The behaviour of -ftime-report + legacy pass manager is
emitting one line of report for each pass object which has relatively reasonable
text output size. This patch adds a flag `-ftime-report=` to control time report
aggregation for new pass manager.

The flag is for new pass manager only. Using it with legacy pass manager gives
an error. It is a driver and cc1 flag. `per-pass` is the new default so
`-ftime-report` is aliased to `-ftime-report=per-pass`. Before this patch,
functionality-wise `-ftime-report` is aliased to `-ftime-report=per-pass-run`.

* Adds an boolean variable TimePassesHandler::PerRun to control per-pass vs per-pass-run.
* Adds a new clang CodeGen flag CodeGenOptions::TimePassesPerRun to work with the existing CodeGenOptions::TimePasses.
* Remove FrontendOptions::ShowTimers, its uses are replaced by the existing CodeGenOptions::TimePasses.
* Remove FrontendTimesIsEnabled (It was introduced in D45619 which was largely reverted.)

Differential Revision: https://reviews.llvm.org/D92436
2020-12-08 10:13:19 -08:00
Eric Seidel c6348e8c95 cppcoreguidelines Narrowing Conversions Check: detect narrowing conversions involving typedefs
The check 'cppcoreguidelines-narrowing-conversions' does not detect conversions
involving typedef. This notably includes the standard fixed-width integer types
like int32_t, uint64_t, etc. Now look through the typedefs at the desugared type.
2020-12-08 13:10:41 -05:00