platform/upstream/llvm.git
2 years ago[analyzer] Allow CFG dumps in release builds
Balazs Benics [Mon, 2 May 2022 09:48:52 +0000 (11:48 +0200)]
[analyzer] Allow CFG dumps in release builds

This is a similar commit to D124442, but for CFG dumps.
The binary size diff remained the same demonstrated in that patch.

This time I'm adding tests for demonstrating that all the dump debug
checkers work - even in regular builds without asserts.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D124443

2 years ago[analyzer] Allow exploded graph dumps in release builds
Balazs Benics [Mon, 2 May 2022 09:42:08 +0000 (11:42 +0200)]
[analyzer] Allow exploded graph dumps in release builds

Historically, exploded graph dumps were disabled in non-debug builds.
It was done so probably because a regular user should not dump the
internal representation of the analyzer anyway and the dump methods
might introduce unnecessary binary size overhead.

It turns out some of the users actually want to dump this.

Note that e.g. `LiveExpressionsDumper`, `LiveVariablesDumper`,
`ControlDependencyTreeDumper` etc. worked previously, and they are
unaffected by this change.
However, `CFGViewer` and `CFGDumper` still won't work for a similar
reason. AFAIK only these two won't work after this change.

Addresses #53873

---

**baseline**

| binary | size | size after strip |
| clang | 103M | 83M |
| clang-tidy | 67M | 54M |

**after this change**

| binary | size | size after strip |
| clang | 103M | 84M |
| clang-tidy | 67M | 54M |

CMake configuration:
```
cmake -S llvm -GNinja -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
-DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_USE_LINKER=lld
-DLLVM_ENABLE_DUMP=OFF -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"
-DLLVM_ENABLE_Z3_SOLVER=ON -DLLVM_TARGETS_TO_BUILD="X86"
```
Built by `clang-14.0.0`.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D124442

2 years ago[CostModel][X86] getScalarizationOverhead - handle vXi1 extracts with MOVMSK (pre...
Simon Pilgrim [Mon, 2 May 2022 08:58:35 +0000 (09:58 +0100)]
[CostModel][X86] getScalarizationOverhead - handle vXi1 extracts with MOVMSK (pre-AVX512)

We can quickly extract multiple elements of a bool vector using MOVMSK ops - since we don't know what generated the vXi1, I've been optimistic and assumed we can use PMOVMSKB to extract the maximum number of bools with a single op.

The MOVMSK pattern isn't great for extract+insert round trips as vXi1 type legalization can interfere with this a lot - so this relies on us remaining good at using getScalarizationOverhead properly (and tagging both Insert and Extract modes) for those round trip cases.

The AVX512 KMOV codegen for bool extraction is a bit of a mess so for now I've not included that - the per-element cost is a lot more accurate for current codegen.

2 years ago[analyzer] Fix cast evaluation on scoped enums in ExprEngine
Balazs Benics [Mon, 2 May 2022 08:54:26 +0000 (10:54 +0200)]
[analyzer] Fix cast evaluation on scoped enums in ExprEngine

We ignored the cast if the enum was scoped.
This is bad since there is no implicit conversion from the scoped enum to the corresponding underlying type.

The fix is basically: isIntegralOrEnumerationType() -> isIntegralOr**Unscoped**EnumerationType()

This materialized in crashes on analyzing the LLVM itself using the Z3 refutation.
Refutation synthesized the given Z3 Binary expression (`BO_And` of `unsigned char` aka. 8 bits
and an `int` 32 bits) with the wrong bitwidth in the end, which triggered an assert.

Now, we evaluate the cast according to the standard.

This bug could have been triggered using the Z3 CM according to
https://bugs.llvm.org/show_bug.cgi?id=44030

Fixes #47570 #43375

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D85528

2 years ago[Local] Consider atomic loads from constant global as dead
Nikita Popov [Fri, 22 Apr 2022 08:53:43 +0000 (10:53 +0200)]
[Local] Consider atomic loads from constant global as dead

Per the guidance in
https://llvm.org/docs/Atomics.html#atomics-and-ir-optimization,
an atomic load from a constant global can be dropped, as there can
be no stores to synchronize with. Any write to the constant global
would be UB.

IPSCCP will already drop such loads, but the main helper in Local
doesn't recognize this currently. This is motivated by D118387.

Differential Revision: https://reviews.llvm.org/D124241

2 years ago[mlir][OpenMP] Restrict types for omp.parallel args
Shraiysh Vaishay [Mon, 2 May 2022 05:24:28 +0000 (10:54 +0530)]
[mlir][OpenMP] Restrict types for omp.parallel args

This patch restricts the value of `if` clause expression to an I1 value.
It also restricts the value of `num_threads` clause expression to an I32
value.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D124142

2 years ago[clang-format] Fix a bug that misformats Access Specifier after *[]
owenca [Thu, 28 Apr 2022 01:01:49 +0000 (18:01 -0700)]
[clang-format] Fix a bug that misformats Access Specifier after *[]

Fixes #55132.

Differential Revision: https://reviews.llvm.org/D124589

2 years ago[analyzer][docs] Document alpha.security.cert.pos.34c limitations
Balazs Benics [Mon, 2 May 2022 08:37:23 +0000 (10:37 +0200)]
[analyzer][docs] Document alpha.security.cert.pos.34c limitations

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D124659

2 years ago[analyzer] Fix Static Analyzer g_memdup false-positive
Balazs Benics [Mon, 2 May 2022 08:35:51 +0000 (10:35 +0200)]
[analyzer] Fix Static Analyzer g_memdup false-positive

`g_memdup()` allocates and copies memory, thus we should not assume that
the returned memory region is uninitialized because it might not be the
case.

PS: It would be even better to copy the bindings to mimic the actual
content of the buffer, but this works too.

Fixes #53617

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D124436

2 years ago[ConstantFold] Don't convert getelementptr to ptrtoint+inttoptr
Nikita Popov [Fri, 29 Apr 2022 15:22:54 +0000 (17:22 +0200)]
[ConstantFold] Don't convert getelementptr to ptrtoint+inttoptr

ConstantFolding currently converts "getelementptr i8, Ptr, (sub 0, V)"
to "inttoptr (sub (ptrtoint Ptr), V)". This transform is, taken by
itself, correct, but does came with two issues:

1. It unnecessarily broadens provenance by introducing an inttoptr.
   We generally prefer not to introduce inttoptr during optimization.
2. For the case where V == ptrtoint Ptr, this folds to inttoptr 0,
   which further folds to null. In that case provenance becomes
   incorrect. This has been observed as a real-world miscompile with
   rustc.

We should probably address that incorrect inttoptr 0 fold at some
point, but in either case we should also drop this inttoptr-introducing
fold. Instead, replace it with a fold rooted at
ptrtoint(getelementptr), which seems to cover the original
motivation for this fold (test2 in the changed file).

Differential Revision: https://reviews.llvm.org/D124677

2 years ago[AArch64] Add more comprehensive reverse shuffle costmodel tests. NFC
David Green [Mon, 2 May 2022 08:16:57 +0000 (09:16 +0100)]
[AArch64] Add more comprehensive reverse shuffle costmodel tests. NFC

2 years ago[mlir] support isa/cast/dyn_cast<Operation *>(operation)
Alex Zinenko [Fri, 29 Apr 2022 15:13:24 +0000 (17:13 +0200)]
[mlir] support isa/cast/dyn_cast<Operation *>(operation)

This enables one to write generic code that can be instantiated for both
specific operation classes and the common base class without
specialization. Examples include functions that take/return ops, such
as:

```mlir
template <typename FnTy>
void applyIf(FnTy &&lambda, ...) {
  for (Operation *op : ...) {
    auto specific = dyn_cast<function_traits<FnTy>::template arg_t<0>>(op);
    if (specific)
      lambda(specific);
  }
}
```

that would otherwise need to rely on template specialization to support
lambdas that take specific operations and those that take `Operation *`.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D124675

2 years ago[ArgPromotion][Attributor] Update min-legal-vector-width when do promotion
Phoebe Wang [Mon, 2 May 2022 05:29:34 +0000 (13:29 +0800)]
[ArgPromotion][Attributor] Update min-legal-vector-width when do promotion

X86 codegen uses function attribute `min-legal-vector-width` to select the proper ABI. The intention of the attribute is to reflect user's requirement when they passing or returning vector arguments. So Clang front-end will iterate the vector arguments and set `min-legal-vector-width` to the width of the maximum for both caller and callee.

It is assumed any middle end optimizations won't care of the attribute expect inlining and argument promotion.
- For inlining, we will propagate the attribute of inlined functions because the inlining functions become the newer caller.
- For argument promotion, we check the `min-legal-vector-width` of the caller and callee and refuse to promote when they don't match.

The problem comes from the optimizations' combination, as shown by https://godbolt.org/z/zo3hba8xW. The caller `foo` has two callees `bar` and `baz`. When doing argument promotion, both `foo` and `bar` has the same `min-legal-vector-width`. So the argument was promoted to vector. Then the inlining inlines `baz` to `foo` and updates `min-legal-vector-width`, which results in ABI mismatch between `foo` and `bar`.

This patch fixes the problem by expanding the concept of `min-legal-vector-width` to indicator of functions arguments. That says, any passes touch functions arguments have to set `min-legal-vector-width` to the value reflects the width of vector arguments. It makes sense to me because any arguments modifications are ABI related and should response for the ABI compatibility.

Differential Revision: https://reviews.llvm.org/D123284

2 years ago[flang] Added tests for taskwait and taskyield translation
Shraiysh Vaishay [Mon, 2 May 2022 05:11:46 +0000 (10:41 +0530)]
[flang] Added tests for taskwait and taskyield translation

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D124229

Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
2 years ago[LoopCacheAnalysis] Use stable_sort() to avoid non-deterministic print output
Congzhe Cao [Mon, 2 May 2022 04:49:11 +0000 (00:49 -0400)]
[LoopCacheAnalysis] Use stable_sort() to avoid non-deterministic print output

The print output of loop cache analysis sometimes has a non-deterministic order
and therefore we have been using `CHECK-DAG` in its lit tests. This patch changes
the sorting of LoopCosts to llvm::stable_sort() where we compare loop cost numbers
and sort the loops. In case of the same loop cost numbers, llvm::stable_sort() now
would output a deterministic loop order.

Reviewed By: Meinersbur, fhahn, #loopoptwg

Differential Revision: https://reviews.llvm.org/D124725

2 years ago[clang][preprocessor] Add more macros to target AVR
Ben Shi [Thu, 21 Apr 2022 09:41:42 +0000 (09:41 +0000)]
[clang][preprocessor] Add more macros to target AVR

Reviewed By: MaskRay, aykevl

Differential Revision: https://reviews.llvm.org/D124157

2 years ago[Driver][Ananas] -r: imply -nostdlib like GCC
Brad Smith [Mon, 2 May 2022 04:26:41 +0000 (00:26 -0400)]
[Driver][Ananas] -r: imply -nostdlib like GCC

Similar to D116843 for Gnu.cpp

Reviewed By: zhmu, MaskRay

Differential Revision: https://reviews.llvm.org/D124729

2 years ago[Driver][test] Remove unneeded -no-canonical-prefixes and use preferred --target=
Fangrui Song [Mon, 2 May 2022 03:44:13 +0000 (20:44 -0700)]
[Driver][test] Remove unneeded -no-canonical-prefixes and use preferred --target=

Similar to D119309

2 years ago[compiler-rt][builtins] Add several helper functions for AVR
Ben Shi [Wed, 6 Apr 2022 10:45:50 +0000 (10:45 +0000)]
[compiler-rt][builtins] Add several helper functions for AVR

__mulqi3 : int8 multiplication
__mulhi3 : int16 multiplication
   _exit : golobal terminator

Reviewed By: MaskRay, aykevl

Differential Revision: https://reviews.llvm.org/D123200

2 years ago[gn build] Port 3939e99aae68
LLVM GN Syncbot [Sun, 1 May 2022 22:32:29 +0000 (22:32 +0000)]
[gn build] Port 3939e99aae68

2 years agollvm-reduce: Fix not removing first instruction in MachineBasicBlock
Matt Arsenault [Tue, 19 Apr 2022 13:12:45 +0000 (09:12 -0400)]
llvm-reduce: Fix not removing first instruction in MachineBasicBlock

This had the surprising behavior of using whatever instruction
happened to be first in the block as an anchor point to stick random
implicit defs on. Use a real implicit_def instead.

2 years agollvm-reduce: Introduce new scoring mechanism for MIR reductions
Matt Arsenault [Tue, 19 Apr 2022 21:19:36 +0000 (17:19 -0400)]
llvm-reduce: Introduce new scoring mechanism for MIR reductions

Many MIR reductions benefit from or require increasing the instruction
count. For example, unlike in the IR, you may need to insert a new
instruction to represent an undef. The current instruction reduction
pass works around this by sticking implicit defs on whatever
instruction happens to be first in the entry block block.

Other strategies I've applied manually include breaking instructions
with multiple defs into separate instructions, or breaking large
register defs into multiple subregister defs.

Make up a simple scoring system based on what I generally try to get
rid of first when manually reducing. Counts implicit defs as free
since reduction passes will be introducing them, although they
probably should count for something. It also might make more sense to
have a comparison the two functions, rather than having to compute a
contextless number. This isn't particularly well tested since overall
the MIR support isn't in a place where it is useful on the kinds of
testcases I want to throw at it.

2 years agollvm-reduce: Do not try to delete frame instructions
Matt Arsenault [Mon, 25 Apr 2022 12:58:39 +0000 (08:58 -0400)]
llvm-reduce: Do not try to delete frame instructions

The verifier enforces these appearing as balanced pairs, so just
deleting one has no real chance of producing something valid.

2 years agollvm-reduce: Add pass to reduce IR references from MIR
Matt Arsenault [Tue, 19 Apr 2022 16:10:38 +0000 (12:10 -0400)]
llvm-reduce: Add pass to reduce IR references from MIR

This is typically the first thing I do when reducing a new testcase
until the IR section can be deleted.

2 years ago[RISCV] Lower case the first letter of LowerRISCVMachineOperandToMCOperand. NFC
Fangrui Song [Sun, 1 May 2022 21:13:54 +0000 (14:13 -0700)]
[RISCV] Lower case the first letter of LowerRISCVMachineOperandToMCOperand. NFC

2 years agodoc: update of the adv build doc now that clang is in tree too
Sylvestre Ledru [Sun, 1 May 2022 20:59:36 +0000 (22:59 +0200)]
doc: update of the adv build doc now that clang is in tree too
And be more consistent in the declarations

2 years ago[mlir:PDLInterp] Refactor the implementation of result type inferrence
River Riddle [Tue, 26 Apr 2022 20:38:21 +0000 (13:38 -0700)]
[mlir:PDLInterp] Refactor the implementation of result type inferrence

The current implementation uses a discrete "pdl_interp.inferred_types"
operation, which acts as a "fake" handle to a type range. This op is
used as a signal to pdl_interp.create_operation that types should be
inferred. This is terribly awkward and clunky though:

* This op doesn't have a byte code representation, and its conversion
  to bytecode kind of assumes that it is only used in a certain way. The
  current lowering is also broken and seemingly untested.

* Given that this is a different operation, it gives off the assumption
  that it can be used multiple times, or that after the first use
  the value contains the inferred types. This isn't the case though,
  the resultant type range can never actually be used as a type range.

This commit refactors the representation by removing the discrete
InferredTypesOp, and instead adds a UnitAttr to
pdl_interp.CreateOperation that signals when the created operations
should infer their types. This leads to a much much cleaner abstraction,
a more optimal bytecode lowering, and also allows for better error
handling and diagnostics when a created operation doesn't actually
support type inferrence.

Differential Revision: https://reviews.llvm.org/D124587

2 years ago[SimpleLoopUnswitch] Freeze individual OR/AND operands.
Florian Hahn [Sun, 1 May 2022 19:11:05 +0000 (20:11 +0100)]
[SimpleLoopUnswitch] Freeze individual OR/AND operands.

In some cases, it is not enough to freeze the final AND/OR operation
when chaining a number of invariant conditions together.

After creating a chain of ANDs/ORs, we assume all unswitched operands to
be either true or false. But if any of the operands is poison, the rest
of the operands could have any value after branching on the frozen
condition.

To avoid that, freeze individual operands, if needed. In some cases this
may lead to unnecessary freezes, but it seems required at least for some
cases (see trivial-unswitch-freeze-individual-conditions.ll)

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D124554

2 years ago[VectorCombine] Merge isa<>/cast<> into dyn_cast<>. NFC.
Simon Pilgrim [Sun, 1 May 2022 19:09:05 +0000 (20:09 +0100)]
[VectorCombine] Merge isa<>/cast<> into dyn_cast<>. NFC.

We want to handle the the assert in VectorCombine so avoid the repeated isa/cast code.

2 years ago[Polly] Fix test after D119669.
Michael Kruse [Sun, 1 May 2022 18:32:42 +0000 (13:32 -0500)]
[Polly] Fix test after D119669.

2 years ago[DAG] (style) Break apart if-else chain as they all return
Simon Pilgrim [Sun, 1 May 2022 16:56:54 +0000 (17:56 +0100)]
[DAG] (style) Break apart if-else chain as they all return

2 years ago[clang][dataflow] Optimize flow condition representation
Stanislav Gatev [Mon, 25 Apr 2022 15:23:42 +0000 (15:23 +0000)]
[clang][dataflow] Optimize flow condition representation

Enable efficient implementation of context-aware joining of distinct
boolean values. It can be used to join distinct boolean values while
preserving flow condition information.

Flow conditions are represented as Token <=> Clause iff formulas. To
perform context-aware joining, one can simply add the tokens of flow
conditions to the formula when joining distinct boolean values, e.g:
`makeOr(makeAnd(FC1, Val1), makeAnd(FC2, Val2))`. This significantly
simplifies the implementation of `Environment::join`.

This patch removes the `DataflowAnalysisContext::getSolver` method.
The `DataflowAnalysisContext::flowConditionImplies` method should be
used instead.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D124395

2 years ago[X86] (style) Use auto for dyn_cast<> results
Simon Pilgrim [Sun, 1 May 2022 16:15:18 +0000 (17:15 +0100)]
[X86] (style) Use auto for dyn_cast<> results

2 years ago[X86] (style) Don't use auto for non obvious types
Simon Pilgrim [Sun, 1 May 2022 16:10:21 +0000 (17:10 +0100)]
[X86] (style) Don't use auto for non obvious types

2 years ago[SLPVectorizer] Remove weird unicode character from comment. NFCI.
Simon Pilgrim [Sun, 1 May 2022 15:37:21 +0000 (16:37 +0100)]
[SLPVectorizer] Remove weird unicode character from comment. NFCI.

Whatever it was, Visual Assist really didn't like it....

2 years ago[InstCombine] Add test coverage from D124503
Simon Pilgrim [Sun, 1 May 2022 15:09:23 +0000 (16:09 +0100)]
[InstCombine] Add test coverage from D124503

2 years ago[Coroutines] Regenerate coro-retcon-resume-values.ll
Simon Pilgrim [Sun, 1 May 2022 12:21:55 +0000 (13:21 +0100)]
[Coroutines] Regenerate coro-retcon-resume-values.ll

2 years ago[LoopVectorize][X86] Regenerate invariant-store-vectorization.ll
Simon Pilgrim [Sun, 1 May 2022 12:04:20 +0000 (13:04 +0100)]
[LoopVectorize][X86] Regenerate invariant-store-vectorization.ll

2 years ago[analyzer] Fix return of llvm::StringRef to destroyed std::string
Andrew Ng [Fri, 29 Apr 2022 17:00:33 +0000 (18:00 +0100)]
[analyzer] Fix return of llvm::StringRef to destroyed std::string

This issue was discovered whilst testing with ASAN.

Differential Revision: https://reviews.llvm.org/D124683

2 years ago[CostModel][X86] Check for 'null op' truncations
Simon Pilgrim [Sun, 1 May 2022 11:03:40 +0000 (12:03 +0100)]
[CostModel][X86] Check for 'null op' truncations

If the legalized src/dst types are the same, assume the "truncation" is free.

This fixes some edge cases such as mul lo/hi ops and bool vectors which will get legalized back to legal vector widths

2 years ago[libc++][NFC] Replace _LIBCPP_INLINE_VISIBILTIY and _VSTD in <string>
Nikolas Klauser [Fri, 29 Apr 2022 09:17:58 +0000 (11:17 +0200)]
[libc++][NFC] Replace _LIBCPP_INLINE_VISIBILTIY and _VSTD in <string>

Replace all the instances of `_LIBCPP_INLINE_VISIBILITY` with `_LIBCPP_HIDE_FROM_ABI` and `_VSTD` with `std`.

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D124662

2 years ago[flang] Add one semantic check for implicit interface
PeixinQiao [Sun, 1 May 2022 10:40:17 +0000 (18:40 +0800)]
[flang] Add one semantic check for implicit interface

As Fortran 2018 C1533, a nonintrinsic elemental procedure shall not be
used as an actual argument. The semantic check for implicit iterface is
missed.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D124379

2 years ago[clang-format] Take out common code for parsing blocks NFC
sstwcw [Sun, 1 May 2022 08:39:11 +0000 (08:39 +0000)]
[clang-format] Take out common code for parsing blocks NFC

Differential Revision: https://reviews.llvm.org/D121757

2 years ago[CostModel][X86] Reduce cost of vector selects on SSE2/AVX1 targets
Simon Pilgrim [Sun, 1 May 2022 08:32:14 +0000 (09:32 +0100)]
[CostModel][X86] Reduce cost of vector selects on SSE2/AVX1 targets

Based off the script from D103695, we were exaggerating the cost of the OR(AND(X,M),AND(Y,~M)) expansion using instruction count instead of effective throughput

2 years ago[clang-tidy][NFC] Re-alphabetize the clang tidy release notes
Nathan James [Sun, 1 May 2022 06:41:04 +0000 (07:41 +0100)]
[clang-tidy][NFC] Re-alphabetize the clang tidy release notes

2 years ago[CAPI] Expose CastInst::getCastOpcode in C API
Jack Andersen [Sat, 30 Apr 2022 22:40:04 +0000 (18:40 -0400)]
[CAPI] Expose CastInst::getCastOpcode in C API

Reviewed By: deadalnix

Differential Revision: https://reviews.llvm.org/D91514

2 years ago[NVPTX] Prefix "$L__" for branch label names
Dmitry Vassiliev [Sat, 30 Apr 2022 19:55:20 +0000 (21:55 +0200)]
[NVPTX] Prefix "$L__" for branch label names

A global variable may have the same name as a label, and ptxas does not accept it.
Prefix labels with $L__ to fix this.

Reviewed By: MaskRay, tra

Differential Revision: https://reviews.llvm.org/D119669

2 years ago[LV] Add test for interleaving multiple iterations with call.
Florian Hahn [Sat, 30 Apr 2022 19:43:22 +0000 (20:43 +0100)]
[LV] Add test for interleaving multiple iterations with call.

2 years ago[PhaseOrdering][X86] Use passes="" instead of passes='' so DOS can evaluate the cmd...
Simon Pilgrim [Sat, 30 Apr 2022 18:56:41 +0000 (19:56 +0100)]
[PhaseOrdering][X86] Use passes="" instead of passes='' so DOS can evaluate the cmd lines

Fix regenerating the tests on windows builds

2 years ago[SimpleLoopUnswitch] Freeze trivial conditions if needed.
Florian Hahn [Sat, 30 Apr 2022 18:53:36 +0000 (19:53 +0100)]
[SimpleLoopUnswitch] Freeze trivial conditions if needed.

Trivial unswitching can also introduce new branches on undef/poison.
Freeze the conditions if needed.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D124549

2 years ago[PhaseOrdering][X86] Use passes="default<O3>" instead of passes='default<O3>' so...
Simon Pilgrim [Sat, 30 Apr 2022 18:53:07 +0000 (19:53 +0100)]
[PhaseOrdering][X86] Use passes="default<O3>" instead of passes='default<O3>' so DOS can evaluate the cmd lines

Fix regenerating the tests on windows builds

2 years ago[SLP][X86] extractelement tests - use -mattr=avx2 instead of a -march flag
Simon Pilgrim [Sat, 30 Apr 2022 18:47:03 +0000 (19:47 +0100)]
[SLP][X86] extractelement tests - use -mattr=avx2 instead of a -march flag

2 years ago[LegalizeDAG] Fix TypeSize conversion error when expanding SIGN_EXTEND_INREG
Paul Walker [Sat, 30 Apr 2022 17:58:31 +0000 (18:58 +0100)]
[LegalizeDAG] Fix TypeSize conversion error when expanding SIGN_EXTEND_INREG

SIGN_EXTEND_INREG expansion can trigger a TypeSize error because
"VT.getSizeInBits() == 1" is used to detect for a boolean without
first verifying VT is a scalar.

2 years ago[DAGCombiner] When matching a disguised rotate by constant don't forget to apply...
Craig Topper [Sat, 30 Apr 2022 18:01:55 +0000 (11:01 -0700)]
[DAGCombiner] When matching a disguised rotate by constant don't forget to apply LHSMask/RHSMask.

We try to match as a disguised rotate by constant of these forms
(shl (X | Y), C1) | (srl X, C2) --> (rotl X, C1) | (shl Y, C1)
(shl X, C1) | (srl (X | Y), C2) --> (rotl X, C1) | (srl Y, C2)

We may have also looked through an AND to find the shift. If we
did, we need to apply a mask to the result.

I'll add an AArch64 test and pre-commit it and the RISC-V test
tomorrow.

Fixes PR55201.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D124711

2 years ago[RISCV][AArch64] Pre-commit tests for D124711. NFC
Craig Topper [Sat, 30 Apr 2022 17:59:14 +0000 (10:59 -0700)]
[RISCV][AArch64] Pre-commit tests for D124711. NFC

2 years agoAccept -fno-knr-functions as a driver flag as well
Aaron Ballman [Sat, 30 Apr 2022 17:36:59 +0000 (13:36 -0400)]
Accept -fno-knr-functions as a driver flag as well

Due to a think-o, it was only being accepted as a -cc1 flag. This adds
the proper forwarding from the driver to the frontend and adds test
coverage for the option.

2 years ago[RISCV] Don't getDebugLoc for the end node of MBB iterator
luxufan [Sat, 30 Apr 2022 06:57:10 +0000 (14:57 +0800)]
[RISCV] Don't getDebugLoc for the end node of MBB iterator

Because of shrink wrapping, the block to insert epilog may don't have
instructions (Only debug instructions). And the position to insert may
point to MBB.end() that don't have a DebugLoc. This patch fix this
problem.

The test program was copied from the issue:https://github.com/llvm/llvm-project/issues/53662

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D123679

2 years agoAArch64: modify Swift async frame record storage on Windows
Saleem Abdulrasool [Wed, 27 Apr 2022 03:12:48 +0000 (20:12 -0700)]
AArch64: modify Swift async frame record storage on Windows

The frame layout on Windows differs from that on other platforms. It
will spill the registers in descending numeric value (i.e. x30, x29,
...). Furthermore, the x29, x30 pair is particularly important as it
is used for the fast stack walking. As a result, we cannot simply
insert the Swift async frame record in between the store. To provide
the simplistic search mechanism, always spill the async frame record
prior to the spilled registers.

This was caught by the assertion failure in the frame lowering code when
building the runtime for Windows AArch64.

Fixes: #55058

Differential Revision: https://reviews.llvm.org/D124498
Reviewed By: mstorsjo

2 years agoGeneralize calls to ImplicitlyDefineFunction
Aaron Ballman [Sat, 30 Apr 2022 13:53:49 +0000 (09:53 -0400)]
Generalize calls to ImplicitlyDefineFunction

In C++ and C2x, we would avoid calling ImplicitlyDefineFunction at all,
but in OpenCL mode we would still call the function and have it produce
an error diagnostic. Instead, we now have a helper function to
determine when implicit function definitions are allowed and we use
that to determine whether to call ImplicitlyDefineFunction so that the
behavior is more consistent across language modes.

This changes the diagnostic behavior from telling the users that an
implicit function declaration is not allowed in OpenCL to reporting use
of an unknown identifier and going through typo correction, as done in
C++ and C2x.

2 years ago[MLIR][Presburger] subtraction: add support for divs defined by equalties
Arjun P [Fri, 29 Apr 2022 11:37:13 +0000 (12:37 +0100)]
[MLIR][Presburger] subtraction: add support for divs defined by equalties

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D124668

2 years agoRevert "[msan][libcxx] Enable -fsanitize-memory-param-retval"
Mark de Wever [Sat, 30 Apr 2022 11:17:17 +0000 (13:17 +0200)]
Revert "[msan][libcxx] Enable -fsanitize-memory-param-retval"

This reverts commit beff64ee44acec4e7bfbc2ab165acba7579a6bb7.

The original commit was reviewed as D123979.

This commit caused the libc++ pre-commit CI to fail
https://buildkite.com/llvm-project/libcxx-ci/builds/10483

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D124713

2 years ago[InstCombine] Remove the undef-related workaround code in visitSelectInst
Juneyoung Lee [Tue, 26 Apr 2022 00:57:25 +0000 (09:57 +0900)]
[InstCombine] Remove the undef-related workaround code in visitSelectInst

This patch removes an old hack in visitSelectInst that was written to avoid miscompilation bugs in loop unswitch.
(Added via https://reviews.llvm.org/D35811)

The legacy loop unswitch pass will be removed after D124376, and the new simple loop unswitch pass correctly uses freeze to avoid introducing UB after D124252.

Since the hack is not necessary anymore, this patch removes it.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D124426

2 years agoAdd a pre-commit test for D124426
Juneyoung Lee [Wed, 27 Apr 2022 10:07:32 +0000 (19:07 +0900)]
Add a pre-commit test for D124426

2 years ago[X86] lowerShuffleAsRepeatedMaskAndLanePermute - permit 32-bit sublane permute for...
Simon Pilgrim [Sat, 30 Apr 2022 10:00:28 +0000 (11:00 +0100)]
[X86] lowerShuffleAsRepeatedMaskAndLanePermute - permit 32-bit sublane permute for unary v32i8 cases

Increase the likelihood that we can lower to a permd(pshufb()) pattern, but only after we've attempted with 64-bit sublane permutes first

Fixes #55066

2 years agoReland [clangd] More precisely enable clang warnings through ClangTidy options
Sam McCall [Sat, 30 Apr 2022 09:02:31 +0000 (11:02 +0200)]
Reland [clangd] More precisely enable clang warnings through ClangTidy options

This reverts commit 26c82f3d1de11cdada57e499b63a05d24e18b656.

When tests enable 'Checks: *', we may get extra diagnostics.

2 years agoClangDriverTests:ToolChainTest.cpp: Fix warnings. [-Wsign-compare]
NAKAMURA Takumi [Sat, 30 Apr 2022 08:10:40 +0000 (17:10 +0900)]
ClangDriverTests:ToolChainTest.cpp: Fix warnings. [-Wsign-compare]

EXPECT_EQ(num,num) is aware of signedness, even if rhs is a constant.

2 years ago[RISCV] Add DAGCombine to fold base operation and reduction.
Yeting Kuo [Sun, 27 Mar 2022 11:35:10 +0000 (19:35 +0800)]
[RISCV] Add DAGCombine to fold base operation and reduction.

Transform (<bop> x, (reduce.<bop> vec, splat(neutral_element))) to
(reduce.<bop> vec, splat (x)).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D122563

2 years ago[BOLT][NFC] Reduce Target/{AArch64,X86} dependencies
Amir Ayupov [Sat, 30 Apr 2022 03:37:32 +0000 (20:37 -0700)]
[BOLT][NFC] Reduce Target/{AArch64,X86} dependencies

We don't actually depend on entire X86/AArch64 components that pull in CodeGen,
SelectionDAG etc., just the Desc part with opcode and other definitions.

Note that it doesn't decouple BOLT from these components - we still pull in X86
and AArch64 from top-level llvm-bolt dependencies as we use assembler and
disassembler. It's difficult to reduce these as this requires non-trivial
changes to X86/AArch64 components themselves (e.g. moving out AsmPrinter).

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D124206

2 years ago[RISCV] Fix int16 -> __fp16 conversion code gen
Kito Cheng [Sat, 30 Apr 2022 03:09:29 +0000 (11:09 +0800)]
[RISCV] Fix int16 -> __fp16 conversion code gen

clang emit wrong code sequence for `int16`(`short`) to `__fp16` conversion,
and that should fix the code gen directly is the right way I think,
but I found there is a FIXME comment in clang/Basic/TargetInfo.h say
that's should be removed in future so I think just let swich to using
generic LLVM IR rather than llvm.convert.to.fp16 intrinsics code gen
path is enough.

```
  /// Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used
  /// to convert to and from __fp16.
  /// FIXME: This function should be removed once all targets stop using the
  /// conversion intrinsics.
  virtual bool useFP16ConversionIntrinsics() const {
    return true;
  }
```

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D124509

2 years ago[RISCV] Precommit test for D124509
Kito Cheng [Sat, 30 Apr 2022 03:08:30 +0000 (11:08 +0800)]
[RISCV] Precommit test for D124509

Test case to show the wrong code gen for `int16` -> `__fp16` conversion,
clang just emit a load and store without did conversion in the case,

and another case used for demonstrate the code gen change of `__fp16`
-> `int16`.

Reviewed By: khchen

Differential Revision: https://reviews.llvm.org/D124510

2 years ago[OpenMP] Fix printing commands twice in verbose mode
Joseph Huber [Sat, 30 Apr 2022 03:05:08 +0000 (23:05 -0400)]
[OpenMP] Fix printing commands twice in verbose mode

Summary:
A previous patch merged the command execution and printing into a helper
function. The old printing code wasn't removed causing each to be
printed twice.

2 years ago[compiler-rt][profile][RISCV] Enable profile for RISC-V
Kito Cheng [Thu, 28 Apr 2022 08:38:58 +0000 (16:38 +0800)]
[compiler-rt][profile][RISCV] Enable profile for RISC-V

Profile library are written by standard libraries or POSIX calls depend on target support, so there is no porting effort for the target, we could enable that for both RV32 and RV64, verified on the RV64 platform.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D124599

2 years ago[RISCV] Copy test from mem.ll to mem64.ll for completeness. NFC
Craig Topper [Sat, 30 Apr 2022 01:40:44 +0000 (18:40 -0700)]
[RISCV] Copy test from mem.ll to mem64.ll for completeness. NFC

Add nounwind to both copies.

Addresses post-commit feedback from f91690f7db96aae16425241a17fe6649f5d156b4

2 years ago[RISCV] Don't merge addi into load/store address if addi has a FrameIndex operand.
Craig Topper [Sat, 30 Apr 2022 01:19:05 +0000 (18:19 -0700)]
[RISCV] Don't merge addi into load/store address if addi has a FrameIndex operand.

This fixes a crash from D124231.

We can't fold
  (load (add base, (addi src, off1)), off2)
     -> (load (add base, src), off1+off2)
if the src is a FrameIndex. FrameIndex cannot be the operand of an
add.

There was an immediate==0 check that I think was trying to catch
the common case of FrameIndex addis where the immediate is 0, but
they can also appear in non-zero form. Instead explicitly check
for a FrameIndex operand.

2 years ago[gn build] Port 73417c517644
LLVM GN Syncbot [Sat, 30 Apr 2022 00:44:51 +0000 (00:44 +0000)]
[gn build] Port 73417c517644

2 years ago[RISCV] Remove 'frameindex' from list for ComplexPattern. NFC
Craig Topper [Sat, 30 Apr 2022 00:30:39 +0000 (17:30 -0700)]
[RISCV] Remove 'frameindex' from list for ComplexPattern. NFC

Putting a node in this list allows the node to be used as the root
of an isel pattern that would then call the ComplexPattern. The
usual case is to use the ComplexPattern as the operand of another
operator.

AddrFI is never used as a root operation. frameindex is handled
directly with custom code in RISCVISelDAGToDAG::Select. So adding
frameindex to the list here serves no purpose.

2 years agoRevert "[clangd] More precisely enable clang warnings through ClangTidy options"
Nico Weber [Sat, 30 Apr 2022 00:31:57 +0000 (20:31 -0400)]
Revert "[clangd] More precisely enable clang warnings through ClangTidy options"

This reverts commit 5227be8b6aa0edb2edb0b76e1039a7dd5641c80a.
Broke check-clangd, see comment on https://reviews.llvm.org/D124679

2 years ago[CSSPGO] Turn on priority inlining for probe-only profile
Hongtao Yu [Thu, 28 Apr 2022 18:52:38 +0000 (11:52 -0700)]
[CSSPGO] Turn on priority inlining for probe-only profile

We have seen that the prioirty inliner delivered on-par performance with the old inliner for probe-only CSSPGO profile, as long as without a size budget. I'm turning on the priority inliner for probe-only profile by default.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D124632

2 years ago[SelectionDAG] Pre-commit test for D124696. NFC
Craig Topper [Fri, 29 Apr 2022 20:41:40 +0000 (13:41 -0700)]
[SelectionDAG] Pre-commit test for D124696. NFC

2 years ago[RISCV]Add CTZ Intrinsic for ZBB in Clang
joker881 [Thu, 28 Apr 2022 15:26:19 +0000 (23:26 +0800)]
[RISCV]Add CTZ Intrinsic for ZBB in Clang

Add Intrinsics and test for B extension (updating coming soon (:

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D124348

2 years ago[CSSPGO] Rename ProfileIsCSNested and ProfileIsCSFlat
Hongtao Yu [Thu, 28 Apr 2022 18:31:02 +0000 (11:31 -0700)]
[CSSPGO] Rename ProfileIsCSNested and ProfileIsCSFlat

To be more clear and definitive, I'm renaming `ProfileIsCSFlat` back to `ProfileIsCS` which stands for full context-sensitive flat profiles.  `ProfileIsCSNested` is now renamed to `ProfileIsPreInlined` and is extended to be applicable for CS flat profiles too. More specifically, `ProfileIsPreInlined` is for any kind of profiles (flat or nested) that contain 'ShouldBeInlined' contexts. The flag is encoded in the profile summary section for extbinary profiles and is computed on-the-fly for text profiles.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D122602

2 years ago[HLSL][clang][Driver] Support validator version command line option.
python3kgae [Fri, 15 Apr 2022 23:22:54 +0000 (16:22 -0700)]
[HLSL][clang][Driver] Support validator version command line option.

The DXIL validator version option(/validator-version) decide the validator version when compile hlsl.
The format is major.minor like 1.0.

In normal case, the value of validator version should be got from DXIL validator. Before we got DXIL validator ready for llvm/main, DXIL validator version option is added first to set validator version.

It will affect code generation for DXIL, so it is treated as a code gen option.

A new member std::string DxilValidatorVersion is added to clang::CodeGenOptions.

Then CGHLSLRuntime is added to clang::CodeGenModule.
It is used to translate clang::CodeGenOptions::DxilValidatorVersion into a ModuleFlag under key "dx.valver" at end of clang code generation.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D123884

2 years agoTest commit. Fixed a typo in a comment.
David Kreitzer [Fri, 29 Apr 2022 19:26:13 +0000 (12:26 -0700)]
Test commit. Fixed a typo in a comment.

2 years ago[libc] Add implementations of feof, ferror and clearerr.
Siva Chandra Reddy [Fri, 22 Apr 2022 23:32:42 +0000 (23:32 +0000)]
[libc] Add implementations of feof, ferror and clearerr.

The corresponding _unlocked functions have also been added.

Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D124311

2 years ago[LoopCacheAnalysis] Minor test case update
Congzhe Cao [Fri, 29 Apr 2022 22:36:48 +0000 (18:36 -0400)]
[LoopCacheAnalysis] Minor test case update

Changed the test case in https://reviews.llvm.org/D122857
from using `CHECK` to using `CHECK-DAG` to incorporate
nondeterministic output.

2 years ago[Driver] Support for compressed debug info on Fuchsia
Petr Hosek [Wed, 17 Nov 2021 19:06:03 +0000 (11:06 -0800)]
[Driver] Support for compressed debug info on Fuchsia

Pass the --compress-debug-sections=zlib argument to the linker when
the use of compressed debug info is requested.

Differential Revision: https://reviews.llvm.org/D114115

2 years ago[NVPTX] Add add.cc/addc.cc/sub.cc/subc.cc for i64
Dmitry Vassiliev [Fri, 29 Apr 2022 22:32:22 +0000 (15:32 -0700)]
[NVPTX] Add add.cc/addc.cc/sub.cc/subc.cc for i64

PTX supports those instructions for i64 starting from 4.3.
The patch also marks corresponding DAG nodes legal for both i32 and i64.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D124698

2 years ago[MIPS] Address instruction selection failure for abs.[sd]
Simon Dardis [Thu, 28 Apr 2022 23:55:31 +0000 (00:55 +0100)]
[MIPS] Address instruction selection failure for abs.[sd]

Previously, the choice between the instruction selection of ISD::FABS was
decided at the point of setting the MIPS target lowering operation choice
either `Custom` lowering or `Legal`. This lead to instruction selection
failures as functions could be marked as having no NaNs.

Changing the lowering to always be `Custom` and directly handling the
the cases where MIPS selects the instructions for ISD::FABS resolves
this crash.

Thanks to kray for reporting the issue and to Simon Atanasyan for producing
the reduced test case.

This resolves PR/53722.

Differential Revision: https://reviews.llvm.org/D124651

2 years agoLocationListLookup test case failing on lldb-arm-ubuntu
Jason Molenda [Fri, 29 Apr 2022 22:00:20 +0000 (15:00 -0700)]
LocationListLookup test case failing on lldb-arm-ubuntu

Skip on linux+arm for now until I can try to repo the setup of the
lldb-arm-ubuntu bot.  The name of the binary in argv[0] was not
able to be retrieved here; if the compiler's codegen had it stored
in a caller saved register, because it's not needed at this point,
it may not be retreivable.

2 years agoDecr pc when looking for DWARF loc list entry mid-stack
Jason Molenda [Fri, 29 Apr 2022 21:34:06 +0000 (14:34 -0700)]
Decr pc when looking for DWARF loc list entry mid-stack

When looking for a variable location in a DWARF location list,
we search the list of ranges to find one that includes the pc.
With a function mid-stack, the "pc" is the return pc instead of
the call instruction, and in optimized code this can be another
function or a different basic block (with different variable
locations).  Back up the "pc" value mid-stack to find the correct
location list entry.

Differential Revision: https://reviews.llvm.org/D124597
rdar://63903416

2 years agoRevert "[JumpThreading][NFC][CompileTime] Do not recompute BPI/BFI analyzes"
James Y Knight [Fri, 29 Apr 2022 20:33:08 +0000 (20:33 +0000)]
Revert "[JumpThreading][NFC][CompileTime] Do not recompute BPI/BFI analyzes"

This change has caused non-reproducibility of a self-build of Clang
when using NewPM and providing profile data.

This reverts commit 35f38583d2f2484794f579bed69566b40e732206.

2 years agoThread safety analysis: Don't pass capability kind where not needed (NFC)
Aaron Puchert [Fri, 29 Apr 2022 20:28:51 +0000 (22:28 +0200)]
Thread safety analysis: Don't pass capability kind where not needed (NFC)

If no capability is held, or the capability expression is invalid, there
is obviously no capability kind and so none would be reported.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124132

2 years agoThread safety analysis: Store capability kind in CapabilityExpr
Aaron Puchert [Fri, 29 Apr 2022 20:12:21 +0000 (22:12 +0200)]
Thread safety analysis: Store capability kind in CapabilityExpr

This should make us print the right capability kind in many more cases,
especially when attributes name multiple capabilities of different kinds.

Previously we were trying to deduce the capability kind from the
original attribute, but most attributes can name multiple capabilities,
which could be of different kinds. So instead we derive the kind when
translating the attribute expression, and then store it in the returned
CapabilityExpr. Then we can extract the corresponding capability name
when we need it, which saves us lots of plumbing and almost guarantees
that the name is right.

I didn't bother adding any tests for this because it's just a usability
improvement and it's pretty much evident from the code that we don't
fall back to "mutex" anymore (save for a few cases that I'll address in
a separate change).

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124131

2 years agoThread safety analysis: Store CapabilityExprs in ScopedLockableFactEntry (NFC)
Aaron Puchert [Fri, 29 Apr 2022 20:11:20 +0000 (22:11 +0200)]
Thread safety analysis: Store CapabilityExprs in ScopedLockableFactEntry (NFC)

For now this doesn't make a whole lot of sense, but it will allow us to
store the capability kind in a CapabilityExpr and make sure it doesn't
get lost. The capabilities managed by a scoped lockable can of course be
of different kind, so we'll need to store that per entry.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124128

2 years agoThread safety analysis: Pack CapabilityExpr using PointerIntPair (NFC)
Aaron Puchert [Fri, 29 Apr 2022 20:10:50 +0000 (22:10 +0200)]
Thread safety analysis: Pack CapabilityExpr using PointerIntPair (NFC)

We're storing these quite frequently: FactEntry inherits from
CapabilityExpr, and the FactManager has a vector of such entries.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124127

2 years ago[clangd] More precisely enable clang warnings through ClangTidy options
Sam McCall [Fri, 29 Apr 2022 15:47:20 +0000 (17:47 +0200)]
[clangd] More precisely enable clang warnings through ClangTidy options

clang-tidy's behavior is to add the -W flags, and then map all clang diagnostics
to "clang-diagnostic-foo" pseudo-check-names, then use Checks to filter those.

Previous to this patch, we were handling -W flags but not filtering the
diagnostics, assuming both sets of information encoded the same thing.

However this intersection is nontrivial when diagnostic group hierarchy is
involved. e.g. -Wunused + clang-diagnostic-unused-function should not enable
unused label warnings.

This patch more closely emulates clang-tidy's behavior, while not going to
the extreme of generating tidy check names for all clang diagnostics and
filtering them with regexes.

Differential Revision: https://reviews.llvm.org/D124679

2 years ago[LoopCacheAnalysis] Enable delinearization of fixed sized arrays
Congzhe Cao [Fri, 29 Apr 2022 19:59:48 +0000 (15:59 -0400)]
[LoopCacheAnalysis] Enable delinearization of fixed sized arrays

Currently loop cache cost (LCC) cannot analyze fix-sized arrays
since it cannot delinearize them. This patch adds the capability
to delinearize fix-sized arrays to LCC. Most of the code is ported
from DependenceAnalysis.cpp and some refactoring will be done in a
next patch.

Reviewed By: #loopoptwg, Meinersbur

Differential Revision: https://reviews.llvm.org/D122857

2 years ago[InstCombine] add tests for FP<->int casts; NFC
Sanjay Patel [Fri, 29 Apr 2022 18:34:26 +0000 (14:34 -0400)]
[InstCombine] add tests for FP<->int casts; NFC

This overlaps with at least some existing tests,
but the smaller types should be faster for alive2
to verify. We know that at least one of these is
currently wrong (miscompile) as shown in #55150.

2 years ago[AsmParser] Introduce a new "Argument" abstraction + supporting logic
Chris Lattner [Fri, 29 Apr 2022 00:26:43 +0000 (17:26 -0700)]
[AsmParser] Introduce a new "Argument" abstraction + supporting logic

MLIR has a common pattern for "arguments" that uses syntax
like `%x : i32 {attrs} loc("sourceloc")` which is implemented
in adhoc ways throughout the codebase.  The approach this uses
is verbose (because it is implemented with parallel arrays) and
inconsistent (e.g. lots of things drop source location info).

Solve this by introducing OpAsmParser::Argument and make addRegion
(which sets up BlockArguments for the region) take it.  Convert the
world to propagating this down.  This means that we correctly
capture and propagate source location information in a lot more
cases (e.g. see the affine.for testcase example), and it also
simplifies much code.

Differential Revision: https://reviews.llvm.org/D124649

2 years ago[memprof] Correct comment in test [NFC]
Teresa Johnson [Fri, 29 Apr 2022 19:09:26 +0000 (12:09 -0700)]
[memprof] Correct comment in test [NFC]

Correct comment referring incorrectly to address sanitizer (from which
the memprof tests were originally forked).