platform/upstream/llvm.git
2 years ago[lldb] Fix AppleObjCRuntime log channels
Jonas Devlieghere [Tue, 15 Mar 2022 21:21:10 +0000 (14:21 -0700)]
[lldb] Fix AppleObjCRuntime log channels

The log channel was changed from Types to Commands in
a007a6d84471bb956abe10974cac3066799f583f:

-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+    Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

2 years ago[flang] Fix intrinsic entry
Valentin Clement [Tue, 15 Mar 2022 21:40:11 +0000 (22:40 +0100)]
[flang] Fix intrinsic entry

2 years ago[flang] Lower random_[init|number|seed] intrinsics
Valentin Clement [Tue, 15 Mar 2022 21:29:06 +0000 (22:29 +0100)]
[flang] Lower random_[init|number|seed] intrinsics

Thsi patch add the infrastructure to lower the random related
intrinsics:

- `random_init`
- `random_number`
- `random_seed`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[sanitizer] Always initialize the regex in the regcomp() interceptor
Tavian Barnes [Tue, 15 Mar 2022 21:23:02 +0000 (14:23 -0700)]
[sanitizer] Always initialize the regex in the regcomp() interceptor

When regcomp() fails, the same regex_t* should be passed to regerror()
for potentially better error messages.  But doing that with msan would
report a use-of-uninitialized-value.

Fixes https://github.com/google/sanitizers/issues/1496

Reviewed By: vitalybuka

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

2 years ago[flang] Lower min|max intrinsics
Valentin Clement [Tue, 15 Mar 2022 21:18:45 +0000 (22:18 +0100)]
[flang] Lower min|max intrinsics

This patch adds lowering for the following intrinsics:
- `max`
- `maxloc`
- `maxval`
- `minloc`
- `minval`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years agoX86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST
Matthias Braun [Wed, 9 Mar 2022 23:50:20 +0000 (15:50 -0800)]
X86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST

Optimize a pattern where a sequence of 8/16 or 32 bits is tested for
zero: LLVM normalizes this towards and `AND` with mask which is usually
good, but does not work well on X86 when the mask does not fit into a
64bit register. This DagToDAG peephole transforms sequences like:

```
movabsq $562941363486720, %rax # imm = 0x1FFFE00000000
testq %rax, %rdi
```

to

```
shrq $33, %rdi
testw %di, %di
```

The result has a shorter encoding and saves a register if the tested
value isn't used otherwise.

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

2 years agoAdd tests for D121320
Matthias Braun [Wed, 9 Mar 2022 19:10:06 +0000 (11:10 -0800)]
Add tests for D121320

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

2 years ago[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in...
Louis Dionne [Thu, 3 Mar 2022 18:39:12 +0000 (13:39 -0500)]
[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite

This should make CI consistent on all the compilers we support. Most of
this patch is working around various warnings emitted by GCC in our code
base, which are now being shown when we compile the tests.

After this patch, the whole test suite should be warning free on all
compilers we support and test, except for a few warnings on GCC that
we silence explicitly until we figure out the proper fix for them.

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

2 years ago[flang] Lower character related intrinsic
Valentin Clement [Tue, 15 Mar 2022 21:13:24 +0000 (22:13 +0100)]
[flang] Lower character related intrinsic

This patch adds lowering for the following character related intrinsics:
- `len`
- `len_trim`
- `lge`, `lgt`, `lle` and `llt`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment
Sam McCall [Thu, 10 Mar 2022 23:29:10 +0000 (00:29 +0100)]
[clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment

This replaces a bunch of duplicate logic to set up environment variables
and a few substitutions.

It does a little more than we were doing previously:
 - searching for clang and setting up substitutions for it
 - setting up some substitutions for target triples, which are
   potentially useful but not actually used

clangd has been happily using this for its tests for a while.

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

2 years ago[flang] Lower allocated intrinsic
Valentin Clement [Tue, 15 Mar 2022 21:06:04 +0000 (22:06 +0100)]
[flang] Lower allocated intrinsic

This patch adds lowering for the `allocated`
intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years agoFix sphinx build because of indentation
Aleksandr Platonov [Tue, 15 Mar 2022 21:08:54 +0000 (00:08 +0300)]
Fix sphinx build because of indentation

2 years ago[lit] add lit_config.substitute to interpolate lit_config.params
Sam McCall [Thu, 10 Mar 2022 23:58:03 +0000 (00:58 +0100)]
[lit] add lit_config.substitute to interpolate lit_config.params

A version of this logic appears in ~every lit.site.cfg.in (28 copies total).
This patch just removes two, but I'll update the rest of llvm-project next.

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

2 years ago[LLDB][NativePDB] Don't complete static members' types when completing a record type.
Zequan Wu [Mon, 14 Mar 2022 20:53:19 +0000 (13:53 -0700)]
[LLDB][NativePDB] Don't complete static members' types when completing a record type.

`UdtRecordCompleter` shouldn't complete static members' types. static members' types are going to be completed when the types are called in `SymbolFile::CompleteType`.

Reviewed By: labath

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

2 years ago[flang] Lower alternate return
Valentin Clement [Tue, 15 Mar 2022 21:03:14 +0000 (22:03 +0100)]
[flang] Lower alternate return

This patch adds the lowering infrastructure for the lowering of
alternat returns.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121698

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Lower entry statement
Valentin Clement [Tue, 15 Mar 2022 21:01:34 +0000 (22:01 +0100)]
[flang] Lower entry statement

This patch add the lowering for the entry statement.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121697

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Lower more pointer assignments/disassociation cases
Valentin Clement [Tue, 15 Mar 2022 20:57:30 +0000 (21:57 +0100)]
[flang] Lower more pointer assignments/disassociation cases

This patch lowers more cases of pointer assignments and
disassociations.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoreland: [clang] Don't append the working directory to absolute paths
Keith Smiley [Tue, 15 Mar 2022 03:35:44 +0000 (20:35 -0700)]
reland: [clang] Don't append the working directory to absolute paths

This fixes a bug that happens when using -fdebug-prefix-map to remap an
absolute path to a relative path. Since the path was absolute before
remapping, it is safe to assume that concatenating the remapped working
directory would be wrong.

This was originally submitted as https://reviews.llvm.org/D113718, but
reverted because when testing with dwarf 5 enabled, the tests were too
strict.

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

2 years ago[clang-format] Fix crash with ObjC Blocks
Björn Schäpers [Mon, 14 Mar 2022 12:19:08 +0000 (13:19 +0100)]
[clang-format] Fix crash with ObjC Blocks

Fixes https://github.com/llvm/llvm-project/issues/54367
Fixes https://github.com/llvm/llvm-project/issues/54368

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

2 years ago[libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled
Louis Dionne [Mon, 14 Mar 2022 15:50:02 +0000 (11:50 -0400)]
[libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled

Back in 3a208c68942e, we implemented the range-based constructor for <span>.
However, in doing so, we removed a previous non-standard constructor that
we provided before shipping <ranges>. Unfortunately, that breaks code that
was relying on a range-based constructor until we ship all of <ranges>.

This patch reintroduces the old non-conforming constructors and tests
that were removed in 3a208c68942e and uses them whenever <ranges> is
not provided (e.g. in LLVM 14). This is only a temporary workaround
until we enable <ranges> by default in C++20, which should hopefully
happen by LLVM 15.

The goal is to cherry-pick this workaround back to the LLVM 14 release
branch, since I suspect the constructor removal may otherwise cause
breakage out there, like the breakage I saw internally.

We could have avoided this situation by waiting for C++20 to be finalized
before shipping std::span. For example, we could have guarded it with
something like _LIBCPP_HAS_NO_INCOMPLETE_RANGES to prevent users from
accidentally starting to depend on it before it is stable. We did not
have these mechanisms when std::span was first implemented, though.

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

2 years ago[lsan] Allow suppression of "unknown module"
Vitaly Buka [Tue, 15 Mar 2022 07:30:14 +0000 (00:30 -0700)]
[lsan] Allow suppression of "unknown module"

If sanitizer cannot determine name of the module it
will use "<unknown module>". Then it can be suppressed
if needed.

Reviewed By: kda

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

2 years ago[libc++] Update URL to old libc++ dylibs
Louis Dionne [Tue, 15 Mar 2022 20:18:45 +0000 (16:18 -0400)]
[libc++] Update URL to old libc++ dylibs

2 years ago[Concepts] Fix an assertion failure while diagnosing constrained
Roy Jacobson [Tue, 15 Mar 2022 19:54:18 +0000 (12:54 -0700)]
[Concepts] Fix an assertion failure while diagnosing constrained
function candidates

See: https://github.com/llvm/llvm-project/issues/54379

I tried to see if I can reuse ResolveAddressOfOverloadedFunction for
explicit function instantiation and so I managed to hit this ICE.

Bug was the diagnostic required an argument (%0) and specific code path
didn't pass an argument.

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

2 years agoAvoid using a variable-sized array for a tiny allocation.
Sterling Augustine [Tue, 15 Mar 2022 19:48:31 +0000 (12:48 -0700)]
Avoid using a variable-sized array for a tiny allocation.

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

2 years agoRe-land "[lldb] Synchronize output through the IOHandler"
Jonas Devlieghere [Tue, 15 Mar 2022 18:11:04 +0000 (11:11 -0700)]
Re-land "[lldb] Synchronize output through the IOHandler"

Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

Differential revision: https://reviews.llvm.org/D121500

2 years ago[BOLT][NFC] Remove unused function
Maksim Panchenko [Tue, 15 Mar 2022 19:33:55 +0000 (12:33 -0700)]
[BOLT][NFC] Remove unused function

Reviewed By: yota9

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

2 years ago[FunctionAttrs] Replace MemoryAccessKind with FMRB.
Florian Hahn [Tue, 15 Mar 2022 19:35:54 +0000 (19:35 +0000)]
[FunctionAttrs] Replace  MemoryAccessKind with FMRB.

Update FunctionAttrs to use FunctionModRefBehavior instead
MemoryAccessKind.

This allows for adding support for inferring argmemonly and others,
see D121415.

Reviewed By: nikic

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

2 years ago[clang][parser] Allow GNU attributes before namespace identifier
Aleksandr Platonov [Tue, 15 Mar 2022 18:46:54 +0000 (21:46 +0300)]
[clang][parser] Allow GNU attributes before namespace identifier

GCC supports:
- `namespace <gnu attributes> identifier`
- `namespace identifier <gnu attributes>`

But clang supports only `namespace identifier <gnu attributes>` and diagnostics for `namespace <gnu attributes> identifier` case looks unclear:
Code:
```
namespace __attribute__((visibility("hidden"))) A
{
}
```
Diags:
```
test.cpp:1:49: error: expected identifier or '{'
namespace __attribute__((visibility("hidden"))) A
                                                ^
test.cpp:1:49: error: C++ requires a type specifier for all declarations
test.cpp:3:2: error: expected ';' after top level declarator
}
```

This patch adds support for `namespace <gnu attributes> identifier` and also forbids gnu attributes for nested namespaces (this already done for C++ attributes).

Reviewed By: aaron.ballman

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

2 years ago[NFC][AIX] Disable precompiled module file test on AIX
Jake Egan [Tue, 15 Mar 2022 19:15:58 +0000 (15:15 -0400)]
[NFC][AIX] Disable precompiled module file test on AIX

This patch follows the same reasoning as D114481. The PCH reader looks for `__clangast` section in the precompiled module file, which is not present in the file on AIX and not supported in XCOFF yet.

Reviewed By: daltenty

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

2 years ago[BOLT] Set cold sections alignment explicitly
Vladislav Khmelevsky [Thu, 10 Mar 2022 18:38:55 +0000 (21:38 +0300)]
[BOLT] Set cold sections alignment explicitly

The cold text section alignment is set using the maximum alignment value
passed to the emitCodeAlignment. In order to calculate tentetive layout
right we will set the minimum alignment of such sections to the maximum
possible function alignment explicitly.

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

2 years ago[PowerPC][P10] Add Vector pair calling convention
Stefan Pintilie [Fri, 11 Mar 2022 16:06:17 +0000 (10:06 -0600)]
[PowerPC][P10] Add Vector pair calling convention

Add the calling convention for the vector pair registers.
These registers overlap with the vector registers.

Part of an original patch by: Lei Huang

Reviewed By: nemanjai, #powerpc

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

2 years agoComplete the list of single-underscore keywords for MSVC compat.
Eli Friedman [Thu, 10 Mar 2022 21:50:44 +0000 (13:50 -0800)]
Complete the list of single-underscore keywords for MSVC compat.

List derived from https://docs.microsoft.com/en-us/cpp/cpp/keywords-cpp
. Not that this is something we really want to encourage, but some of
these show up in practice, so I figured I should just complete the list.

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

2 years ago[MLIR][Linalg] Canonicalization patterns for linalg.generic.
Nirvedh [Mon, 7 Mar 2022 00:49:19 +0000 (00:49 +0000)]
[MLIR][Linalg] Canonicalization patterns for linalg.generic.
Fold linalg.fill into linalg.generic.
Remove dead arguments used in linalg.generic.

Reviewed By: ThomasRaoux

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

2 years ago[gn build] Port d46409fc8ea4
LLVM GN Syncbot [Tue, 15 Mar 2022 18:43:11 +0000 (18:43 +0000)]
[gn build] Port d46409fc8ea4

2 years agoMove DWARFRecordSectionSplitter code to its own file
Shubham Sandeep Rastogi [Tue, 15 Mar 2022 18:36:06 +0000 (11:36 -0700)]
Move DWARFRecordSectionSplitter code to its own file

With 229d576b31f4071ab68c85ac4fabb78cfa502b04 the class EHFrameSplitter was renamed to DWARFRecordSectionSplitter. This change merely moves it to it's own .cpp/.h file

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

2 years ago[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
Sam Clegg [Tue, 15 Mar 2022 18:36:56 +0000 (11:36 -0700)]
[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349

2 years ago[libc++] Make __dir_stream visibility declaration consistent
Dimitry Andric [Mon, 14 Mar 2022 21:05:35 +0000 (22:05 +0100)]
[libc++] Make __dir_stream visibility declaration consistent

The class `__dir_stream` is currently declared in two places: as a
top-level forward declaration in `directory_iterator.h`, and as a friend
declaration in class `directory_entry`, in `directory_entry.h`.

The former has a `_LIBCPP_HIDDEN` attribute, but the latter does not,
causing the Firefox build to complain about the visibility not matching
the previous declaration. This is because Firefox plays games with
pushing and popping visibility.

Work around this by making both `__dir_stream` declarations consistently
use `_LIBCPP_HIDDEN`.

Reviewed By: ldionne, philnik, #libc

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

2 years agoAllow newline characters as separators for checks in Clang-Tidy configurations
Danny Mösch [Tue, 15 Mar 2022 18:29:33 +0000 (14:29 -0400)]
Allow newline characters as separators for checks in Clang-Tidy configurations

This is a fix for #53737. In addition to commas, newline characters are
considered as separators of checks.

2 years ago[Debuginfod] Check libcurl via CMake library.
Daniel Thornburgh [Mon, 14 Mar 2022 23:23:08 +0000 (23:23 +0000)]
[Debuginfod] Check libcurl via CMake library.

If libcurl was built with CMake, CMake's FindCURL module defers
completely to the included config file. This config file doesn't set any
of the variables that the current check script depends on; it just sets
up an imported CMake target. Accordingly, the smoke test fails, since it
can't find the libcurl (or its static dependencies).

This changes the compile smoke test to refer to the imported library
instead; this should in turn bring in the necessary include and library
directories via the interface properties set up by CMake. This better
mirrors the way libcurl is referred to elsewhere in the CMakeLists.

Reviewed By: MaskRay

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

2 years ago[AMDGPU] Regen checks again no-remat-indirect-mov
Joe Nash [Tue, 15 Mar 2022 17:42:33 +0000 (13:42 -0400)]
[AMDGPU] Regen checks again no-remat-indirect-mov

NFC. Update script does not behave right since the run lines have
identical output. Delete the duplicated check prefix added in
22cfbf7ecacdf7db47c2f65fe896bdf62ebcc0f3

2 years ago[AMDGPU] Regen checks for schedule-barrier
Joe Nash [Tue, 15 Mar 2022 17:35:43 +0000 (13:35 -0400)]
[AMDGPU] Regen checks for schedule-barrier

NFC. Hasn't been updated since script added check-next

2 years ago[AMDGPU] Regen checks for no-remat-indirect-mov
Joe Nash [Tue, 15 Mar 2022 17:10:37 +0000 (13:10 -0400)]
[AMDGPU] Regen checks for no-remat-indirect-mov

NFC. Hasn't been updated since the update script started adding
check-next.

Reviewed By: arsenm

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

2 years ago[mlir][sparse] more test cases for linalg.index
Aart Bik [Tue, 15 Mar 2022 02:31:23 +0000 (19:31 -0700)]
[mlir][sparse] more test cases for linalg.index

Reviewed By: bixia

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

2 years ago[X86] Fix AMD Znver3 model checks
Roman Lebedev [Tue, 15 Mar 2022 15:36:39 +0000 (18:36 +0300)]
[X86] Fix AMD Znver3 model checks

While `-march=` is correctly detected as `znver3` for the cpu,
apparently the model check is incorrect:
```
$ lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         48 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  32
  On-line CPU(s) list:   0-31
Vendor ID:               AuthenticAMD
  Model name:            AMD Ryzen 9 5950X 16-Core Processor
    CPU family:          25
    Model:               33
    Thread(s) per core:  2
    Core(s) per socket:  16
    Socket(s):           1
    Stepping:            0
    Frequency boost:     disabled
    CPU max MHz:         6017.8462
    CPU min MHz:         2200.0000
    BogoMIPS:            8050.07
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse
                         3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_p
                         state ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbn
                         oinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization features:
  Virtualization:        AMD-V
Caches (sum of all):
  L1d:                   512 KiB (16 instances)
  L1i:                   512 KiB (16 instances)
  L2:                    8 MiB (16 instances)
  L3:                    64 MiB (2 instances)
NUMA:
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-31
Vulnerabilities:
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling
  Srbds:                 Not affected
  Tsx async abort:       Not affected
```

Model is 33 (0x21), while the code was expecting it to be `0x00 .. 0x1F`.
https://github.com/torvalds/linux/blob/v5.17-rc8/drivers/hwmon/k10temp.c#L432-L453 agrees.
I'm not sure if other ranges listed here should also be accepted.

I noticed this while implementing CPU model detection
for halide (https://github.com/halide/Halide/pull/6648)

Reviewed By: craig.topper

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

2 years agoRevert "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"
Yi Kong [Tue, 15 Mar 2022 17:17:17 +0000 (01:17 +0800)]
Revert "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"

This reverts commit 1c1a4b9556db8579f7428605ac2c351bddde9ad5.

Some builders failed.

2 years ago[clang][driver] Emit a warning if -xc/-xc++ is after the last input file
Yi Kong [Tue, 15 Mar 2022 10:50:06 +0000 (18:50 +0800)]
[clang][driver] Emit a warning if -xc/-xc++ is after the last input file

This follows the same warning GCC produces.

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

2 years ago[AMDGPU] Fix typo consecutive in GCNNSAReassign
Joe Nash [Tue, 15 Mar 2022 16:36:51 +0000 (12:36 -0400)]
[AMDGPU] Fix typo consecutive in GCNNSAReassign

2 years agoRevert "[lldb] Synchronize output through the IOHandler"
Jonas Devlieghere [Tue, 15 Mar 2022 16:44:33 +0000 (09:44 -0700)]
Revert "[lldb] Synchronize output through the IOHandler"

This reverts commit 242c574dc03e4b90e992cc8d07436efc3954727f because it
breaks the following tests on the bots:

 - TestGuiExpandThreadsTree.py
 - TestBreakpointCallbackCommandSource.py

2 years ago[llvm-cov gcov] Fix calculating coverage of template functions
Igor Kudrin [Tue, 15 Mar 2022 16:46:22 +0000 (20:46 +0400)]
[llvm-cov gcov] Fix calculating coverage of template functions

Template functions share the same lines in source files, so the common
container of lines' properties cannot be used to calculate the coverage
statistics of individual functions.

> cat tmpl.cpp
template <int N> int test() { return N; }
int main() { return test<1>() + test<2>(); }
> clang++ --coverage tmpl.cpp -o tmpl
> ./tmpl
> llvm-cov gcov tmpl.cpp -f
...
Function '_Z4testILi1EEiv'
Lines executed:100.00% of 1

Function '_Z4testILi2EEiv'
Lines executed:-nan% of 0
...
> llvm-cov-patched gcov tmpl.cpp -f
...
Function '_Z4testILi1EEiv'
Lines executed:100.00% of 1

Function '_Z4testILi2EEiv'
Lines executed:100.00% of 1
...

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

2 years ago[LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref...
Shafik Yaghmour [Tue, 15 Mar 2022 16:34:12 +0000 (09:34 -0700)]
[LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size

Currently DW_OP_deref_size just drops the ValueType::FileAddress case and does
not attempt to handle it. This adds support for this case and a test that
verifies this support.

I did a little refactoring since DW_OP_deref and DW_OP_deref_size have some
overlap in code.

Also see: rdar://66870821

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

2 years ago[flang][lowering] Add support for lowering of the `ibits` intrinsic
Andrzej Warzynski [Tue, 15 Mar 2022 13:16:47 +0000 (13:16 +0000)]
[flang][lowering] Add support for lowering of the `ibits` intrinsic

This patch adds support for lowering of the `ibits` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[lldb] Make the PlatformMacOSX unit test Apple specific
Jonas Devlieghere [Tue, 15 Mar 2022 16:29:39 +0000 (09:29 -0700)]
[lldb] Make the PlatformMacOSX unit test Apple specific

I thought that x86GetSupportedArchitectures would always return
x86_64-apple-macosx as a compatible architecture, regardless of the host
achitecture, but the Debian bot disagrees with that.

2 years ago[lldb] Synchronize output through the IOHandler
Jonas Devlieghere [Tue, 15 Mar 2022 16:13:57 +0000 (09:13 -0700)]
[lldb] Synchronize output through the IOHandler

Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

Differential revision: https://reviews.llvm.org/D121500

2 years ago[flang][lowering] Add support for lowering the `dim` intrinsic
Andrzej Warzynski [Tue, 15 Mar 2022 12:31:20 +0000 (12:31 +0000)]
[flang][lowering] Add support for lowering the `dim` intrinsic

This patch adds support for lowering of the `dim` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[libc] Add implementation of POSIX lseek function.
Siva Chandra Reddy [Tue, 15 Mar 2022 08:26:41 +0000 (08:26 +0000)]
[libc] Add implementation of POSIX lseek function.

Reviewed By: lntue

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

2 years ago[lldb] Fix platform selection on Apple Silicon (again)
Jonas Devlieghere [Tue, 15 Mar 2022 15:50:33 +0000 (08:50 -0700)]
[lldb] Fix platform selection on Apple Silicon (again)

This patch is another attempt to fix platform selection on Apple
Silicon. It partially undoes D117340 which tried to fix the issue by
always instantiating a remote-ios platform for "iPhone and iPad Apps on
Apple Silicon Macs".

While the previous patch worked for attaching, it broke launching and
everything else that expects the remote platform to be connected. I made
an attempt to work around that, but quickly found out that there were
just too may places that had this assumption baked in.

This patch takes a different approach and reverts back to marking the
host platform compatible with iOS triples. This brings us back to the
original situation where platform selection was broken for remote iOS
debugging on Apple Silicon. To fix that, we now look at the process'
host architecture to differentiate between iOS binaries running remotely
and iOS binaries running locally.

I tested the following scenarios, which now all uses the desired
platform:

  - Launching an iOS binary on macOS: uses the host platform
  - Attaching to an iOS binary on macOS: uses the host platform
  - Attaching to a remote iOS binary: uses the remote-ios platform

rdar://89840215

Differential revision: https://reviews.llvm.org/D121444

2 years ago[flang][lowering] Add support for lowering the `dot_product` intrinsic
Andrzej Warzynski [Tue, 15 Mar 2022 10:58:50 +0000 (10:58 +0000)]
[flang][lowering] Add support for lowering the `dot_product` intrinsic

This patch adds support for lowering the `dot_product` intrinsic from
Fortran to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Mark Leair <leairmark@gmail.com>
2 years ago[mlir][sparse][taco] Reorder a class.
Bixia Zheng [Mon, 14 Mar 2022 22:43:12 +0000 (15:43 -0700)]
[mlir][sparse][taco] Reorder a class.

Define IndexExpr before IndexVar. This is to prepare for the next change
to support the use of index values in tensor expressions.

Reviewed By: aartbik

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

2 years ago[LegalizeTypes][RISCV][WebAssembly] Expand ABS in PromoteIntRes_ABS if it will expand...
Craig Topper [Tue, 15 Mar 2022 15:27:38 +0000 (08:27 -0700)]
[LegalizeTypes][RISCV][WebAssembly] Expand ABS in PromoteIntRes_ABS if it will expand to sra+xor+sub later.

If we promote the ABS and then Expand in LegalizeDAG, then both the
sra and the xor will have their inputs sign extended. This generates
extra code on RISCV which lacks an i8 or i16 sign extend instructon.
If we expand during type legalization, then only the sra will get its
input sign extended. RISCV is able to combine this with the sra by
doing a shift left followed by an sra.

Reviewed By: RKSimon

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

2 years ago[DAGCombiner][RISCV] Adjust (aext (and (trunc x), cst)) -> (and x, cst) to sext cst...
Craig Topper [Tue, 15 Mar 2022 15:23:55 +0000 (08:23 -0700)]
[DAGCombiner][RISCV] Adjust (aext (and (trunc x), cst)) -> (and x, cst) to sext cst based on target preference

RISCV strong prefers i32 values be sign extended to i64. This combine
was always zero extending the constant using APInt methods.

This adjusts the code so that it calls getNode using ISD::ANY_EXTEND instead.
getNode will call TLI.isSExtCheaperThanZExt to decide how to handle
the constant.

Tests were copied from D121598 where I noticed that we were creating
constants that were hard to materialize.

Reviewed By: RKSimon

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

2 years agoRevert "[lldb/test] Make category-skipping logic "platform"-independent"
Pavel Labath [Tue, 15 Mar 2022 15:23:43 +0000 (16:23 +0100)]
Revert "[lldb/test] Make category-skipping logic "platform"-independent"

This reverts commit dddf4ce034a8e06cc1351492dceece3fa2344c14. It breaks
a couple of tests on macos.

2 years ago[RISCV] Remove lowerSPLAT_VECTOR
Craig Topper [Tue, 15 Mar 2022 15:17:21 +0000 (08:17 -0700)]
[RISCV] Remove lowerSPLAT_VECTOR

This code handles fixed vector SPLAT_VECTOR, but is never called in
any tests.

We only form fixed vector splat vectors for vXi64 on RV32 as part
of DAGCombine. This will be type legalized to SPLAT_VECTOR_PARTS.
So the Custom handling for SPLAT_VECTOR is never needed.

This patch makes SPLAT_VECTOR for vXi64 'Legal' on RV32 so that
DAGCombine will create it, but there's no need for Custom handler.
It will still be type legalized to SPLAT_VECTOR_PARTS.

Reviewed By: frasercrmck

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

2 years ago[libc] Fix exit not calling new handlers registered from a call to atexit in atexit...
Alex Brachet [Tue, 15 Mar 2022 15:18:41 +0000 (15:18 +0000)]
[libc] Fix exit not calling new handlers registered from a call to atexit in atexit handler

2 years ago[libc][BlockStore] Add back, pop_back and empty methods
Alex Brachet [Tue, 15 Mar 2022 15:11:57 +0000 (15:11 +0000)]
[libc][BlockStore] Add back, pop_back and empty methods

Reviewed By: sivachandra

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

2 years ago[clang][dataflow] Allow disabling built-in transfer functions for CFG terminators
Yitzhak Mandelbaum [Tue, 15 Mar 2022 12:57:26 +0000 (12:57 +0000)]
[clang][dataflow] Allow disabling built-in transfer functions for CFG terminators

Terminators are handled specially in the transfer functions so we need an
additional check on whether the analysis has disabled built-in transfer
functions.

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

2 years ago[InstCombine] try harder to propagate 'nsz' through fneg-of-select
Sanjay Patel [Tue, 15 Mar 2022 14:34:48 +0000 (10:34 -0400)]
[InstCombine] try harder to propagate 'nsz' through fneg-of-select

This can be viewed as swapping the select arms:
https://alive2.llvm.org/ce/z/jUvFMJ
...so we don't have the 'nsz' problem with the more general fold.

This unlocks other folds for the motivating fabs example.
This was discussed in issue #38828.

2 years ago[InstCombine] add tests for fneg-of-select with FMF; NFC
Sanjay Patel [Tue, 15 Mar 2022 12:50:06 +0000 (08:50 -0400)]
[InstCombine] add tests for fneg-of-select with FMF; NFC

2 years ago[libc++] Overhaul all tests for assertions and debug mode
Louis Dionne [Mon, 7 Mar 2022 21:58:16 +0000 (16:58 -0500)]
[libc++] Overhaul all tests for assertions and debug mode

Prior to this patch, there was no distinction between tests that check
basic assertions and tests that check full-fledged iterator debugging
assertions. Both were disabled when support for the debug mode is not
provided in the dylib, which is stronger than it needs to be.

Furthermore, all of the tests using "debug_macros.h" that contain more
than one assertion in them were broken -- any code after the first
assertion would never be executed.

This patch refactors all of our assertion-related tests to:
1. Be enabled whenever they can, i.e. basic assertions tests are run
   even when the debug mode is disabled.
2. Use the superior `check_assertion.h` (previously `debug_mode_helper.h`)
   instead of `debug_macros.h`, which allows multiple assertions in the
   same program.
3. Coalesce some tests into the same file to make them more readable.
4. Use consistent naming for test files -- no more db{1,2,3,...,10} tests.

This is a large but mostly mechanical patch.

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

2 years ago[VE] strided v256.23 isel and tests
Simon Moll [Tue, 15 Mar 2022 13:03:36 +0000 (14:03 +0100)]
[VE] strided v256.23 isel and tests

ISel for experimental.vp.strided.load|store for v256.32 types via
lowering to vvp_load|store SDNodes.

Reviewed By: kaz7

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

2 years ago[mlir] Fix --convert-func-to-llvm=emit-c-wrappers argument and result attribute handling
Sam Carroll [Tue, 15 Mar 2022 14:22:31 +0000 (15:22 +0100)]
[mlir] Fix --convert-func-to-llvm=emit-c-wrappers argument and result attribute handling

When using `--convert-func-to-llvm=emit-c-wrappers` the attribute arguments of the wrapper would not be created correctly in some cases.
This patch fixes that and introduces a set of tests for (hopefully) all corner cases.

See https://github.com/llvm/llvm-project/issues/53503

Author: Sam Carroll <sam.carroll@lmns.com>
Co-Author: Laszlo Kindrat <laszlo.kindrat@lmns.com>

Reviewed By: ftynse

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

2 years ago[libc] Implement expm1f function that is correctly rounded for all rounding modes.
Tue Ly [Mon, 14 Mar 2022 13:43:33 +0000 (09:43 -0400)]
[libc] Implement expm1f function that is correctly rounded for all rounding modes.

Implement expm1f function that is correctly rounded for all rounding modes.  This is based on expf implementation.

From exhaustive testings, using expf implementation, and subtract 1.0 before rounding the final result to single precision
gives correctly rounded results for all |x| > 2^-4 with 1 exception.  When |x| < 2^-25, we use x + x^2 (implemented with a
single fma).  And for 2^-25 <= |x| <= 2^-4, we use a single degree-8 minimax polynomial generated by Sollya.

Reviewed By: sivachandra, zimmermann6

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

2 years ago[InstCombine] Add general constant support to eq/ne icmp(add(X,C1),add(Y,C2)) ->...
Simon Pilgrim [Tue, 15 Mar 2022 14:17:38 +0000 (14:17 +0000)]
[InstCombine] Add general constant support to eq/ne icmp(add(X,C1),add(Y,C2)) -> icmp(add(X,C1-C2),Y) fold

A further extension for Issue #32161

For eq/ne comparisons - the sign mismatch and bounds constraints are redundant, so if the that fold fails, fallback and just fold the constants directly.

https://alive2.llvm.org/ce/z/cdodNQ

The loop rotation test change looks mostly benign - the backend doesn't seem to suffer? https://gcc.godbolt.org/z/dErMY78To

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

2 years ago[JITLink] Fix -Wparentheses warning in R_RISCV_SUB6 case.
Simon Pilgrim [Tue, 15 Mar 2022 14:13:28 +0000 (14:13 +0000)]
[JITLink] Fix -Wparentheses warning in R_RISCV_SUB6 case.

Perform the mask inside parentheses before applying the offset

2 years ago[AARCH64] ssbs should be enabled by default for cortex-x1, cortex-x1c, cortex-a77
Ties Stuij [Tue, 15 Mar 2022 13:24:32 +0000 (13:24 +0000)]
[AARCH64] ssbs should be enabled by default for cortex-x1, cortex-x1c, cortex-a77

Reviewed By: amilendra

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

2 years ago[MLIR][OpenMP] Add support for basic SIMD construct
Arnamoy Bhattacharyya [Tue, 15 Mar 2022 13:41:04 +0000 (09:41 -0400)]
[MLIR][OpenMP]  Add support for basic SIMD construct

Patch adds a new operation for the SIMD construct.  The op is designed to be very similar to the existing `wsloop` operation, so that the `CanonicalLoopInfo` of `OpenMPIRBuilder` can be used.

Reviewed By: shraiysh

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

2 years ago[ASAN] Fix darwin-interface test
Steven Wu [Tue, 15 Mar 2022 13:13:51 +0000 (06:13 -0700)]
[ASAN] Fix darwin-interface test

Fix darwin interface test after D121464. asan_rtl_x86_64.S is not
available on Darwin.

Reviewed By: kstoimenov

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

2 years ago[gn build] Port 7262eacd4199
LLVM GN Syncbot [Tue, 15 Mar 2022 13:08:09 +0000 (13:08 +0000)]
[gn build] Port 7262eacd4199

2 years agoRevert "Load pass plugins during option processing, so that plugin options are regist...
Wael Yehia [Tue, 15 Mar 2022 13:01:00 +0000 (13:01 +0000)]
Revert "Load pass plugins during option processing, so that plugin options are registered and live."

This reverts commit 5e8700ce8bf58bdf0a59eef99c85185a74177555.

2 years agoRevert rG9c542a5a4e1ba36c24e48185712779df52b7f7a6 "Lower `@llvm.global_dtors` using...
Simon Pilgrim [Tue, 15 Mar 2022 13:01:22 +0000 (13:01 +0000)]
Revert rG9c542a5a4e1ba36c24e48185712779df52b7f7a6 "Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO"

Mane of the build bots are complaining: Unknown command line argument '-lower-global-dtors'

2 years agoRemove a top-level "using namespace" in TargetTransformInfoImpl.h
Pavel Labath [Tue, 15 Mar 2022 12:48:27 +0000 (13:48 +0100)]
Remove a top-level "using namespace" in TargetTransformInfoImpl.h

Avoids polluting the namespace of all files including the header.

2 years agoLoad pass plugins during option processing, so that plugin options are registered...
Wael Yehia [Mon, 14 Mar 2022 02:16:21 +0000 (22:16 -0400)]
Load pass plugins during option processing, so that plugin options are registered and live.

2 years ago[lldb/test] Make category-skipping logic "platform"-independent
Pavel Labath [Mon, 14 Mar 2022 15:32:51 +0000 (16:32 +0100)]
[lldb/test] Make category-skipping logic "platform"-independent

The decision which categories are relevant for a particular test run
happen very early in the test setup process. They use the SBPlatform
object to determine which categories should be skipped. The platform
object created for this purpose transcends individual test runs.

This setup is not compatible with the direction discussed in
<https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594>
-- when platform objects are tied to a specific (SB)Debugger, they need
to be created alongside it, which currently happens in the test setUp
method.

This patch is the first step in that direction -- it rewrites the
category skipping logic to avoid depending on a global SBPlatform
object. Fortunately, the skipping logic is fairly simple (and I believe
it outght to stay that way) and mainly consists of comparing the
platform name against some hardcoded lists. This patch bases this
comparison on the platform name instead of the os part of the triple (as
reported by the platform).

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

2 years ago[BasicAA] Add test showing incorrect noalias result with wrapping.
Florian Hahn [Tue, 15 Mar 2022 12:32:06 +0000 (12:32 +0000)]
[BasicAA] Add test showing incorrect noalias result with wrapping.

@mul_may_overflow_var_nonzero_minabsvarindex_one_index shows BasicAA
incorrectly determining noalias for (%gep.917, i8* %gep.idx).
If %v == 10581764700698480926, %idx == 917 and the GEPs alias.
https://alive2.llvm.org/ce/z/yzDgnn

2 years ago[mlir][bufferize] Extract buffer hoisting into separate function
Matthias Springer [Tue, 15 Mar 2022 12:22:21 +0000 (21:22 +0900)]
[mlir][bufferize] Extract buffer hoisting into separate function

This improves the modularity of the bufferization.

From now on, all ops that do not implement BufferizableOpInterface are considered hoisting barriers. Previously, all ops that do not implement the interface were not considered barriers and such ops had to be marked as barriers explicitly. This was unsafe because we could've hoisted across unknown ops where it was not safe to hoist.

As a side effect, this allows for cleaning up AffineBufferizableOpInterfaceImpl. This build unit no longer needed and can be deleted.

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

2 years ago[clang-format] Correctly format variable templates.
Marek Kurdej [Tue, 15 Mar 2022 12:16:08 +0000 (13:16 +0100)]
[clang-format] Correctly format variable templates.

Fixes https://github.com/llvm/llvm-project/issues/54257.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[X86] combineSelect - canonicalize (vXi1 bitcast(iX Cond)) with combineToExtendBoolVe...
Simon Pilgrim [Tue, 15 Mar 2022 12:16:11 +0000 (12:16 +0000)]
[X86] combineSelect - canonicalize (vXi1 bitcast(iX Cond)) with combineToExtendBoolVectorInReg before legalization

This replaces the attempt in 20af71f8ec47319d375a871db6fd3889c2487cbd to use combineToExtendBoolVectorInReg to create X86ISD::BLENDV masks directly, instead we use it to canonicalize the iX bitcast to a sign-extended mask and then truncate it back to vXi1 prior to legalization breaking it apart.

Fixes #53760

2 years ago[clang-format] Add regression tests for function ref qualifiers on operator definitio...
Marek Kurdej [Tue, 15 Mar 2022 11:00:37 +0000 (12:00 +0100)]
[clang-format] Add regression tests for function ref qualifiers on operator definition. NFC.

Fixes https://github.com/llvm/llvm-project/issues/54374.

2 years ago[LV] Make reduction-order.ll test independent of instruction naming.
Florian Hahn [Tue, 15 Mar 2022 11:13:18 +0000 (11:13 +0000)]
[LV] Make reduction-order.ll test independent of instruction naming.

Also update test to not use branch on undef.

2 years ago[NFC] Add LazyValueInfo::clear method
Dmitry Makogon [Tue, 15 Mar 2022 10:10:41 +0000 (17:10 +0700)]
[NFC] Add LazyValueInfo::clear method

This method just calls LazyValueInfoImpl::clear

2 years ago[clang-format] Correctly recognize arrays in template parameter list.
Marek Kurdej [Mon, 14 Mar 2022 11:00:19 +0000 (12:00 +0100)]
[clang-format] Correctly recognize arrays in template parameter list.

Fixes https://github.com/llvm/llvm-project/issues/54245.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[mlir][gpu] Introduce gpu.global_id op
Ivan Butygin [Sun, 13 Mar 2022 10:56:59 +0000 (13:56 +0300)]
[mlir][gpu] Introduce gpu.global_id op

Introduce OpenCL-style global_id op and corresponding spirv lowering.

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

2 years ago[mlir][spirv] Add AssumeTrueKHROp
Ivan Butygin [Mon, 14 Mar 2022 13:24:08 +0000 (16:24 +0300)]
[mlir][spirv] Add AssumeTrueKHROp

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

2 years ago[mlir][bufferize][NFC] Deallocate all buffers at the end of bufferization
Matthias Springer [Tue, 15 Mar 2022 08:50:09 +0000 (17:50 +0900)]
[mlir][bufferize][NFC] Deallocate all buffers at the end of bufferization

This makes bufferization more modular. This is in preparation of future refactorings.

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

2 years ago[OpenMPOpt] Avoid pointer element type access during region merging
Nikita Popov [Thu, 3 Mar 2022 10:55:35 +0000 (11:55 +0100)]
[OpenMPOpt] Avoid pointer element type access during region merging

Hardcode the function type as ParallelTask, which is the guaranteed
pointee type of this runtime function argument (if pointee types
exist). The elimination of the callee bitcast is left for InstCombine.

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

2 years ago[mlir][bufferize][NFC] Split BufferizationState into AnalysisState/BufferizationState
Matthias Springer [Tue, 15 Mar 2022 08:34:46 +0000 (17:34 +0900)]
[mlir][bufferize][NFC] Split BufferizationState into AnalysisState/BufferizationState

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

2 years ago[flang] fulfill -Msave/-fno-automatic in main programs too
Jean Perier [Tue, 15 Mar 2022 08:32:43 +0000 (09:32 +0100)]
[flang] fulfill -Msave/-fno-automatic in main programs too

`semantics::IsSaved()` was not applying -Msave/-fno-automatic for main programs.
This caused issues since lowering relies on it to allocate static
variables. This did not match nvfortran/gfortran behaviors where
-fno-automatic/-Msave control the static allocation of scalars in
main programs.

Some program may rely on main program scalars to be statically allocated in
bss (and therefore initialized to zero) with -Msave/-fno-automatic
flags.

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

2 years ago[mlir][bufferize] Fix config not passed to greedy rewriter
Matthias Springer [Tue, 15 Mar 2022 08:25:56 +0000 (17:25 +0900)]
[mlir][bufferize] Fix config not passed to greedy rewriter

Also add a TODO to switch to a custom walk instead of the GreedyPatternRewriter, which should be more efficient. (The bufferization pattern is guaranteed to apply only a single time for every op, so a simple walk should suffice.)

We currently specify a top-to-bottom walk order. This is important because other walk orders could introduce additional casts and/or buffer copies. These canonicalize away again, but it is more efficient to never generate them in the first place.

Note: A few of these canonicalizations are not yet implemented.

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

2 years ago[libc][Obvious] Fix typo in CMake file.
Siva Chandra Reddy [Tue, 15 Mar 2022 08:29:58 +0000 (08:29 +0000)]
[libc][Obvious] Fix typo in CMake file.

2 years ago[flang] Hanlde COMPLEX 2/3/10 in runtime TypeCode(cat, kind)
Jean Perier [Tue, 15 Mar 2022 08:23:50 +0000 (09:23 +0100)]
[flang] Hanlde COMPLEX 2/3/10 in runtime TypeCode(cat, kind)

Type codes for COMPLEX kinds 2, 3, and 10 were added in https://reviews.llvm.org/D117336
but handling for these kinds in TypeCode(cat, kind) has not been added
yet.

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

2 years ago[MachineLICM] Simplify code and avoid adding nullptr values to ParentMap. NFC
Fangrui Song [Tue, 15 Mar 2022 08:24:01 +0000 (01:24 -0700)]
[MachineLICM] Simplify code and avoid adding nullptr values to ParentMap. NFC