]> granicus.if.org Git - llvm/log
llvm
5 years ago[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:58 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
f. `((x << MaskShAmt) a>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
f. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

Normally, the inner pattern is sign-extend,
but for our purposes it's no different to other patterns:

alive proofs:
f: https://rise4fun.com/Alive/7U3

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366540 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:47 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
e. `((x << MaskShAmt) l>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
e. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
e: https://rise4fun.com/Alive/0FT

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366539 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:37 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
d. `(x & ((-1 << MaskShAmt) >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
d. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
d: https://rise4fun.com/Alive/I5Y

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366538 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:25 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
c. `(x & (-1 >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
c. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
c: https://rise4fun.com/Alive/RgJh

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366537 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:13 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
b. `(x & (~(-1 << maskNbits))) << shiftNbits`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
b. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
b: https://rise4fun.com/Alive/y8M

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366536 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:25:43 +0000 (08:25 +0000)]
[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
a. `(x & ((1 << MaskShAmt) - 1)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
a. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
a: https://rise4fun.com/Alive/wi9

Indeed, not all of these patterns are canonical.
But since this fold will only produce a single instruction
i'm really interested in handling even uncanonical patterns,
since i have this general kind of pattern in hotpaths,
and it is not totally outlandish for bit-twiddling code.

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

Reviewers: spatel, nikic, huihuiz, xbolva00

Reviewed By: xbolva00

Subscribers: efriedma, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366535 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h
Hubert Tong [Fri, 19 Jul 2019 07:21:59 +0000 (07:21 +0000)]
[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366533 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Some fields do not need relocations even relax is enabled.
Hsiangkai Wang [Fri, 19 Jul 2019 06:10:36 +0000 (06:10 +0000)]
[DebugInfo] Some fields do not need relocations even relax is enabled.

In debug frame information, some fields, e.g., Length in CIE/FDE and
Offset in FDE are attributes to describe the structure of CIE/FDE. They
are not related to the relaxed code. However, these attributes are
symbol differences. So, in current design, these attributes will be
filled as zero and LLVM generates relocations for them.

We only need to generate relocations for symbols in executable sections.
So, if the symbols are not located in executable sections, we still
evaluate their values under relaxation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366531 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agounbreak links
Chris Lattner [Fri, 19 Jul 2019 05:49:11 +0000 (05:49 +0000)]
unbreak links

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366530 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoreplace the old kaleidoscope tutorial files with orphaned pages that forward to the...
Chris Lattner [Fri, 19 Jul 2019 05:23:17 +0000 (05:23 +0000)]
replace the old kaleidoscope tutorial files with orphaned pages that forward to the new copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366529 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPoint to the dusted off version of the kaleidoscope tutorial.
Chris Lattner [Fri, 19 Jul 2019 05:15:57 +0000 (05:15 +0000)]
Point to the dusted off version of the kaleidoscope tutorial.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366528 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test] [llvm-objcopy] Fix broken test case
Alex Brachet [Fri, 19 Jul 2019 02:31:21 +0000 (02:31 +0000)]
[test] [llvm-objcopy] Fix broken test case

Summary: The test case added in D62718 did not work unless the user was root because write bits were not set for the output file. This change uses only permissions with user write (0200) to ensure tests pass regardless of the users permissions.

Reviewers: jhenderson, rupprecht, MaskRay, espindola, alexshap

Reviewed By: MaskRay

Subscribers: emaste, arichardson, jakehehrlich, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366527 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][PowerPC] Modify the test case add_cmp.ll
Kang Zhang [Fri, 19 Jul 2019 02:23:26 +0000 (02:23 +0000)]
[NFC][PowerPC] Modify the test case add_cmp.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366526 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
Hsiangkai Wang [Fri, 19 Jul 2019 02:03:34 +0000 (02:03 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366524 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse the MachineBasicBlock symbol for a callbr target
Bill Wendling [Fri, 19 Jul 2019 01:10:28 +0000 (01:10 +0000)]
Use the MachineBasicBlock symbol for a callbr target

Summary:
Inline asm doesn't use labels when compiled as an object file. Therefore, we
shouldn't create one for the (potential) callbr destination. Instead, use the
symbol for the MachineBasicBlock.

Reviewers: nickdesaulniers, craig.topper

Reviewed By: nickdesaulniers

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366523 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legali...
Amara Emerson [Fri, 19 Jul 2019 00:24:45 +0000 (00:24 +0000)]
[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legalize later.

I plan on adding memcpy optimizations in the GlobalISel pipeline, but we can't
do that unless we delay lowering to actual function calls. This patch changes
the translator to generate G_INTRINSIC_W_SIDE_EFFECTS for these functions, and
then have each target specify that using the new custom legalizer for intrinsics
hook that they want it expanded it a libcall.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366516 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Fix typo where a varible was checked for Apple instead of Darwin
Nathan Lanza [Fri, 19 Jul 2019 00:20:58 +0000 (00:20 +0000)]
[cmake] Fix typo where a varible was checked for Apple instead of Darwin

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366515 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Convert the NATIVE llvm build process to be project agnostic
Nathan Lanza [Fri, 19 Jul 2019 00:10:06 +0000 (00:10 +0000)]
[cmake] Convert the NATIVE llvm build process to be project agnostic

lldb recently added a tablegen tool. In order to properly cross compile
lldb standalone there needs to be a mechanism to generate the native
lldb build, analgous to what's done for the NATIVE llvm build. Thus,
we can simply modify this setup to allow for any project to be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366514 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReapply [llvm-lipo] Implement -create (with hardcoded alignments)
Shoaib Meenai [Thu, 18 Jul 2019 22:48:38 +0000 (22:48 +0000)]
Reapply [llvm-lipo] Implement -create (with hardcoded alignments)

This reapplies r366142 with a fix for the failing Windows test.

Original commit message:

Creates universal binary output file from input files. Currently uses
hard coded value for alignment.  Want to get the create functionality
approved before implementing the alignment function.

Patch by Anusha Basana <anusha.basana@gmail.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366512 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Drop Reg32 and use regular AsmName
Stanislav Mekhanoshin [Thu, 18 Jul 2019 22:18:33 +0000 (22:18 +0000)]
[AMDGPU] Drop Reg32 and use regular AsmName

This allows to reduce generated AMDGPUGenAsmWriter.inc by ~100Kb.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366505 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel][AArch64] Add support for base register + offset register loads
Jessica Paquette [Thu, 18 Jul 2019 21:50:11 +0000 (21:50 +0000)]
[GlobalISel][AArch64] Add support for base register + offset register loads

Add support for folding G_GEPs into loads of the form

```
ldr reg, [base, off]
```

when possible. This can save an add before the load. Currently, this is only
supported for loads of 64 bits into 64 bit registers.

Add a new addressing mode function, `selectAddrModeRegisterOffset` which
performs this folding when it is profitable.

Also add a test for addressing modes for G_LOAD.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366503 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCodeGen: Allow !associated metadata to point to aliases.
Peter Collingbourne [Thu, 18 Jul 2019 21:37:16 +0000 (21:37 +0000)]
CodeGen: Allow !associated metadata to point to aliases.

This is a small extension of !associated, mostly useful for the implementation
convenience of instrumentation passes that RAUW globals with aliases, such
as LowerTypeTests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366502 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [X86] EltsFromConsecutiveLoads - support common source loads
Reid Kleckner [Thu, 18 Jul 2019 21:26:41 +0000 (21:26 +0000)]
Revert [X86] EltsFromConsecutiveLoads - support common source loads

This reverts r366441 (git commit 48104ef7c9c653bbb732b66d7254957389fea337)

This causes clang to fail to compile some file in Skia. Reduction soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366501 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 21:17:52 +0000 (21:17 +0000)]
[WebAssembly] Fix __builtin_wasm_tls_base intrinsic

Summary:
Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.

Also marked the intrinsic pure, per @sunfish's suggestion.

Reviewers: tlively, aheejin, sbc100, sunfish

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits, sunfish

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366499 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Only run llvm-codesign if targetting apple on an apple host
Nathan Lanza [Thu, 18 Jul 2019 21:14:26 +0000 (21:14 +0000)]
[cmake] Only run llvm-codesign if targetting apple on an apple host

Summary:
Other platforms don't have the capability to perform llvm_codesign
step. If LLVM_CODESIGNING_IDENTITY is set then this chunk of code would
attempt to codesign if the target was Apple. But when cross compiling
to Darwin from Linux, for example, this step would fail. So test if the
host is Apple as well.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366498 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typo in r366494. Spotted by Yuanfang Chen.
Peter Collingbourne [Thu, 18 Jul 2019 21:03:37 +0000 (21:03 +0000)]
Fix typo in r366494. Spotted by Yuanfang Chen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366497 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove the static initialize introduced in r365099
Steven Wu [Thu, 18 Jul 2019 21:01:21 +0000 (21:01 +0000)]
Remove the static initialize introduced in r365099

Summary:
Some polish for r365099 which adds a static initializer to
MachOObjectFile. Remove it by moving it to file scope.

Reviewers: smeenai, alexshap, compnerd, mtrent, anushabasana

Reviewed By: smeenai

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366496 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoIR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.
Peter Collingbourne [Thu, 18 Jul 2019 20:56:21 +0000 (20:56 +0000)]
IR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.

This causes sections with relative pointers to be marked as read only,
which means that they won't end up sharing pages with writable data.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366494 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r366458.
Peter Collingbourne [Thu, 18 Jul 2019 20:14:16 +0000 (20:14 +0000)]
gn build: Merge r366458.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366487 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFileSystem: Check for DTTOIF alone, not _DIRENT_HAVE_D_TYPE
Jordan Rose [Thu, 18 Jul 2019 20:05:11 +0000 (20:05 +0000)]
FileSystem: Check for DTTOIF alone, not _DIRENT_HAVE_D_TYPE

While 'd_type' is a non-standard extension to `struct dirent`, only
glibc signals its presence with a macro '_DIRENT_HAVE_D_TYPE'.
However, any platform with 'd_type' also includes a way to convert to
mode_t values using the macro 'DTTOIF', so we can check for that alone
and still be confident that the 'd_type' member exists.

(If this turns out to be wrong, I'll go back and set up an actual
CMake check.)

I couldn't think of how to write a test for this, because I couldn't
think of how to test that a 'stat' call doesn't happen without
controlling the filesystem or intercepting 'stat', and there's no good
cross-platform way to do that that I know of.

Follow-up (almost a year later) to r342089.

rdar://problem/50592673
https://reviews.llvm.org/D64940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366486 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Suppress an ORCv1 deprecation warning.
Lang Hames [Thu, 18 Jul 2019 19:55:42 +0000 (19:55 +0000)]
[ORC] Suppress an ORCv1 deprecation warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366485 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix C++ modules build
Raphael Isemann [Thu, 18 Jul 2019 18:33:40 +0000 (18:33 +0000)]
Fix C++ modules build

llvm-svn: 366344 missed an include that broke the LLVM_ENABLE_MODULES
build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366481 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[COFF] Change a variable type to be const in the HeapAllocSite map.
Amy Huang [Thu, 18 Jul 2019 18:22:52 +0000 (18:22 +0000)]
[COFF] Change a variable type to be const in the HeapAllocSite map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366479 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FPEnv] Teach the IRBuilder about constrained FPTrunc and FPExt
Kevin P. Neal [Thu, 18 Jul 2019 18:01:57 +0000 (18:01 +0000)]
[FPEnv] Teach the IRBuilder about constrained FPTrunc and FPExt

The IRBuilder doesn't know that FPTrunc and FPExt have constrained
equivalents. Add the support by building on the strict FP mode now
present in the IRBuilder.

Reviewed by: John McCall
Approved by: John McCall
Differential Revision: https://reviews.llvm.org/D64934

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366477 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Implement __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 17:53:22 +0000 (17:53 +0000)]
[WebAssembly] Implement __builtin_wasm_tls_base intrinsic

Summary:
Add `__builtin_wasm_tls_base` so that LeakSanitizer can find the thread-local
block and scan through it for memory leaks.

Reviewers: tlively, aheejin, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366475 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LAA] Re-check bit-width of pointers after stripping.
Michael Liao [Thu, 18 Jul 2019 17:30:27 +0000 (17:30 +0000)]
[LAA] Re-check bit-width of pointers after stripping.

Summary:
- As the pointer stripping now tracks through `addrspacecast`, prepare
  to handle the bit-width difference from the result pointer.

Reviewers: jdoerfert

Subscribers: jvesely, nhaehnle, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366470 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.
Yuanfang Chen [Thu, 18 Jul 2019 17:04:28 +0000 (17:04 +0000)]
[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.

Restore printDynamicString removed in rL363868. It provides better
error handling whenever indexing dynamic string table is needed.

Reviewers: jhenderson, MaskRay, grimar

Reviewed by: jhenderson, MaskRay, grimar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366464 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMC: AArch64: Add support for prel_g* relocation specifiers.
Peter Collingbourne [Thu, 18 Jul 2019 16:54:33 +0000 (16:54 +0000)]
MC: AArch64: Add support for prel_g* relocation specifiers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366462 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.
Peter Collingbourne [Thu, 18 Jul 2019 16:51:53 +0000 (16:51 +0000)]
AArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.

There doesn't seem to be a practical reason for these instructions to have
different restrictions on the types of relocations that they may be used
with, notwithstanding the language in the ELF AArch64 spec that implies that
specific relocations are meant to be used with specific instructions.

For example, we currently forbid the first instruction in the following
sequence, despite it currently being used by clang to generate a global
reference under -mcmodel=large:

movz x0, #:abs_g0_nc:foo
movk x0, #:abs_g1_nc:foo
movk x0, #:abs_g2_nc:foo
movk x0, #:abs_g3:foo

Therefore, allow MOVK/MOVN/MOVZ to accept the union of the set of relocations
that they currently accept individually.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366461 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMinor styling fix. NFC.
Michael Liao [Thu, 18 Jul 2019 16:14:22 +0000 (16:14 +0000)]
Minor styling fix. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366456 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Don't set Python_ADDITIONAL_VERSIONS
Jonas Devlieghere [Thu, 18 Jul 2019 15:17:42 +0000 (15:17 +0000)]
[CMake] Don't set Python_ADDITIONAL_VERSIONS

Until recently, Python_ADDITIONAL_VERSIONS was used to limit LLVM's
Python support to 2.7. Now that both LLVM and LLDB both support Python
3, there's no longer a need to put an arbitrary limit on this.

However, instead of removing the variable, r365692 expanded the list,
which has the (presumably unintentional) side-effect of expression
preference for Python 3.

Instead, as Michal proposed in the original code review, we should just
not set the list at all, and let CMake pick whatever Python interpreter
you have in your path.

This patch removes the Python_ADDITIONAL_VERSIONS variable in llvm,
clang and lld. I've also updated the docs with the default behavior and
how to force a different Python version to be used.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366447 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."
Hsiangkai Wang [Thu, 18 Jul 2019 15:06:50 +0000 (15:06 +0000)]
Revert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."

This reverts commit 17e3cbf5fe656483d9016d0ba9e1d0cd8629379e.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366444 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
Hsiangkai Wang [Thu, 18 Jul 2019 14:47:34 +0000 (14:47 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366442 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] EltsFromConsecutiveLoads - support common source loads
Simon Pilgrim [Thu, 18 Jul 2019 14:33:25 +0000 (14:33 +0000)]
[X86] EltsFromConsecutiveLoads - support common source loads

This patch enables us to find the source loads for each element, splitting them into a Load and ByteOffset, and attempts to recognise consecutive loads that are in fact from the same source load.

A helper function, findEltLoadSrc, recurses to find a LoadSDNode and determines the element's byte offset within it. When attempting to match consecutive loads, byte offsetted loads then attempt to matched against a previous load that has already been confirmed to be a consecutive match.

Next step towards PR16739 - after this we just need to account for shuffling/repeated elements to create a vector load + shuffle.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366441 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombine] Pull getSubVectorSrc helper out of narrowInsertExtractVectorBinOp. NFCI.
Simon Pilgrim [Thu, 18 Jul 2019 13:45:53 +0000 (13:45 +0000)]
[DAGCombine] Pull getSubVectorSrc helper out of narrowInsertExtractVectorBinOp. NFCI.

NFC step towards reusing this in other EXTRACT_SUBVECTOR combines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366435 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FileCheck] Fix numeric variable redefinition
Thomas Preud'homme [Thu, 18 Jul 2019 13:39:04 +0000 (13:39 +0000)]
[FileCheck] Fix numeric variable redefinition

Summary:
Commit r365249 changed usage of FileCheckNumericVariable to have one
instance of that class per variable as opposed to one instance per
definition of a given variable as was done before. However, it retained
the safety check in setValue that it should only be called with the
variable unset, even after r365625.

However this causes assert failure when a non-pseudo variable is being
redefined. And while redefinition of @LINE at each CHECK line work in
the general case, it caused problem when a substitution failed (fixed in
r365624) and still causes problem when a CHECK line does not match since
@LINE's value is cleared after substitutions in match() happened but
printSubstitutions also attempts a substitution.

This commit solves the root of the problem by changing setValue to set a
new value regardless of whether a value was set or not, thus fixing all
the aforementioned issues.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366434 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)
Sanjay Patel [Thu, 18 Jul 2019 12:48:01 +0000 (12:48 +0000)]
[x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)

LEA doesn't affect flags, so use it more liberally to replace an ADD when
we know that the ADD operands affect flags.

In the motivating example from PR40483:
https://bugs.llvm.org/show_bug.cgi?id=40483
...this lets us avoid duplicating a math op just to avoid flag conflict.

As mentioned in the TODO comments, this heuristic can be extended to
fire more often if that leads to more improvements.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366431 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readelf] - Remove the precompiled binary from gnu-hash-symbols.test
George Rimar [Thu, 18 Jul 2019 12:14:36 +0000 (12:14 +0000)]
[llvm-readelf] - Remove the precompiled binary from gnu-hash-symbols.test

I am working on https://bugs.llvm.org/show_bug.cgi?id=42622
and this patch reworks the gnu-hash-symbols.test so that it
will be easier to expand it with x86_64 case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366430 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoBump the trunk version to 10.0.0svn
Hans Wennborg [Thu, 18 Jul 2019 11:51:05 +0000 (11:51 +0000)]
Bump the trunk version to 10.0.0svn

and clear the release notes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366427 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][DAGCOMBINE][FIX] PerformVMOVRRDCombine
Diogo N. Sampaio [Thu, 18 Jul 2019 10:05:56 +0000 (10:05 +0000)]
[ARM][DAGCOMBINE][FIX] PerformVMOVRRDCombine

Summary:
PerformVMOVRRDCombine ommits adding a offset
of 4 to the PointerInfo, when converting a
f64 = load[M]
to
{i32, i32} = {load[M], load[M + 4]}

Which would allow the machine scheduller
to break dependencies with the second load.

 - pr42638

Reviewers: eli.friedman, dmgreen, ostannard

Reviewed By: ostannard

Subscribers: ostannard, javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366423 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SCEV] add no wrap flag for SCEVAddExpr.
Chen Zheng [Thu, 18 Jul 2019 09:23:19 +0000 (09:23 +0000)]
[SCEV] add no wrap flag for SCEVAddExpr.
Differential Revision: https://reviews.llvm.org/D64868

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366419 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Reset NoPHIS MachineFunctionProperty in emitSelectPseudo
Alex Bradbury [Thu, 18 Jul 2019 07:52:41 +0000 (07:52 +0000)]
[RISCV] Reset NoPHIS MachineFunctionProperty in emitSelectPseudo

We insered PHIS were there were none before, so the property must be
reset. This error was found on an EXPENSIVE_CHECKS build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366412 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopInfo] Use early return in branch weight update functions. NFC.
Serguei Katkov [Thu, 18 Jul 2019 07:36:20 +0000 (07:36 +0000)]
[LoopInfo] Use early return in branch weight update functions. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366411 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV][DebugInfo] Fix dwarf-riscv-relocs.ll test on Windows
Alex Bradbury [Thu, 18 Jul 2019 07:25:56 +0000 (07:25 +0000)]
[RISCV][DebugInfo] Fix dwarf-riscv-relocs.ll test on Windows

Windows sees DW_AT_decl_file (".\dwarf-riscv-relocs.c") while Linux sees
DW_AT_decl_file ("./dwarf-riscv-relocs.c").

This fixes a failure introduced in rL366402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366410 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][PowerPC] Add the test to test the pass block-placement
Kang Zhang [Thu, 18 Jul 2019 06:56:49 +0000 (06:56 +0000)]
[NFC][PowerPC] Add the test to test the pass block-placement

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366407 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Disable combineConcatVectors for vXi1 vectors.
Craig Topper [Thu, 18 Jul 2019 06:18:06 +0000 (06:18 +0000)]
[X86] Disable combineConcatVectors for vXi1 vectors.

I'm not convinced the code this calls is properly vetted for
vXi1 vectors. Experimental vector widening legalization testing
for D55251 is now hitting an assertion failure inside
EltsFromConsecutiveLoads. This is occurring from a v2i1 load
having a store size different than its VT size. Hopefully
this commit will keep such issues from happening.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366405 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typo in programmer's manual cantFile -> cantFail
Nathan Lanza [Thu, 18 Jul 2019 05:24:22 +0000 (05:24 +0000)]
Fix typo in programmer's manual cantFile -> cantFail

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366403 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF][RISCV] Add support for RISC-V relocations needed for debug info
Alex Bradbury [Thu, 18 Jul 2019 05:22:55 +0000 (05:22 +0000)]
[DWARF][RISCV] Add support for RISC-V relocations needed for debug info

When code relaxation is enabled many RISC-V fixups are not resolved but
instead relocations are emitted. This happens even for DWARF debug
sections. Therefore, to properly support the parsing of DWARF debug info
we need to be able to resolve RISC-V relocations. This patch adds:

* Support for RISC-V relocations in RelocationResolver
* DWARF support for two relocations per object file offset
* DWARF changes to support relocations in more DIE fields

The two relocations per offset change is needed because some RISC-V
relocations (used for label differences) come in pairs.

Relocations can also be emitted for DWARF fields where relocations were
not yet evaluated. Adding relocation support for some of these fields is
essencial. On the other hand, LLVM currently emits RISC-V relocations
for fixups that could be safely evaluated, since they can never be
affected by code relaxations. This patch also adds relocation support
for the fields affected by those extraneous relocations (the DWARF unit
entry Length, and the DWARF debug line entry TotalLength and
PrologueLength), for testing purposes.

Differential Revision: https://reviews.llvm.org/D62062
Patch by Luís Marques.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366402 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Re-land r366331 d RISCV to LLVM_ALL_TARGETS
Alex Bradbury [Thu, 18 Jul 2019 04:05:18 +0000 (04:05 +0000)]
[RISCV] Re-land r366331 d RISCV to LLVM_ALL_TARGETS

*San flagged issues should be now be addressed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366399 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Avoid signed integer overflow UB in RISCVMatInt::generateInstSeq
Alex Bradbury [Thu, 18 Jul 2019 04:02:58 +0000 (04:02 +0000)]
[RISCV] Avoid signed integer overflow UB in RISCVMatInt::generateInstSeq

Found by UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366398 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch
Alex Bradbury [Thu, 18 Jul 2019 03:23:47 +0000 (03:23 +0000)]
[RISCV] Don't acccess an invalidated iterator in RISCVInstrInfo::removeBranch

Issue found by ASan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366397 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Add dependency from AArch64CodeGen to TransformUtils to fix -DBUILD_SHARED_...
Fangrui Song [Thu, 18 Jul 2019 01:53:08 +0000 (01:53 +0000)]
[AArch64] Add dependency from AArch64CodeGen to TransformUtils to fix -DBUILD_SHARED_LIBS=on link error after D64173/r366361

This fixes:

ld.lld: error: undefined symbol: llvm::findAllocaForValue(llvm::Value*, llvm::DenseMap<llvm::Value*, llvm::Alloc aInst*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::AllocaInst*> >&)
>>> referenced by AArch64StackTagging.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366396 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Add a test showing how we handle overaligned allocas w/ no-realign-stack
Philip Reames [Thu, 18 Jul 2019 00:26:03 +0000 (00:26 +0000)]
[Tests] Add a test showing how we handle overaligned allocas w/ no-realign-stack

(At the moment, we ignore the alignment requirement.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366393 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChanges to display code view debug info type records in hex format
Nilanjana Basu [Wed, 17 Jul 2019 23:43:58 +0000 (23:43 +0000)]
Changes to display code view debug info type records in hex format

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366390 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMake DT a transitive dependency of LI.
Evgeniy Stepanov [Wed, 17 Jul 2019 23:31:59 +0000 (23:31 +0000)]
Make DT a transitive dependency of LI.

Summary:
LoopInfoWrapperPass::verify uses DT, which means DT must be alive
even if it has no direct users.

Fixes a crash in expensive checks mode.

Reviewers: pcc, leonardchan

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366388 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-bcanalyzer] Fixed error 'Expected<T> must be checked before access or destruction'
Denis Bakhvalov [Wed, 17 Jul 2019 23:28:39 +0000 (23:28 +0000)]
[llvm-bcanalyzer] Fixed error 'Expected<T> must be checked before access or destruction'

After rL365286 I had failing test:
  LLVM :: tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll

It was failing with the output:
$ llvm-bcanalyzer --dump llvm/test/tools/gold/X86/v1.12/Output/thinlto_emit_linked_objects.ll.tmp3.o.thinlto.bc
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
Unexpected end of file reading 0 of 0 bytesStack dump:

Change-Id: I07e03262074ea5e0aae7a8d787d5487c87f914a2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366387 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-pdbdump: Fix several smaller issues with injected source compression handling
Nico Weber [Wed, 17 Jul 2019 22:59:52 +0000 (22:59 +0000)]
llvm-pdbdump: Fix several smaller issues with injected source compression handling

- getCompression() used to return a PDB_SourceCompression even though
  the docs for IDiaInjectedSource are explicit about the return value
  being compiler-dependent. Return an uint32_t instead, and make the
  printing code handle unknown values better by printing "Unknown" and
  the int value instead of not printing any compression.

- Print compressed contents as hex dump, not as string.

- Add compression type "DotNet", which is used (at least) by csc.exe,
  the C# compiler. Also add a lengthy comment describing the stream
  contents (derived from looking at the raw hex contents long enough
  to see the GUIDs, which led me to the roslyn and mono implementations
  for handling this).

- The native injected source dumper was dumping the contents of the
  whole data stream -- but csc.exe writes a stream that's padded with
  zero bytes to the next 512 boundary, and the dia api doesn't display
  those padding bytes. So make NativeInjectedSource::getCode() do the
  same thing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366386 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Simplify AMDGPUInstPrinter::printRegOperand()
Stanislav Mekhanoshin [Wed, 17 Jul 2019 22:58:43 +0000 (22:58 +0000)]
[AMDGPU] Simplify AMDGPUInstPrinter::printRegOperand()

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366385 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Set inaccessiblememonly on sendmsg intrinsics
Matt Arsenault [Wed, 17 Jul 2019 22:41:53 +0000 (22:41 +0000)]
AMDGPU: Set inaccessiblememonly on sendmsg intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366384 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Make sure we mark 128/256 MLOAD as Legal with VLX when min-legal-vector-width...
Craig Topper [Wed, 17 Jul 2019 22:26:00 +0000 (22:26 +0000)]
[X86] Make sure we mark 128/256 MLOAD as Legal with VLX when min-legal-vector-width=256 is in effect.

This started triggering an assertion after r364718 when we made
these Custom under AVX2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366382 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r366361.
Peter Collingbourne [Wed, 17 Jul 2019 21:45:34 +0000 (21:45 +0000)]
gn build: Merge r366361.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366380 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agohwasan: Initialize the pass only once.
Peter Collingbourne [Wed, 17 Jul 2019 21:45:19 +0000 (21:45 +0000)]
hwasan: Initialize the pass only once.

This will let us instrument globals during initialization. This required
making the new PM pass a module pass, which should still provide access to
analyses via the ModuleAnalysisManager.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366379 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Stop special casing flat_scratch for register name
Stanislav Mekhanoshin [Wed, 17 Jul 2019 21:35:11 +0000 (21:35 +0000)]
[AMDGPU] Stop special casing flat_scratch for register name

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366376 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSpeculative fix for stack-tagging.ll failure.
Evgeniy Stepanov [Wed, 17 Jul 2019 21:27:44 +0000 (21:27 +0000)]
Speculative fix for stack-tagging.ll failure.

Depending on the evaluation order of function call arguments,
the current code may insert a use before def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366375 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Remove unnecessary debug output
Hideto Ueno [Wed, 17 Jul 2019 21:11:02 +0000 (21:11 +0000)]
[Attributor][NFC] Remove unnecessary debug output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366373 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdding inline comments to code view type record directives for better readability
Nilanjana Basu [Wed, 17 Jul 2019 21:01:12 +0000 (21:01 +0000)]
Adding inline comments to code view type record directives for better readability

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366372 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PEI] Don't re-allocate a pre-allocated stack protector slot
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:19 +0000 (20:46 +0000)]
[PEI] Don't re-allocate a pre-allocated stack protector slot

The LocalStackSlotPass pre-allocates a stack protector and makes sure
that it comes before the local variables on the stack.

We need to make sure that later during PEI we don't re-allocate a new
stack protector slot. If that happens, the new stack protector slot will
end up being **after** the local variables that it should be protecting.

Therefore, we would have two slots assigned for two different stack
protectors, one at the top of the stack, and one at the bottom. Since
PEI will overwrite the assigned slot for the stack protector, the load
that is used to compare the value of the stack protector will use the
slot assigned by PEI, which is wrong.

For this, we need to check if the object is pre-allocated, and re-use
that pre-allocated slot.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366371 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Add stack protector tests where the guard gets re-assigned
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:16 +0000 (20:46 +0000)]
[CodeGen] Add stack protector tests where the guard gets re-assigned

In preparation of a fix, add tests for multiple backends.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366370 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen][NFC] Simplify checks for stack protector index checking
Francis Visoiu Mistrih [Wed, 17 Jul 2019 20:46:09 +0000 (20:46 +0000)]
[CodeGen][NFC] Simplify checks for stack protector index checking

Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex() >=
0`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366369 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources
Matt Arsenault [Wed, 17 Jul 2019 20:22:44 +0000 (20:22 +0000)]
GlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources

Extract the sources to the GCD of the original size and target size,
padding with implicit_def as necessary.

Also fix the case where the requested source type is wider than the
original result type. This was ignoring the type, and just using the
destination. Do the operation in the requested type and truncate back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366367 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Handle more cases for widenScalar of G_MERGE_VALUES
Matt Arsenault [Wed, 17 Jul 2019 20:22:38 +0000 (20:22 +0000)]
GlobalISel: Handle more cases for widenScalar of G_MERGE_VALUES

Use an anyext to the requested type for the leftover operand to
produce a slightly wider type, and then truncate the final merge.

I have another implementation almost ready which handles arbitrary
widens, but I think it produces worse code in this example (which I
think is 90% due to not folding redundant copies or folding out
implicit_def users), so I wanted to add this as a baseline first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366366 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoBasic MTE stack tagging instrumentation.
Evgeniy Stepanov [Wed, 17 Jul 2019 19:24:12 +0000 (19:24 +0000)]
Basic MTE stack tagging instrumentation.

Summary:
Use MTE intrinsics to tag stack variables in functions with
sanitize_memtag attribute.

Reviewers: pcc, vitalybuka, hctim, ostannard

Subscribers: srhines, mgorny, javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366361 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoBasic codegen for MTE stack tagging.
Evgeniy Stepanov [Wed, 17 Jul 2019 19:24:02 +0000 (19:24 +0000)]
Basic codegen for MTE stack tagging.

Implement IR intrinsics for stack tagging. Generated code is very
unoptimized for now.

Two special intrinsics, llvm.aarch64.irg.sp and llvm.aarch64.tagp are
used to implement a tagged stack frame pointer in a virtual register.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366360 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 17 Jul 2019 17:43:32 +0000 (17:43 +0000)]
Revert [AArch64] Add support for Transactional Memory Extension (TME)

This reverts r366322 (git commit 4b8da3a503e434ddbc08ecf66582475765f449bc)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366355 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Tune inlining parameters for AMDGPU target
Daniil Fukalov [Wed, 17 Jul 2019 16:51:29 +0000 (16:51 +0000)]
[AMDGPU] Tune inlining parameters for AMDGPU target

Summary:
Since the target has no significant advantage of vectorization,
vector instructions bous threshold bonus should be optional.

amdgpu-inline-arg-alloca-cost parameter default value and the target
InliningThresholdMultiplier value tuned then respectively.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, eraman, hiraditya, haicheng, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366348 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Add deprecation warnings to ORCv1 layers and utilities.
Lang Hames [Wed, 17 Jul 2019 16:40:52 +0000 (16:40 +0000)]
[ORC] Add deprecation warnings to ORCv1 layers and utilities.

Summary:
ORCv1 is deprecated. The current aim is to remove it before the LLVM 10.0
release. This patch adds deprecation attributes to the ORCv1 layers and
utilities to warn clients of the change.

Reviewers: dblaikie, sgraenitz, AlexDenisov

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366344 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Revert r366331 as it exposed some sanitizer failures
Alex Bradbury [Wed, 17 Jul 2019 16:14:52 +0000 (16:14 +0000)]
[RISCV] Revert r366331 as it exposed some sanitizer failures

See <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/33612>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366343 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Use getTargetConstant
Matt Arsenault [Wed, 17 Jul 2019 15:35:36 +0000 (15:35 +0000)]
AMDGPU: Use getTargetConstant

Avoids creating an extra intermediate mov.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366340 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Deduce "willreturn" function attribute
Hideto Ueno [Wed, 17 Jul 2019 15:15:43 +0000 (15:15 +0000)]
[Attributor] Deduce "willreturn" function attribute

Summary:
Deduce the "willreturn" attribute for functions.

For now, intrinsics are not willreturn. More annotation will be done in another patch.

Reviewers: jdoerfert

Subscribers: jvesely, nhaehnle, nicholas, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366335 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-ar][test] Add tests failing on Darwin
Owen Reynolds [Wed, 17 Jul 2019 15:10:02 +0000 (15:10 +0000)]
[llvm-ar][test] Add tests failing on Darwin

These tests that failed on Darwin but passed on other machines due to the default archive format differing
on a Darwin machine, and what looks to be bugs in the output of this format.
I can not investigate these issue further so the tests are considered expected failures on Darwin.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366334 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Add RISCV to LLVM_ALL_TARGETS so it s built by default
Alex Bradbury [Wed, 17 Jul 2019 14:32:25 +0000 (14:32 +0000)]
[RISCV] Add RISCV to LLVM_ALL_TARGETS so it s built by default

This follows the RFC <http://lists.llvm.org/pipermail/llvm-dev/2019-July/133724.html>.

Follow-on commits will add appropriate release notes changes etc.

Pushing this now and in a minimal form so there is reasonable time before 9.0
branches to resolve any issues arising from e.g. the backend being exposed on
different sanitizer setups.

The current builder for RISC-V is on the staging build-bot
<http://lab.llvm.org:8014/builders/llvm-riscv-linux>, however with the RISCV
backend being built by default it won't provide any real additional coverage.
We will shortly set up a builder that runs the test-suite in qemu-user.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366331 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV][NFC] Remove outdated TODO from test/CodeGen/RISCV/dwarf-eh.ll
Alex Bradbury [Wed, 17 Jul 2019 14:04:48 +0000 (14:04 +0000)]
[RISCV][NFC] Remove outdated TODO from test/CodeGen/RISCV/dwarf-eh.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366330 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AsmPrinter] Make the encoding of call sites in .gcc_except_table configurable and...
Alex Bradbury [Wed, 17 Jul 2019 14:00:35 +0000 (14:00 +0000)]
[AsmPrinter] Make the encoding of call sites in .gcc_except_table configurable and use for RISC-V

The original behavior was to always emit the offsets to each call site in the
call site table as uleb128 values, however on some architectures (eg RISCV)
these uleb128 offsets into the code cannot always be resolved until link time
(because relaxation will invalidate any calculated offsets), and there are no
appropriate relocations for uleb128 values. As a consequence it needs to be
possible to specify an alternative.

This also switches RISCV to use DW_EH_PE_udata4 for call side encodings in
.gcc_except_table

Differential Revision: https://reviews.llvm.org/D63415
Patch by Edward Jones.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366329 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMips: Remove immarg from copy and insert intrinsics
Matt Arsenault [Wed, 17 Jul 2019 13:55:01 +0000 (13:55 +0000)]
Mips: Remove immarg from copy and insert intrinsics

These intrinsics do in fact work with non-constant index arguments.

These are lowered to either the generic
ISD::INSERT_VECTOR_ELT/ISD::EXTRACT_VECTOR_ELT, or to
VEXTRACT_SEXT_ELT. The handling of these all accept variable
indexes. Turning these into generic instructions which do allow
variables introduces complications in a future change to immarg
handling.

Since these just turn into generic instructions, these are kind of
pointless and should probably just be autoupgraded to
extractelement/insertelement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366328 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Set correct encodings for DWARF exception handling
Alex Bradbury [Wed, 17 Jul 2019 13:54:38 +0000 (13:54 +0000)]
[RISCV] Set correct encodings for DWARF exception handling

This patch sets correct encodings for DWARF exception handling for RISC-V
(other than call site encoding, which must be udata4 rather than uleb128 and
is handled by D63415).

This has the same intend as D63409, except this version matches GCC/binutils
behaviour which uses the same encodings regardless of PIC/non-PIC and
medlow/medany code model.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366327 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV][NFC] Add tests that capture current encodings for DWARF EH
Alex Bradbury [Wed, 17 Jul 2019 13:48:49 +0000 (13:48 +0000)]
[RISCV][NFC] Add tests that capture current encodings for DWARF EH

Items which are known to be wrong/different vs GCC are marked as TODO and will
be address in follow-up patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366326 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-ar][test] \r\n -> \n
Fangrui Song [Wed, 17 Jul 2019 13:40:42 +0000 (13:40 +0000)]
[llvm-ar][test] \r\n -> \n

Also simplify some empty output tests with 'count 0'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366324 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Optimize atomic AND/OR/XOR
Jay Foad [Wed, 17 Jul 2019 13:40:03 +0000 (13:40 +0000)]
[AMDGPU] Optimize atomic AND/OR/XOR

Summary: Extend the atomic optimizer to handle AND, OR and XOR.

Reviewers: arsenm, sheredom

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, jfb, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366323 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 17 Jul 2019 13:23:27 +0000 (13:23 +0000)]
[AArch64] Add support for Transactional Memory Extension (TME)

TME is a future architecture technology, documented in

https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools
https://developer.arm.com/docs/ddi0601/a

More about the future architectures:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture

This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and
TCANCEL and the target feature/arch extension "tme".

It also implements TME builtin functions, defined in ACLE Q2 2019
(https://developer.arm.com/docs/101028/latest)

Patch by Javed Absar and Momchil Velikov

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366322 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPowerPC: Fix register spilling for SPE registers
Justin Hibbits [Wed, 17 Jul 2019 12:30:48 +0000 (12:30 +0000)]
PowerPC: Fix register spilling for SPE registers

Summary:
Missed in the original commit, use the correct callee-saved register
list for spilling, instead of the standard SVR432 list.  This avoids
needlessly spilling the SPE non-volatile registers when they're not used.

As part of this, also add where missing, and sort, the spill opcode
checks for SPE and SPE4 register classes.

Reviewers: nemanjai, hfinkel, joerg

Subscribers: kbarton, jsji, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366319 91177308-0d34-0410-b5e6-96231b3b80d8