platform/upstream/llvm.git
3 years agoRevert "[Docs] Clarify that FunctionPasses can't add/remove declarations"
Arthur Eubanks [Thu, 22 Oct 2020 16:49:42 +0000 (09:49 -0700)]
Revert "[Docs] Clarify that FunctionPasses can't add/remove declarations"

This reverts commit 710676cf3a3c6f6ddf2f18e24cac017d20dac1ff.

3 years ago[ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a].dyn
Fangrui Song [Thu, 22 Oct 2020 16:48:04 +0000 (09:48 -0700)]
[ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a].dyn

The ELF spec says

> If the sh_flags field for this section header includes the attribute SHF_INFO_LINK, then this member represents a section header table index.

Set SHF_INFO_LINK so that binary manipulation tools know that sh_info is
a section header table index instead of (the number of local symbols in the case of SHT_SYMTAB/SHT_DYNSYM).
We have already added SHF_INFO_LINK for --emit-relocs retained SHT_REL[A].

For example, we can teach llvm-objcopy to preserve the section index of the sh_info referenced section if
SHF_INFO_LINK is set. (GNU objcopy recognizes .rel[a].plt and updates
sh_info even if SHF_INFO_LINK is not set).

Reviewed By: grimar, psmith

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

3 years agoRevert "[lldb] Explicitly use the configuration architecture when building test execu...
Raphael Isemann [Thu, 22 Oct 2020 16:42:19 +0000 (18:42 +0200)]
Revert "[lldb] Explicitly use the configuration architecture when building test executables"

This reverts commit 41185226f6d80663b4a1064c6f47581ee567d78d.

Causes TestQuoting to fail on Windows.

3 years ago[DomTree] Accept Value as Def (NFC)
Nikita Popov [Sat, 17 Oct 2020 18:54:53 +0000 (20:54 +0200)]
[DomTree] Accept Value as Def (NFC)

Non-instruction defs like arguments, constants or global values
always dominate all instructions/uses inside the function. This
case currently needs to be treated separately by the caller, see
https://reviews.llvm.org/D89623#inline-832818 for an example.

This patch makes the dominator tree APIs accept a Value instead of
an Instruction and always returns true for the non-Instruction case.

A complication here is that BasicBlocks are also Values. For that
reason we can't support the dominates(Value *, BasicBlock *)
variant, as it would conflict with dominates(BasicBlock *, BasicBlock *),
which has different semantics. For the other two APIs we assert
that the passed value is not a BasicBlock.

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

3 years ago[SLP] Add tests with selects that can be turned into min/max.
Florian Hahn [Thu, 22 Oct 2020 08:39:05 +0000 (09:39 +0100)]
[SLP] Add tests with selects that can be turned into min/max.

AArch64 does not have a flexible vector select instruction. In some
cases, the selects can be turned into min/max however, for which there
are dedicated vector instructions on AArch64.

This patch adds some tests for such cases.

3 years ago[AMDGPU] Add amdgpu specific loop threshold metadata
Tim Corringham [Tue, 28 Jul 2020 18:01:03 +0000 (19:01 +0100)]
[AMDGPU] Add amdgpu specific loop threshold metadata

Add new loop metadata amdgpu.loop.unroll.threshold to allow the initial AMDGPU
specific unroll threshold value to be specified on a loop by loop basis.

The intention is to be able to to allow more nuanced hints, e.g. specifying a
low threshold value to indicate that a loop may be unrolled if cheap enough
rather than using the all or nothing llvm.loop.unroll.disable metadata.

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

3 years ago[gn build] Add missing clangd dependencies
Arthur Eubanks [Sun, 18 Oct 2020 20:35:58 +0000 (13:35 -0700)]
[gn build] Add missing clangd dependencies

Fixes
$ ninja obj/build/rel/gen/clang-tools-extra/clangd/CompletionModel.CompletionModel.obj

Some tablegen include files from clang/include/clang/AST and
clang/include/clang/Sema need to be generated before CompletionModel is
compiled.

Reviewed By: thakis

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

3 years ago[Docs] Clarify that FunctionPasses can't add/remove declarations
Arthur Eubanks [Wed, 21 Oct 2020 15:55:50 +0000 (08:55 -0700)]
[Docs] Clarify that FunctionPasses can't add/remove declarations

In preparation for potential future concurrency, a FunctionPass
shouldn't modify anything at the module level that other FunctionPasses
can also modify.

Reviewed By: asbirlea

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

3 years ago[lldb/DWARF] Add support for DW_OP_implicit_value
Med Ismail Bennani [Wed, 21 Oct 2020 01:54:48 +0000 (03:54 +0200)]
[lldb/DWARF] Add support for DW_OP_implicit_value

This patch completes https://reviews.llvm.org/D83560. Now that the
compiler can emit `DW_OP_implicit_value` into DWARF expressions, lldb
needed to learn reading these opcodes for variable inspection and
expression evaluation.

This implicit location descriptor specifies an immediate value with two
operands: the length (ULEB128) followed by a block representing the value
in the target memory representation.

rdar://67406091

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[OpenCL] Remove unused extensions
Marco Antognini [Mon, 12 Oct 2020 14:17:03 +0000 (15:17 +0100)]
[OpenCL] Remove unused extensions

Many non-language extensions are defined but also unused. This patch
removes them with their tests as they do not require compiler support.

The cl_khr_select_fprounding_mode extension is also removed because it
has been deprecated since OpenCL 1.1 and Clang doesn't have any specific
support for it.

The cl_khr_context_abort extension is only referred to in "The OpenCL
Specification", version 1.2 and 2.0, in Table 4.3, but no specification
is provided in "The OpenCL Extension Specification" for these versions.
Because it is both unused in Clang and lacks specification, this
extension is removed.

The following extensions are platform extensions that bring new OpenCL
APIs but do not impact the kernel language nor require compiler support.
They are therefore removed.

- cl_khr_gl_sharing, introduced in OpenCL 1.0

- cl_khr_icd, introduced in OpenCL 1.2

- cl_khr_gl_event, introduced in OpenCL 1.1
Note: this extension adds a new API to create cl_event but it also
specifies that these can only be used by clEnqueueAcquireGLObjects.
Hence, they cannot be used on the device side and the extension does
not impact the kernel language.

- cl_khr_d3d10_sharing, introduced in OpenCL 1.1

- cl_khr_d3d11_sharing, introduced in OpenCL 1.2

- cl_khr_dx9_media_sharing, introduced in OpenCL 1.2

- cl_khr_image2d_from_buffer, introduced in OpenCL 1.2

- cl_khr_initialize_memory, introduced in OpenCL 1.2

- cl_khr_gl_depth_images, introduced in OpenCL 1.2
Note: this extension is related to cl_khr_depth_images but only the
latter adds new features to the kernel language.

- cl_khr_spir, introduced in OpenCL 1.2

- cl_khr_egl_event, introduced in OpenCL 1.2
Note: this extension adds a new API to create cl_event but it also
specifies that these can only be used by clEnqueueAcquire* API
functions. Hence, they cannot be used on the device side and the
extension does not impact the kernel language.

- cl_khr_egl_image, introduced in OpenCL 1.2

- cl_khr_terminate_context, introduced in OpenCL 1.2

The minimum required OpenCL version used in OpenCLExtensions.def for
these extensions is not always correct. Removing these address that
issue.

Reviewed By: Anastasia

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

3 years ago[HIP] Fix HIP rounding math intrinsics
Aaron En Ye Shi [Thu, 22 Oct 2020 15:07:47 +0000 (15:07 +0000)]
[HIP] Fix HIP rounding math intrinsics

The __ocml_*_rte_f32 and __ocml_*_rte_f64 functions are not
available if OCML_BASIC_ROUNDED_OPERATIONS is not defined.

Reviewed By: b-sumner, yaxunl

Fixes: SWDEV-257235

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

3 years ago[NFC][MC] Use MCRegister for ReachingDefAnalysis APIs
Mircea Trofin [Wed, 21 Oct 2020 20:59:45 +0000 (13:59 -0700)]
[NFC][MC] Use MCRegister for ReachingDefAnalysis APIs

Also updated the users of the APIs; and a drive-by small change to
RDFRegister.cpp

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

3 years ago[LoopRotate][NPM] Disable header duplication under -Oz
Arthur Eubanks [Thu, 22 Oct 2020 05:08:58 +0000 (22:08 -0700)]
[LoopRotate][NPM] Disable header duplication under -Oz

It was already disabled under -Oz in
buildFunctionSimplificationPipeline(), but not in
buildModuleOptimizationPipeline()/addPGOInstrPasses().

Reviewed By: fhahn

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

3 years ago[lldb] Fix a regression introduced by D75730
Jonas Devlieghere [Thu, 22 Oct 2020 15:32:05 +0000 (08:32 -0700)]
[lldb] Fix a regression introduced by D75730

In a new Range class was introduced to simplify and the Disassembler API
and reduce duplication. It unintentionally broke the
SBFrame::Disassemble functionality because it unconditionally converts
the number of instructions to a Range{Limit::Instructions,
num_instructions}. This is subtly different from the previous behavior,
where now we're passing a Range and assume it's valid in the callee, the
original code would propagate num_instructions and the callee would
compare the value and decided between disassembling instructions or
bytes.

Unfortunately the existing tests was not particularly strict:

  disassembly = frame.Disassemble()
  self.assertNotEqual(len(disassembly), 0, "Disassembly was empty.")

This would pass because without this patch we'd disassemble zero
instructions, resulting in an error:

  (lldb) script print(lldb.frame.Disassemble())
  error: error reading data from section __text

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

3 years ago[mlir] Do not start threads in AsyncRuntime
Eugene Zhulenev [Thu, 22 Oct 2020 15:17:53 +0000 (08:17 -0700)]
[mlir] Do not start threads in AsyncRuntime

pthreads is not enabled for all builds by default

Reviewed By: jpienaar

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

3 years ago[MemProf] Allow the binary to specify the profile output filename
Teresa Johnson [Tue, 29 Sep 2020 22:31:11 +0000 (15:31 -0700)]
[MemProf] Allow the binary to specify the profile output filename

This will allow the output directory to be specified by a build time
option, similar to the directory specified for regular PGO profiles via
-fprofile-generate=. The memory profiling instrumentation pass will
set up the variable. This is the same mechanism used by the PGO
instrumentation and runtime.

Depends on D87120 and D89629.

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

3 years ago[mlir][gpu] NFC: switch occurrences of gpu.launch_func to custom format.
Christian Sigg [Thu, 22 Oct 2020 05:43:34 +0000 (07:43 +0200)]
[mlir][gpu] NFC: switch occurrences of gpu.launch_func to custom format.

Reviewed By: herhut

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

3 years ago[AMDGPU] Fix expansion of i16 MULH
Piotr Sobczak [Thu, 22 Oct 2020 14:28:33 +0000 (16:28 +0200)]
[AMDGPU] Fix expansion of i16 MULH

This commit marks i16 MULH as expand in AMDGPU backend,
which is necessary after the refactoring in D80485.

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

3 years ago[AArch64] Add min/max cost-model tests for v2i32.
Florian Hahn [Thu, 22 Oct 2020 15:02:55 +0000 (16:02 +0100)]
[AArch64] Add min/max cost-model tests for v2i32.

3 years ago[ARM][SchedModels] Convert IsLdstsoScaledPred to MCSchedPredicate
Evgeny Leviant [Thu, 22 Oct 2020 15:03:01 +0000 (18:03 +0300)]
[ARM][SchedModels] Convert IsLdstsoScaledPred to MCSchedPredicate

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

3 years ago[X86] X86AsmParser - make methods const where possible. NFCI.
Simon Pilgrim [Thu, 22 Oct 2020 14:46:09 +0000 (15:46 +0100)]
[X86] X86AsmParser - make methods const where possible. NFCI.

Reported by cppcheck

3 years ago[X86] Return const& in IntelExprStateMachine::getIdentifierInfo(). NFCI.
Simon Pilgrim [Thu, 22 Oct 2020 13:53:30 +0000 (14:53 +0100)]
[X86] Return const& in IntelExprStateMachine::getIdentifierInfo(). NFCI.

Avoid unnecessary copy in X86AsmParser::ParseIntelOperand

3 years ago[DebugInstrRef] Pass DBG_INSTR_REFs through register allocation
Jeremy Morse [Thu, 22 Oct 2020 14:47:09 +0000 (15:47 +0100)]
[DebugInstrRef] Pass DBG_INSTR_REFs through register allocation

Both FastRegAlloc and LiveDebugVariables/greedy need to cope with
DBG_INSTR_REFs. None of them actually need to take any action, other than
passing DBG_INSTR_REFs through: variable location information doesn't refer
to any registers at this stage.

LiveDebugVariables stashes the instruction information in a tuple, then
re-creates it later. This is only necessary as the register allocator
doesn't expect to see any debug instructions while it's working. No
equivalence classes or interval splitting is required at all!

No changes are needed for the fast register allocator, as it just ignores
debug instructions. The test added checks that both of them preserve
DBG_INSTR_REFs.

This also expands ScheduleDAGInstrs.cpp to treat DBG_INSTR_REFs the same as
DBG_VALUEs when rescheduling instructions around. The current movement of
DBG_VALUEs around is less than ideal, but it's not a regression to make
DBG_INSTR_REFs subject to the same movement.

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

3 years ago[AArch64] Add min/max cost-model tests for v4i16.
Florian Hahn [Thu, 22 Oct 2020 14:47:38 +0000 (15:47 +0100)]
[AArch64] Add min/max cost-model tests for v4i16.

3 years ago[lldb] Fix TestTargetAPI.py on Apple simulators
Raphael Isemann [Thu, 22 Oct 2020 13:31:34 +0000 (15:31 +0200)]
[lldb] Fix TestTargetAPI.py on Apple simulators

This test checks that the output of `SBTarget.GetDescription()` contains the
substrings `'a.out', 'Target', 'Module', 'Breakpoint'` in that order. This test
is currently failing on Apple simulators as apparently 'Module' can't be found
in the output after 'Target".

The reason for that is that the actual output of `SBTarget.GetDescription()` looks like this:
```
Target
  Module /build/path/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_description_dwarf/a.out
0x7ff2b6d3f990:     ObjectFileMachO64, file = /build/path/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_description
[...]
0x7ff307150000:   BreakpointList with 0 Breakpoints:
<LLDB module output repeats for each loaded module>
```

Clearly the string order should be `'Target', 'Module', 'a.out', 'Breakpoint'`.
However, LLDB is also a bunch of system shared libraries (libxpc.dylib,
libobjc.A.dylib, etc.) when *not* running against a simulator, we end up
unintentionally finding the `'Target', 'Module', 'Breakpoint'` substrings in the
trailing descriptions of the system modules. When running against a simulator we
however don't load shared system libraries.

This patch just moves the substrings in the correct order to make this test pass
without having any shared library modules in the description output.

Reviewed By: JDevlieghere

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

3 years agoAMDGPU: Fix not always reserving VGPRs used for SGPR spilling
Matt Arsenault [Thu, 15 Oct 2020 22:53:56 +0000 (18:53 -0400)]
AMDGPU: Fix not always reserving VGPRs used for SGPR spilling

The VGPRs used for SGPR spills need to be reserved, even if we aren't
speculatively reserving one.

This was broken by 117e5609e98b43f925c678b72f816ad3a1c3eee7.

3 years agoAMDGPU: Implement getNoPreservedMask
Matt Arsenault [Thu, 15 Oct 2020 13:56:11 +0000 (09:56 -0400)]
AMDGPU: Implement getNoPreservedMask

We don't support funclets for exception handling and I hit this when
manually reducing MIR.

3 years agoScheduleDAGInstrs: Skip debug instructions at end of scheduling region
Matt Arsenault [Thu, 15 Oct 2020 14:44:50 +0000 (10:44 -0400)]
ScheduleDAGInstrs: Skip debug instructions at end of scheduling region

If the end instruction of the scheduling region was a DBG_VALUE, the
uses of the debug instruction were tracked as if they were real
uses. This would then hit the deadDefHasNoUse assertion in
addVRegDefDeps if the only use was the debug instruction.

3 years agoLimit debug instr-referencing tests to X86
Jeremy Morse [Thu, 22 Oct 2020 13:50:45 +0000 (14:50 +0100)]
Limit debug instr-referencing tests to X86

The instruction referencing work currently only works on X86, and all the
tests for it will be X86 based for the time being. Configure the whole
directory to be X86-only, seeing how I keep on landing tests that don't
have the correct REQUIRES lines.

3 years ago[OpenMP] Emit calls to int64_t functions for amdgcn
Jon Chesterfield [Thu, 22 Oct 2020 14:02:44 +0000 (15:02 +0100)]
[OpenMP] Emit calls to int64_t functions for amdgcn

[OpenMP] Emit calls to int64_t functions for amdgcn

Two functions, syncwarp and active_thread_mask, return lanemask_t. Currently
this is assumed to be int32, which is true for nvptx. Patch makes the type
target architecture dependent.

Reviewed By: jdoerfert

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

3 years ago[TableGen] Continue improving the comments for the data structures.
Paul C. Anagnostopoulos [Mon, 19 Oct 2020 13:20:54 +0000 (09:20 -0400)]
[TableGen] Continue improving the comments for the data structures.

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

3 years ago[mlir] Convert from Async dialect to LLVM coroutines
Eugene Zhulenev [Thu, 22 Oct 2020 12:59:05 +0000 (05:59 -0700)]
[mlir] Convert from Async dialect to LLVM coroutines

Lower from Async dialect to LLVM by converting async regions attached to `async.execute` operations into LLVM coroutines (https://llvm.org/docs/Coroutines.html):
1. Outline all async regions to functions
2. Add LLVM coro intrinsics to mark coroutine begin/end
3. Use MLIR conversion framework to convert all remaining async types and ops to LLVM + Async runtime function calls

All `async.await` operations inside async regions converted to coroutine suspension points. Await operation outside of a coroutine converted to the blocking wait operations.

Implement simple runtime to support concurrent execution of coroutines.

Reviewed By: herhut

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

3 years ago[lldb] Explicitly use the configuration architecture when building test executables
Raphael Isemann [Thu, 22 Oct 2020 13:10:22 +0000 (15:10 +0200)]
[lldb] Explicitly use the configuration architecture when building test executables

The Darwin builder currently assumes in `getArchCFlags` that the passed `arch`
value is an actual string it can string.join with vendor/os/version/env strings:

```
   triple = '-'.join([arch, vendor, os, version, env])
```

However this is not true for most tests as we just pass down the `arch=None`
default value from `TestBase.build`. This causes that if we actually end up in
this function we just error out when concatenating `None` with the other actual
strings of vendor/os/version/env. What we should do instead is check that if
there is no test-specific architecture that we fall back to the configuration's
architecture value.

It seems we already worked around this in `builder.getArchSpec` by explicitly
falling back to the architecture specified in the configuration.

This patch just moves this fallback logic to the top `build` function so that it
affects all functions called from `TestBase.build`.

Reviewed By: JDevlieghere

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

3 years ago[Clang] [TableGen] Clean up !if(!eq(bool, 1) and related booleans
Paul C. Anagnostopoulos [Wed, 21 Oct 2020 15:58:06 +0000 (11:58 -0400)]
[Clang] [TableGen] Clean up !if(!eq(bool, 1) and related booleans

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

3 years ago[CodeGen] Split MVT::changeTypeToInteger() functionality from EVT::changeTypeToInteger().
Simon Pilgrim [Thu, 22 Oct 2020 13:27:19 +0000 (14:27 +0100)]
[CodeGen] Split MVT::changeTypeToInteger() functionality from EVT::changeTypeToInteger().

Add the MVT equivalent handling for EVT changeTypeToInteger/changeVectorElementType/changeVectorElementTypeToInteger.

All the SimpleVT code already exists inside the EVT equivalents, but by splitting this out we can use these directly inside MVT types without converting to/from EVT.

3 years ago[llvm-mca] Add few ldm* instructions to cortex-a57 test case
Evgeny Leviant [Thu, 22 Oct 2020 13:21:40 +0000 (16:21 +0300)]
[llvm-mca] Add few ldm* instructions to cortex-a57 test case

3 years ago[mlir] Add MemRefReinterpretCastOp definition to Standard.
Alexander Belyaev [Thu, 22 Oct 2020 12:48:52 +0000 (14:48 +0200)]
[mlir] Add MemRefReinterpretCastOp definition to Standard.

Reuse most code for printing/parsing/verification from SubViewOp.

https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15

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

3 years ago[lldb][NFC] Make GetShellSafeArgument return std::string and unittest it.
Raphael Isemann [Thu, 22 Oct 2020 11:50:22 +0000 (13:50 +0200)]
[lldb][NFC] Make GetShellSafeArgument return std::string and unittest it.

3 years ago[AArch64] Add cost model tests for min/max intrinsics.
Florian Hahn [Thu, 22 Oct 2020 10:47:43 +0000 (11:47 +0100)]
[AArch64] Add cost model tests for min/max intrinsics.

3 years agoTest I added requires X86 to be built.
Jeremy Morse [Thu, 22 Oct 2020 12:18:55 +0000 (13:18 +0100)]
Test I added requires X86 to be built.

This the second time I've stepped on this landmine, I'll look at setting
a lit local config. All the tests in this dir are going to be X86 for now.

3 years ago[DebugInstrRef] Substitute debug value numbers to handle optimizations
Jeremy Morse [Thu, 22 Oct 2020 11:48:57 +0000 (12:48 +0100)]
[DebugInstrRef] Substitute debug value numbers to handle optimizations

This patch touches two optimizations, TwoAddressInstruction and X86's
FixupLEAs pass, both of which optimize by re-creating instructions. For
LEAs, various bits of arithmetic are better represented as LEAs on X86,
while TwoAddressInstruction sometimes converts instrs into three address
instructions if it's profitable.

For debug instruction referencing, both of these require substitutions to
be created -- the old instruction number must be pointed to the new
instruction number, as illustrated in the added test. If this isn't done,
any variable locations based on the optimized instruction are
conservatively dropped.

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

3 years ago[x86 testing] NFC: Create exhaustive vector popcnt ULT/UGT tests
David Zarzycki [Thu, 22 Oct 2020 11:50:00 +0000 (07:50 -0400)]
[x86 testing] NFC: Create exhaustive vector popcnt ULT/UGT tests

There are bunch of optimization opportunities right now in the vector
popcnt code gen when doing simple less-than/greater-than comparisons, so
let's examine them all to ensure that things don't regress as different
scenarios are fixed. We can always delete some later once some fixes are
made.

Please note: the new files were auto-generated. If people want, I can
commit the short C code that printed out the various combinations.

3 years ago[clang-tidy] Add links to check docs in comments
Alexander Kornienko [Thu, 22 Oct 2020 11:30:30 +0000 (13:30 +0200)]
[clang-tidy] Add links to check docs in comments

3 years ago[mlir] Add MemRefReshapeOp definition to Standard.
Alexander Belyaev [Wed, 21 Oct 2020 19:05:06 +0000 (21:05 +0200)]
[mlir] Add MemRefReshapeOp definition to Standard.

https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15

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

3 years ago[SCEV][NFC] Simplify internals of BackedgeTakenInfo
Max Kazantsev [Thu, 22 Oct 2020 10:29:15 +0000 (17:29 +0700)]
[SCEV][NFC] Simplify internals of BackedgeTakenInfo

3 years ago[RISCV][NFC] Add more tests for 32-bit constant materialization
Luís Marques [Thu, 22 Oct 2020 10:34:03 +0000 (11:34 +0100)]
[RISCV][NFC] Add more tests for 32-bit constant materialization

The existing tests were mostly for 64-bit constants.

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

3 years ago[gn build] Port be39a6fe6fc
LLVM GN Syncbot [Thu, 22 Oct 2020 09:39:53 +0000 (09:39 +0000)]
[gn build] Port be39a6fe6fc

3 years ago[SCEV][NFC] Rename MaxAndComplete -> ConstantMaxAndComplete
Max Kazantsev [Thu, 22 Oct 2020 09:25:16 +0000 (16:25 +0700)]
[SCEV][NFC] Rename MaxAndComplete -> ConstantMaxAndComplete

This better reflects what this variable is about.

3 years ago[X86] Add User Interrupts(UINTR) instructions
Tianqing Wang [Thu, 22 Oct 2020 08:46:07 +0000 (16:46 +0800)]
[X86] Add User Interrupts(UINTR) instructions

For more details about these instructions, please refer to the latest
ISE document:
https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference.

Reviewed By: craig.topper

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

3 years ago[llvm-mca] Improve test case
Evgeny Leviant [Thu, 22 Oct 2020 09:08:08 +0000 (12:08 +0300)]
[llvm-mca] Improve test case

3 years ago[libc++] Update continous integration scripts
Mikhail Goncharov [Fri, 9 Oct 2020 10:23:48 +0000 (12:23 +0200)]
[libc++] Update continous integration scripts

Now libc++ pipeline will be triggered from the "premerge-checks" and the
combined result are going to be returned to Harbormaster.

Reviewed-by: ldionne
Differential Revision: https://reviews.llvm.org/D89113

3 years ago[SCEV][NFC] Rename getMax -> getConstantMax
Max Kazantsev [Thu, 22 Oct 2020 08:12:54 +0000 (15:12 +0700)]
[SCEV][NFC] Rename getMax -> getConstantMax

This better reflects what this logic actually does.

3 years agoRevert "[DWARFLinker] Capitalize type names (NFC)"
Max Kazantsev [Thu, 22 Oct 2020 07:57:36 +0000 (14:57 +0700)]
Revert "[DWARFLinker] Capitalize type names (NFC)"

This reverts commit 3fce5ea7ce663410d3fb533528158bdab3a3604e.

`make check` broken.

3 years ago[InstructionSimplify] icmp (X+Y), (X+Z) simplification
Sjoerd Meijer [Wed, 21 Oct 2020 10:06:10 +0000 (11:06 +0100)]
[InstructionSimplify] icmp (X+Y), (X+Z) simplification

This improves simplifications for pattern `icmp (X+Y), (X+Z)` -> `icmp Y,Z`
if only one of the operands has NSW set, e.g.:

    icmp slt (x + 0), (x +nsw 1)

We can still safely rewrite this to:

    icmp slt 0, 1

because we know that the LHS can't overflow if the RHS has NSW set and
C1 < C2 && C1 >= 0, or C2 < C1 && C1 <= 0

This simplification is useful because ScalarEvolutionExpander which is used to
generate code for SCEVs in different loop optimisers is not always able to put
back NSW flags across control-flow, thus inhibiting CFG simplifications.

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

3 years ago[ShrinkWrap] Delete unneeded nullptr checks for the save point. NFC
Fangrui Song [Thu, 22 Oct 2020 06:44:45 +0000 (23:44 -0700)]
[ShrinkWrap] Delete unneeded nullptr checks for the save point. NFC

findNearestCommonDominator never returns nullptr.

3 years ago[DWARFLinker] Capitalize type names (NFC)
Jonas Devlieghere [Thu, 22 Oct 2020 07:13:53 +0000 (00:13 -0700)]
[DWARFLinker] Capitalize type names (NFC)

Make these types conform to the LLVM Coding Standards:

> Type names (including classes, structs, enums, typedefs, etc) should
> be nouns and start with an upper-case letter.

3 years ago[driver][arm64] Set target CPU to A12 for compiler invocations that
Alex Lorenz [Thu, 22 Oct 2020 05:43:10 +0000 (22:43 -0700)]
[driver][arm64] Set target CPU to A12 for compiler invocations that
target Apple Silicon macOS machines

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

3 years ago[libcxx] [test] Move use of statvfs to helper header
Martin Storsjö [Wed, 21 Oct 2020 10:42:48 +0000 (13:42 +0300)]
[libcxx] [test] Move use of statvfs to helper header

Implement the corresponding thing using windows functions as well.

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

3 years ago[libcxx] [test] Mark bits of fs.enum tests as libcpp specific
Martin Storsjö [Wed, 21 Oct 2020 07:37:59 +0000 (10:37 +0300)]
[libcxx] [test] Mark bits of fs.enum tests as libcpp specific

The individual enum values in copy_options and file_type aren't
specified in the standard.

The standard doesn't require fs::path::format to be a scoped enum.

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

3 years ago[libcxx] [test] Add another (void) cast for a function marked nodiscard in MS STL
Martin Storsjö [Wed, 21 Oct 2020 08:44:51 +0000 (11:44 +0300)]
[libcxx] [test] Add another (void) cast for a function marked nodiscard in MS STL

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

3 years ago[libcxxabi] Define _LIBCXXABI_WEAK properly for mingw compilers
Martin Storsjö [Wed, 21 Oct 2020 06:11:31 +0000 (09:11 +0300)]
[libcxxabi] Define _LIBCXXABI_WEAK properly for mingw compilers

Copy over the compiler detection structure from libcxx, and set
_LIBCXXABI_WEAK like _LIBCPP_WEAK is set in libcxx.

This allows users to override operator new/delete, if using those
operators from libcxxabi instead of from libcxx.

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

3 years ago[NFC][AMDGPU] Reorder SIMemoryLegalizer functions to be consistent
Tony [Wed, 21 Oct 2020 13:30:02 +0000 (13:30 +0000)]
[NFC][AMDGPU] Reorder SIMemoryLegalizer functions to be consistent

- Make the SIMemoryLegalizer insertAcquire function be in the same
  order for each target to be consistent.

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

3 years agoRevert "Add "not" to an llvm-symbolizer test that expects to fail"
Douglas Yung [Thu, 22 Oct 2020 04:57:59 +0000 (21:57 -0700)]
Revert "Add "not" to an llvm-symbolizer test that expects to fail"

A recent commit to revert llvm-symbolizer changes forgot to revert this test fix.

This reverts commit 5e656ee48bccc73f1328db1770770acaec90a7c9.

3 years ago[test] Fix tests using -analyze that fail under NPM
Arthur Eubanks [Thu, 22 Oct 2020 04:52:27 +0000 (21:52 -0700)]
[test] Fix tests using -analyze that fail under NPM

Many of these tests don't use the output of -analyze.

3 years ago[IRCE] consolidate profitability check
Serguei Katkov [Tue, 20 Oct 2020 06:28:20 +0000 (13:28 +0700)]
[IRCE] consolidate profitability check

Use BFI if it is available and BPI otherwise.
This is a promised follow-up after D89541.

Reviewers: ebrevnov, mkazantsev
Reviewed By: ebrevnov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D89773

3 years ago[test] Fix shrunk-constant.ll under NPM
Arthur Eubanks [Thu, 22 Oct 2020 04:19:02 +0000 (21:19 -0700)]
[test] Fix shrunk-constant.ll under NPM

3 years agoDo not intercept __libc_memalign and cfree on Android because neither of these exists...
Vy Nguyen [Sat, 17 Oct 2020 06:24:10 +0000 (02:24 -0400)]
Do not intercept __libc_memalign and cfree on Android because neither of these exists in Bionic.

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

3 years ago[NPM][opt] Disallow -analyze under NPM
Arthur Eubanks [Thu, 22 Oct 2020 03:17:12 +0000 (20:17 -0700)]
[NPM][opt] Disallow -analyze under NPM

-analyze does not work with the NPM.
'print<foo>' passes should be used instead.

3 years agoFix test failure on Windows.
Richard Smith [Thu, 22 Oct 2020 03:02:07 +0000 (20:02 -0700)]
Fix test failure on Windows.

3 years ago[sanitizer] Allow log_path to distinguish default from explicit stderr
Teresa Johnson [Sat, 17 Oct 2020 17:40:03 +0000 (10:40 -0700)]
[sanitizer] Allow log_path to distinguish default from explicit stderr

Split out of D89086 as suggested.

Change the default of the log_path flag to nullptr, and the code
consuming that flag (ReportFile::SetReportPath), to treat nullptr as
stderr (so no change to the behavior of existing users). This allows
code to distinguish between the log_path being specified explicitly as
stderr vs the default.

This is so the flag can be used to override the new report path variable
that will be encoded in the binary for memprof for runtime testing.

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

3 years ago[X86] Support customizing stack protector guard
Xiang1 Zhang [Thu, 22 Oct 2020 01:46:42 +0000 (09:46 +0800)]
[X86] Support customizing stack protector guard

Reviewed By: nickdesaulniers, MaskRay

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

3 years ago[test] Fix LoopDistribute tests under NPM
Arthur Eubanks [Thu, 22 Oct 2020 02:05:01 +0000 (19:05 -0700)]
[test] Fix LoopDistribute tests under NPM

3 years ago[LSR] add testcase for LSR profitable chain change, nfc
Chen Zheng [Thu, 22 Oct 2020 01:53:55 +0000 (21:53 -0400)]
[LSR] add testcase for LSR profitable chain change, nfc

3 years agoEnsure that the "value" of an unnamed bit-field isn't taken into
Richard Smith [Thu, 22 Oct 2020 01:50:43 +0000 (18:50 -0700)]
Ensure that the "value" of an unnamed bit-field isn't taken into
account when determining the identity of a class NTTP.

3 years ago[test] Fix LoopDeletion tests under NPM
Arthur Eubanks [Thu, 22 Oct 2020 01:31:06 +0000 (18:31 -0700)]
[test] Fix LoopDeletion tests under NPM

3 years ago[FPEnv][X86][SystemZ] Use different algorithms for i64->double uint_to_fp under stric...
Craig Topper [Wed, 21 Oct 2020 23:45:23 +0000 (16:45 -0700)]
[FPEnv][X86][SystemZ] Use different algorithms for i64->double uint_to_fp under strictfp to avoid producing -0.0 when rounding toward negative infinity

Some of our conversion algorithms produce -0.0 when converting unsigned i64 to double when the rounding mode is round toward negative. This switches them to other algorithms that don't have this problem. Since it is undefined behavior to change rounding mode with the non-strict nodes, this patch only changes the behavior for strict nodes.

There are still problems with unsigned i32 conversions too which I'll try to fix in another patch.

Fixes part of PR47393

Reviewed By: efriedma

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

3 years agoMake APValue profiling a little more compact.
Richard Smith [Thu, 22 Oct 2020 01:04:04 +0000 (18:04 -0700)]
Make APValue profiling a little more compact.

3 years ago[sanitizer]Update tests to be compatible with Android.
Vy Nguyen [Wed, 21 Oct 2020 19:07:52 +0000 (12:07 -0700)]
[sanitizer]Update tests to be compatible with Android.

Split off from D89251

Reviewed By: vitalybuka

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

3 years agoRevert "Revert "SimplifyCFG: Clean up optforfuzzing implementation""
Zequan Wu [Thu, 22 Oct 2020 00:08:56 +0000 (17:08 -0700)]
Revert "Revert "SimplifyCFG: Clean up optforfuzzing implementation""

This reverts commit 716f7636e1ec7880a6d2f2205f54f65191cf8f9a.

3 years agoRevert "SimplifyCFG: Clean up optforfuzzing implementation"
Zequan Wu [Wed, 21 Oct 2020 23:56:32 +0000 (16:56 -0700)]
Revert "SimplifyCFG: Clean up optforfuzzing implementation"

See discussion: https://reviews.llvm.org/D89590
This reverts commit cdd006eec9409923f9a56b9026ce2cb72e7b71dc.

3 years ago[NFC] Set return type of getStackPointerRegisterToSaveRestore to Register
Gaurav Jain [Wed, 21 Oct 2020 08:15:13 +0000 (01:15 -0700)]
[NFC] Set return type of getStackPointerRegisterToSaveRestore to Register

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

3 years agoRevert several changes related to llvm-symbolizer exiting non-zero on failure.
David Blaikie [Wed, 21 Oct 2020 22:16:14 +0000 (15:16 -0700)]
Revert several changes related to llvm-symbolizer exiting non-zero on failure.

Seems users have enough different uses of the symbolizer where they
might have unknown binaries and offsets such that "best effort" behavior
is all that's expected of llvm-symbolizer - so even erroring on unknown
executables and out of bounds offsets might not be suitable.

This reverts commit 1de0199748ef2a20cd146c100ea1b8e6726c4767.
This reverts commit a7b209a6d40d77b43a38664b1fe64513587f24c6.
This reverts commit 338dd138ea4a70b52ab48e0c8aa38ec152b3569a.

3 years ago[ValueTracking] Interpret GEPs as a series of adds multiplied by the related scaling...
Quentin Colombet [Tue, 20 Oct 2020 21:43:25 +0000 (14:43 -0700)]
[ValueTracking] Interpret GEPs as a series of adds multiplied by the related scaling factor

Prior to this patch, computeKnownBits would only try to deduce trailing zeros
bits for getelementptrs. This patch adds the logic to treat geps as a series
of add * scaling factor.

Thanks to this patch, using a gep or performing an address computation
directly "by hand" (ptrtoint followed by adds and mul followed by inttoptr)
offers the same computeKnownBits information.

Previously, the "by hand" approach would have given more information.

This is related to https://llvm.org/PR47241.

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

3 years ago[c++20] For P0732R2: permit class template argument deduction for non-type template...
Richard Smith [Mon, 14 Sep 2020 03:15:46 +0000 (20:15 -0700)]
[c++20] For P0732R2: permit class template argument deduction for non-type template parameters.

3 years ago[libc++] Fix the benchmarks build
Louis Dionne [Wed, 21 Oct 2020 21:55:35 +0000 (17:55 -0400)]
[libc++] Fix the benchmarks build

3 years ago[libc++][ci] Also install the library in the CI scripts
Louis Dionne [Wed, 21 Oct 2020 17:57:05 +0000 (13:57 -0400)]
[libc++][ci] Also install the library in the CI scripts

It's good to run the installation step to make sure it works properly,
as build system changes can break that.

3 years ago[mlir] Simplify DDR matching patterns with equal operands for operators where it...
rdzhabarov [Tue, 20 Oct 2020 04:51:41 +0000 (04:51 +0000)]
[mlir] Simplify DDR matching patterns with equal operands for operators where it's applicable. Added documentation.

This https://reviews.llvm.org/D89254 diff introduced implicit matching between same name operands.

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

3 years agoAlways allow std::function to be copied.
Felix Berger [Tue, 13 Oct 2020 17:32:53 +0000 (13:32 -0400)]
Always allow std::function to be copied.

Since its call operator is const but can modify the state of its underlying
functor we cannot tell whether the copy is necessary or not.

This avoids false positives.

Reviewed-by: aaron.ballman, gribozavr2
Differential Revision: https://reviews.llvm.org/D89332

3 years ago[c++20] For P0732R2: Give class NTTPs the proper type when examined with 'decltype'.
Richard Smith [Mon, 14 Sep 2020 02:38:32 +0000 (19:38 -0700)]
[c++20] For P0732R2: Give class NTTPs the proper type when examined with 'decltype'.

This requires that we track enough information to determine the original
type of the parameter in a substituted non-type template parameter, to
distinguish the reference-to-class case from the class case.

3 years ago[OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts
Joseph Huber [Wed, 21 Oct 2020 13:55:21 +0000 (09:55 -0400)]
[OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

The changes made in D88594 caused the test OpenMP/driver.c to fail on a 32-bit host becuase it was offloading to a 64-bit architecture by default. The offloading test was moved to a new file and a feature was added to the lit config to check for a 64-bit host.

Reviewed By: daltenty

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

3 years ago[libc++] Fix compiler-rt build by copying libc++ headers to <build>/include
Louis Dionne [Wed, 21 Oct 2020 20:52:21 +0000 (16:52 -0400)]
[libc++] Fix compiler-rt build by copying libc++ headers to <build>/include

This commit should really be named "Workaround external projects depending
on libc++ build system implementation details". It seems that the compiler-rt
build (and perhaps other projects) is relying on the fact that we copy libc++
and libc++abi headers to `<build-root>/include/c++/v1`. This was changed
by 5d796645, which moved the headers to `<build-root>/projects/libcxx/include/c++/v1`
and broke the compiler-rt build.

I'm committing this workaround to fix the compiler-rt build, but we should
remove reliance on implementation details like that. The correct way to
setup the compiler-rt build would be to "link" against the `cxx-headers`
target in CMake, or to run `install-cxx-headers` using an appropriate
installation prefix, and then manually add a `-I` path to that location.

3 years ago[spirv] Fix legalize standard to spir-v for transfer ops
Thomas Raoux [Wed, 21 Oct 2020 20:42:29 +0000 (13:42 -0700)]
[spirv] Fix legalize standard to spir-v for transfer ops

Forward missing attributes when creating the new transfer op otherwise the
builder would use default values.

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

3 years agoSimple fix to basic-block-sections to replace emit-obj with emit-llvm
Sriraman Tallam [Wed, 21 Oct 2020 20:38:55 +0000 (13:38 -0700)]
Simple fix to basic-block-sections to replace emit-obj with emit-llvm

emit-obj is unnecessary here and further wasn't redirected to /dev/null.

3 years ago[test] Fix quadradic-exit-value.ll under NPM
Arthur Eubanks [Wed, 21 Oct 2020 20:33:01 +0000 (13:33 -0700)]
[test] Fix quadradic-exit-value.ll under NPM

3 years ago[test] Fix alloca-offset-lifetime.ll under NPM
Arthur Eubanks [Wed, 21 Oct 2020 20:30:45 +0000 (13:30 -0700)]
[test] Fix alloca-offset-lifetime.ll under NPM

3 years ago[mlir] Add missing dependency for MLIRSCFTransforms
Lei Zhang [Wed, 21 Oct 2020 20:22:41 +0000 (16:22 -0400)]
[mlir] Add missing dependency for MLIRSCFTransforms

MLIRTransforms is needed to provide BufferizeTypeConverter
definitions.

3 years agoAdd more test coverage for APValue serialization / deserialization and
Richard Smith [Wed, 21 Oct 2020 19:59:08 +0000 (12:59 -0700)]
Add more test coverage for APValue serialization / deserialization and
fix a few exposed bugs.

3 years ago[c++20] For P0732R2 / P1907R1: Basic frontend support for class types as
Richard Smith [Mon, 21 Sep 2020 06:16:08 +0000 (23:16 -0700)]
[c++20] For P0732R2 / P1907R1: Basic frontend support for class types as
non-type template parameters.

Create a unique TemplateParamObjectDecl instance for each such value,
representing the globally unique template parameter object to which the
template parameter refers.

No IR generation support yet; that will follow in a separate patch.

3 years ago[test] Fix no-wrap-symbolic-becount.ll under NPM
Arthur Eubanks [Wed, 21 Oct 2020 20:14:44 +0000 (13:14 -0700)]
[test] Fix no-wrap-symbolic-becount.ll under NPM

3 years ago[libcxxabi] Stub out 'sleep' call when _LIBCXXABI_HAS_NO_THREADS is defined.
Hafiz Abid Qadeer [Wed, 21 Oct 2020 19:56:24 +0000 (20:56 +0100)]
[libcxxabi] Stub out 'sleep' call when _LIBCXXABI_HAS_NO_THREADS is defined.

While running this test on a bare metal target, I got an error as 'sleep' was not available on that system. As 'sleep' call is not doing anything useful for cases when _LIBCXXABI_HAS_NO_THREADS is defined. This patch puts it under this check.

Reviewed By: ldionne

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