]> granicus.if.org Git - llvm/log
llvm
5 years ago[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks
Kang Zhang [Fri, 6 Sep 2019 08:16:18 +0000 (08:16 +0000)]
[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Summary:

Fix a bug of not update the jump table and recommit it again.

In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
But the `early-ret` pass is before `block-placement`, we don't want to run it again.
This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.

Reviewed By: efriedma

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

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

5 years ago[CMake] LLVM_COMPILE_FLAGS also applies to C files
David Zarzycki [Fri, 6 Sep 2019 07:12:36 +0000 (07:12 +0000)]
[CMake] LLVM_COMPILE_FLAGS also applies to C files

LLVM_COMPILE_FLAGS also applies to C files, otherwise tuning flags,
etc. won't be picked up.

https://reviews.llvm.org/D67171

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

5 years ago[MIR] Change test case to read from stdin instead of file
Mikael Holmen [Fri, 6 Sep 2019 06:55:54 +0000 (06:55 +0000)]
[MIR] Change test case to read from stdin instead of file

The

    ;CHECK: bb
    ;CHECK-NEXT: %namedVReg1353:_(p0) = COPY $d0

parts of the test case failed when the tests were placed in a directory
including "bb" in the path, since the full path of the file is then
output in the
 ; ModuleID = '/repo/bb/
line which the CHECK matched on and then the CHECK-NEXT failed.

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

5 years ago[X86] Add tests for extending and truncating between v16i8 and v16i64 with min-legal...
Craig Topper [Fri, 6 Sep 2019 06:02:17 +0000 (06:02 +0000)]
[X86] Add tests for extending and truncating between v16i8 and v16i64 with min-legal-vector-width=256.

It looks like we might be able to do these in fewer steps, but
I'm not sure.

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

5 years ago[X86] Fix bad indentation. NFC
Craig Topper [Fri, 6 Sep 2019 05:50:46 +0000 (05:50 +0000)]
[X86] Fix bad indentation. NFC

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

5 years agoFix rL371162 again
Alex Brachet [Fri, 6 Sep 2019 03:31:42 +0000 (03:31 +0000)]
Fix rL371162 again

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

5 years agoFix failing test from rL371162
Alex Brachet [Fri, 6 Sep 2019 02:56:48 +0000 (02:56 +0000)]
Fix failing test from rL371162

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

5 years ago[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers
Alex Brachet [Fri, 6 Sep 2019 02:27:55 +0000 (02:27 +0000)]
[yaml2obj] Make e_phoff and e_phentsize 0 if there are no program headers

Summary: It says [[ http://www.sco.com/developers/gabi/latest/ch4.eheader.html | here ]] that if there are no program headers than e_phoff should be 0, but currently it is always set after the header. GNU's `readelf` (but not `llvm-readelf`) complains about this: `readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers`.

Reviewers: jhenderson, grimar, MaskRay, rupprecht

Reviewed By: jhenderson, grimar, MaskRay

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agogn build: Merge r371159
Nico Weber [Fri, 6 Sep 2019 01:22:13 +0000 (01:22 +0000)]
gn build: Merge r371159

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

5 years ago[MC] Fix undefined behavior in MCInstPrinter::formatHex
Jonas Devlieghere [Fri, 6 Sep 2019 01:13:32 +0000 (01:13 +0000)]
[MC] Fix undefined behavior in MCInstPrinter::formatHex

Passing INT64_MIN to MCInstPrinter::formatHex triggers undefined
behavior because the negation of -9223372036854775808 cannot be
represented in type 'int64_t' (aka 'long long'). This patch puts a
workaround in place to just print the hex value directly.

A possible alternative involves using a small helper functions that uses
(implementation) defined conversions to achieve the desirable value:

  static int64_t helper(int64_t V) {
    auto U = static_cast<uint64_t>(V);
    return V < 0 ? -U : U;
  }

The underlying problem is that MCInstPrinter::formatHex(int64_t) returns
a format_object<int64_t> and should really return a
format_object<uint64_t>. However, that's not possible because formatImm
needs to be able to print both as decimal (where a signed is required)
and hex (where we'd prefer to always have an unsigned).

  format_object<int64_t> formatImm(int64_t Value) const {
    return PrintImmHex ? formatHex(Value) : formatDec(Value);
  }

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

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

5 years agoCleanup test.
Alina Sbirlea [Fri, 6 Sep 2019 00:58:03 +0000 (00:58 +0000)]
Cleanup test.

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

5 years ago[llvm-readobj][yaml2obj] Support SHT_LLVM_SYMPART, SHT_LLVM_PART_EHDR and SHT_LLVM_PA...
Fangrui Song [Fri, 6 Sep 2019 00:53:28 +0000 (00:53 +0000)]
[llvm-readobj][yaml2obj] Support SHT_LLVM_SYMPART, SHT_LLVM_PART_EHDR and SHT_LLVM_PART_PHDR

See http://lists.llvm.org/pipermail/llvm-dev/2019-February/130583.html
and D60242 for the lld partition feature.

This patch:

* Teaches yaml2obj to parse the 3 section types.
* Teaches llvm-readobj/llvm-readelf to dump the 3 section types.

There is no test for SHT_LLVM_DEPENDENT_LIBRARIES in llvm-readobj. Add
it as well.

Reviewed By: thakis

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

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

5 years agoAMDGPU/GlobalISel: Avoid repeating 32-bit type lists
Matt Arsenault [Fri, 6 Sep 2019 00:36:10 +0000 (00:36 +0000)]
AMDGPU/GlobalISel: Avoid repeating 32-bit type lists

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

5 years agoAMDGPU/GlobalISel: Fix load/store of types in other address spaces
Matt Arsenault [Fri, 6 Sep 2019 00:36:06 +0000 (00:36 +0000)]
AMDGPU/GlobalISel: Fix load/store of types in other address spaces

There should probably be a size only matcher.

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

5 years agoGlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints
Matt Arsenault [Fri, 6 Sep 2019 00:05:58 +0000 (00:05 +0000)]
GlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints

This was only using the correct register constraints if this was the
final result instruction. If the extract was a sub instruction of the
result, it would attempt to use GIR_ConstrainSelectedInstOperands on a
COPY, which won't work. Move the handling to
createAndImportSubInstructionRenderer so it works correctly.

I don't fully understand why runOnPattern and
createAndImportSubInstructionRenderer both need to handle these
special cases, and constrain them with slightly different methods. If
I remove the runOnPattern handling, it does break the constraint when
the final result instruction is EXTRACT_SUBREG.

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

5 years agoAMDGPU: Allow getMemOperandWithOffset to analyze stack accesses
Matt Arsenault [Thu, 5 Sep 2019 23:54:35 +0000 (23:54 +0000)]
AMDGPU: Allow getMemOperandWithOffset to analyze stack accesses

Report soffset as a base register if the scratch resource can be
ignored.

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

5 years agoAMDGPU: Fix emitting multiple stack loads for stack passed workitems
Matt Arsenault [Thu, 5 Sep 2019 23:40:14 +0000 (23:40 +0000)]
AMDGPU: Fix emitting multiple stack loads for stack passed workitems

The same stack is loaded for each workitem ID, and each use. Nothing
prevents you from creating multiple fixed stack objects with the same
offsets, so this was creating a load for each unique frame index,
despite them being the same offset. Re-use the same frame index so the
loads are CSEable.

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

5 years ago[AArch64] Add testcase for codegen for sdiv by 2.
Eli Friedman [Thu, 5 Sep 2019 23:40:03 +0000 (23:40 +0000)]
[AArch64] Add testcase for codegen for sdiv by 2.

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

5 years agoInstCombine: Fix crash on icmp of gep with addrspacecasted null
Matt Arsenault [Thu, 5 Sep 2019 23:39:21 +0000 (23:39 +0000)]
InstCombine: Fix crash on icmp of gep with addrspacecasted null

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

5 years agollvm-reduce: Use %python from lit to get the correct/valid python binary for the...
David Blaikie [Thu, 5 Sep 2019 23:33:44 +0000 (23:33 +0000)]
llvm-reduce: Use %python from lit to get the correct/valid python binary for the reduction script

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

5 years agoAMDGPU: Fix Register copypaste error
Matt Arsenault [Thu, 5 Sep 2019 23:07:10 +0000 (23:07 +0000)]
AMDGPU: Fix Register copypaste error

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

5 years ago[AliasSetTracker] Correct AAInfo check.
Alina Sbirlea [Thu, 5 Sep 2019 23:00:36 +0000 (23:00 +0000)]
[AliasSetTracker] Correct AAInfo check.

Properly check if NewAAInfo conflicts with AAInfo.
Update local variable and alias set that a change occured when a conflict is found.
Resolves PR42969.

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

5 years ago[SimplifyCFG] Don't SimplifyBranchOnICmpChain with ExtraCase
Vitaly Buka [Thu, 5 Sep 2019 22:49:34 +0000 (22:49 +0000)]
[SimplifyCFG] Don't SimplifyBranchOnICmpChain with ExtraCase

Summary:
Here we try to avoid issues with "explicit branch" with SimplifyBranchOnICmpChain
which can check on undef. Msan by design reports branches on uninitialized
memory and undefs, so we have false report here.

In general msan does not like when we convert

```
// If at least one of them is true we can MSAN is ok if another is undefs
if (a || b)
  return;
```
into
```
// If 'a' is undef MSAN will complain even if 'b' is true
if (a)
  return;
if (b)
  return;
```

Example

Before optimization we had something like this:
```
while (true) {
  bool maybe_undef = doStuff();

  while (true) {
    char c = getChar();
    if (c != 10 && c != 13)
     continue
    break;
  }

  // we know that c == 10 || c == 13 if we get here,
  // so msan know that branch is not affected by maybe_undef
  if (maybe_undef || c == 10 || c == 13)
    continue;
  return;
}
```

SimplifyBranchOnICmpChain will convert that into
```
while (true) {
  bool maybe_undef = doStuff();

  while (true) {
    char c = getChar();
    if (c != 10 && c != 13)
      continue;
    break;
  }

  // however msan will complain here:
  if (maybe_undef)
    continue;

  // we know that c == 10 || c == 13, so either way we will get continue
  switch(c) {
    case 10: continue;
    case 13: continue;
  }
  return;
}
```

Reviewers: eugenis, efriedma

Reviewed By: eugenis, efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Avoid constructing new std::vector in initCandidate
Matt Arsenault [Thu, 5 Sep 2019 22:44:06 +0000 (22:44 +0000)]
AMDGPU: Avoid constructing new std::vector in initCandidate

Approximately 30% of the time was spent in the std::vector
constructor. In one testcase this pushes the scheduler to being the
second slowest pass.

I'm not sure I understand why these vector are necessary. The default
scheduler initCandidate seems to use some pre-existing vectors for the
pressure.

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

5 years agogn build: Merge r371134
Nico Weber [Thu, 5 Sep 2019 22:40:47 +0000 (22:40 +0000)]
gn build: Merge r371134

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

5 years ago[Remarks] Add comparison operators to the Remark object
Francis Visoiu Mistrih [Thu, 5 Sep 2019 22:35:37 +0000 (22:35 +0000)]
[Remarks] Add comparison operators to the Remark object

and related structs.

This also adds tests for the remarks::Remark object in general.

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

5 years ago[ADT] Add makeArrayRef(std::array<>) template specialization
Jan Korous [Thu, 5 Sep 2019 21:27:25 +0000 (21:27 +0000)]
[ADT] Add makeArrayRef(std::array<>) template specialization

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

5 years ago[Bitstream] Add BitCodeAbbrev(std::initializer_list) constructor
Jan Korous [Thu, 5 Sep 2019 21:26:53 +0000 (21:26 +0000)]
[Bitstream] Add BitCodeAbbrev(std::initializer_list) constructor

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

5 years agoDocs: Update Community section on homepage
DeForest Richards [Thu, 5 Sep 2019 21:24:47 +0000 (21:24 +0000)]
Docs: Update Community section on homepage

This commit includes the following changes: Adds a Getting Involved section under Community. Moves the Development Process section under Community. Moves Sphinx Quickstart Template and How to submit an LLVM bug report from User Guides section to Getting Involved.

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

5 years ago[GSYM][NFC] Fixed -Wdocumentation warning
David Bolvansky [Thu, 5 Sep 2019 21:09:58 +0000 (21:09 +0000)]
[GSYM][NFC] Fixed -Wdocumentation warning

lib/DebugInfo/GSYM/InlineInfo.cpp:68:12: warning: parameter 'Inline' not found in the function declaration [-Wdocumentation]

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

5 years agogn build: Merge r371121
Nico Weber [Thu, 5 Sep 2019 20:58:38 +0000 (20:58 +0000)]
gn build: Merge r371121

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

5 years ago[MIR] MIRNamer pass for improving MIR test authoring experience.
Puyan Lotfi [Thu, 5 Sep 2019 20:44:33 +0000 (20:44 +0000)]
[MIR] MIRNamer pass for improving MIR test authoring experience.

This patch reuses the MIR vreg renamer from the MIRCanonicalizerPass to cleanup
names of vregs in a MIR file for MIR test authors. I found it useful when
writing a regression test for a globalisel failure I encountered recently and
thought it might be useful for other folks as well.

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

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

5 years agogn build: Merge r371117
Nico Weber [Thu, 5 Sep 2019 20:38:24 +0000 (20:38 +0000)]
gn build: Merge r371117

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

5 years ago[globalisel][knownbits] Account for missing type constraints
Daniel Sanders [Thu, 5 Sep 2019 20:26:02 +0000 (20:26 +0000)]
[globalisel][knownbits] Account for missing type constraints

Now that we look through copies, it's possible to visit registers that
have a register class constraint but not a type constraint. Avoid looking
through copies when this occurs as the SrcReg won't be able to determine
it's bit width or any known bits.

Along the same lines, if the initial query is on a register that doesn't
have a type constraint then the result is a default-constructed KnownBits,
that is, a 1-bit fully-unknown value.

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

5 years ago[globalisel][knownbits] Correct a typo that prevented a test working as intended
Daniel Sanders [Thu, 5 Sep 2019 20:25:52 +0000 (20:25 +0000)]
[globalisel][knownbits] Correct a typo that prevented a test working as intended

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

5 years agoRecommit "[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling...
Jessica Paquette [Thu, 5 Sep 2019 20:18:34 +0000 (20:18 +0000)]
Recommit "[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls"

Recommit basic sibling call lowering (https://reviews.llvm.org/D67189)

The issue was that if you have a return type other than void, call lowering
will emit COPYs to get the return value after the call.

Disallow sibling calls other than ones that return void for now. Also
proactively disable swifterror tail calls for now, since there's a similar issue
with COPYs there.

Update call-translator-tail-call.ll to include test cases for each of these
things.

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

5 years ago[IfConversion] Fix diamond conversion with unanalyzable branches.
Eli Friedman [Thu, 5 Sep 2019 20:02:38 +0000 (20:02 +0000)]
[IfConversion] Fix diamond conversion with unanalyzable branches.

The code was incorrectly counting the number of identical instructions,
and therefore tried to predicate an instruction which should not have
been predicated.  This could have various effects: a compiler crash,
an assembler failure, a miscompile, or just generating an extra,
unnecessary instruction.

Instead of depending on TargetInstrInfo::removeBranch, which only
works on analyzable branches, just remove all branch instructions.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
https://bugs.llvm.org/show_bug.cgi?id=41121 .

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

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

5 years agodoc update: explain that Z3 is only for clang SA - thanks to LebedevRI for the suggestion
Sylvestre Ledru [Thu, 5 Sep 2019 19:50:56 +0000 (19:50 +0000)]
doc update: explain that Z3 is only for clang SA - thanks to LebedevRI for the suggestion

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

5 years agodocument the LLVM_ENABLE_Z3_SOLVER option
Sylvestre Ledru [Thu, 5 Sep 2019 19:38:15 +0000 (19:38 +0000)]
document the LLVM_ENABLE_Z3_SOLVER option

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

5 years ago[NFC][InstCombine] Overhaul 'unsigned add overflow' tests, ensure that all 3 patterns...
Roman Lebedev [Thu, 5 Sep 2019 19:13:15 +0000 (19:13 +0000)]
[NFC][InstCombine] Overhaul 'unsigned add overflow' tests, ensure that all 3 patterns have full test coverage

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

5 years ago[X86] Enable BuildSDIVPow2 for i16.
Craig Topper [Thu, 5 Sep 2019 18:49:52 +0000 (18:49 +0000)]
[X86] Enable BuildSDIVPow2 for i16.

We're able to use a 32-bit ADD and CMOV here and should work
well with our other i16->i32 promotion optimizations.

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

5 years ago[Remarks] Don't serialize metadata if a string table is not used
Francis Visoiu Mistrih [Thu, 5 Sep 2019 18:30:20 +0000 (18:30 +0000)]
[Remarks] Don't serialize metadata if a string table is not used

For YAML remarks with no string table, the mode should not affect the
output.

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

5 years agogn build: Merge r371103
Nico Weber [Thu, 5 Sep 2019 18:15:50 +0000 (18:15 +0000)]
gn build: Merge r371103

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

5 years ago[X86] Override BuildSDIVPow2 for X86.
Craig Topper [Thu, 5 Sep 2019 18:15:07 +0000 (18:15 +0000)]
[X86] Override BuildSDIVPow2 for X86.

As noted in PR43197, we can use test+add+cmov+sra to implement
signed division by a power of 2.

This is based off the similar version in AArch64, but I've
adjusted it to use target independent nodes where AArch64 uses
target specific CMP and CSEL nodes. I've also blocked INT_MIN
as the transform isn't valid for that.

I've limited this to i32 and i64 on 64-bit targets for now and only
when CMOV is supported. i8 and i16 need further investigation to be
sure they get promoted to i32 well.

I adjusted a few tests to enable cmov to demonstrate the new
codegen. I also changed twoaddr-coalesce-3.ll to 32-bit mode
without cmov to avoid perturbing the scenario that is being
set up there.

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

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

5 years ago[Support] Add writeFileAtomically() to FileUtilities
Jan Korous [Thu, 5 Sep 2019 18:10:29 +0000 (18:10 +0000)]
[Support] Add writeFileAtomically() to FileUtilities

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

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

5 years agogn build: (manually) merge r358706
Nico Weber [Thu, 5 Sep 2019 18:03:18 +0000 (18:03 +0000)]
gn build: (manually) merge r358706

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

5 years ago[InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned sub overflow...
Roman Lebedev [Thu, 5 Sep 2019 17:41:02 +0000 (17:41 +0000)]
[InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned sub overflow' check

A follow-up for r329011.
This may be changed to produce @llvm.sub.with.overflow in a later patch,
but for now just make things more consistent overall.

A few observations stem from this:
* There does not seem to be a similar one-instruction fold for uadd-overflow
* I'm not sure we'll want to canonicalize `B u> A` as `usub.with.overflow`,
  so since the `icmp` here no longer refers to `sub`,
  reconstructing `usub.with.overflow` will be problematic,
  and will likely require standalone pass (similar to DivRemPairs).

https://rise4fun.com/Alive/Zqs

Name: (A - B) u> A --> B u> A
  %t0 = sub i8 %A, %B
  %r = icmp ugt i8 %t0, %A
=>
  %r = icmp ugt i8 %B, %A

Name: (A - B) u<= A --> B u<= A
  %t0 = sub i8 %A, %B
  %r = icmp ule i8 %t0, %A
=>
  %r = icmp ule i8 %B, %A

Name: C u< (C - D) --> C u< D
  %t0 = sub i8 %C, %D
  %r = icmp ult i8 %C, %t0
=>
  %r = icmp ult i8 %C, %D

Name: C u>= (C - D) --> C u>= D
  %t0 = sub i8 %C, %D
  %r = icmp uge i8 %C, %t0
=>
  %r = icmp uge i8 %C, %D

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

5 years ago[InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned add overflow...
Roman Lebedev [Thu, 5 Sep 2019 17:40:49 +0000 (17:40 +0000)]
[InstCombine] foldICmpBinOp(): consider inverted check in 'unsigned add overflow' check

A follow-up for r342004.
This will be changed to produce @llvm.add.with.overflow in a later patch,
but for now just make things more consistent overall.

https://rise4fun.com/Alive/qxE

Name: (Op1 + X) u< Op1 --> ~Op1 u< X
  %t0 = add i8 %Op1, %X
  %r = icmp ult i8 %t0, %Op1
=>
  %n = xor i8 %Op1, -1
  %r = icmp ult i8 %n, %X

Name: (Op1 + X) u>= Op1 --> ~Op1 u>= X
  %t0 = add i8 %Op1, %X
  %r = icmp uge i8 %t0, %Op1
=>
  %n = xor i8 %Op1, -1
  %r = icmp uge i8 %n, %X

;-------------------------------------------------------------------------------

Name: Op0 u> (Op0 + X) --> X u> ~Op0
  %t0 = add i8 %Op0, %X
  %r = icmp ugt i8 %Op0, %t0
=>
  %n = xor i8 %Op0, -1
  %r = icmp ugt i8 %X, %n

Name: Op0 u<= (Op0 + X) --> X u<= ~Op0
  %t0 = add i8 %Op0, %X
  %r = icmp ule i8 %Op0, %t0
=>
  %n = xor i8 %Op0, -1
  %r = icmp ule i8 %X, %n

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

5 years ago[InstCombine][NFC] Tests for 'unsigned sub overflow' check
Roman Lebedev [Thu, 5 Sep 2019 17:40:37 +0000 (17:40 +0000)]
[InstCombine][NFC] Tests for 'unsigned sub overflow' check

----------------------------------------
Name: unsigned sub, overflow, v0
  %sub = sub i8 %x, %y
  %ov = icmp ugt i8 %sub, %x
=>
  %agg = usub_overflow i8 %x, %y
  %sub = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned sub, no overflow, v0
  %sub = sub i8 %x, %y
  %ov = icmp ule i8 %sub, %x
=>
  %agg = usub_overflow i8 %x, %y
  %sub = extractvalue {i8, i1} %agg, 0
  %not.ov = extractvalue {i8, i1} %agg, 1
  %ov = xor %not.ov, -1

Done: 1
Optimization is correct!

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

5 years ago[InstCombine][NFC] Tests for 'unsigned add overflow' check
Roman Lebedev [Thu, 5 Sep 2019 17:40:28 +0000 (17:40 +0000)]
[InstCombine][NFC] Tests for 'unsigned add overflow' check

----------------------------------------
Name: unsigned add, overflow, v0
  %add = add i8 %x, %y
  %ov = icmp ult i8 %add, %x
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned add, overflow, v1
  %add = add i8 %x, %y
  %ov = icmp ult i8 %add, %y
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned add, no overflow, v0
  %add = add i8 %x, %y
  %ov = icmp uge i8 %add, %x
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %not.ov = extractvalue {i8, i1} %agg, 1
  %ov = xor %not.ov, -1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned add, no overflow, v1
  %add = add i8 %x, %y
  %ov = icmp uge i8 %add, %y
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %not.ov = extractvalue {i8, i1} %agg, 1
  %ov = xor %not.ov, -1

Done: 1
Optimization is correct!

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

5 years ago[TextAPI] update interface file for filtered iter
Cyndy Ishida [Thu, 5 Sep 2019 17:33:44 +0000 (17:33 +0000)]
[TextAPI] update interface file for filtered iter

Summary:
This is a simple change that allows easy iterator semantics for symbols held in interface file.
Not being used, so harmless change right now, but will be once TBD-v4 is submitted.

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

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

Tags: #llvm

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

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

5 years agoDocs: Move Documentation sections to separate pages.
DeForest Richards [Thu, 5 Sep 2019 17:30:52 +0000 (17:30 +0000)]
Docs: Move Documentation sections to separate pages.

Updates the links on the homepage by moving the User Guides, Programming Documentation, and Subsystem Documentation sections to separate pages. Also changes "Overview" to "About" at the top of the LLVM Docs homepage. This work is part of the Google Season of Docs project.

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

5 years ago[x86] fix horizontal math bug exposed by improved demanded elements analysis (PR43225)
Sanjay Patel [Thu, 5 Sep 2019 17:28:17 +0000 (17:28 +0000)]
[x86] fix horizontal math bug exposed by improved demanded elements analysis (PR43225)

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

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

5 years ago[X86] Add a FIXME about why the CWD/CDQ/CQO have a bogus implicit def of the A regist...
Craig Topper [Thu, 5 Sep 2019 17:24:34 +0000 (17:24 +0000)]
[X86] Add a FIXME about why the CWD/CDQ/CQO have a bogus implicit def of the A register. NFC

The instructions copy the sign bit of the A register to every bit
of the D register. But they don't write to the A register.

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

5 years ago[X86] Remove unneeded CHECK lines from a test. NFC
Craig Topper [Thu, 5 Sep 2019 17:24:25 +0000 (17:24 +0000)]
[X86] Remove unneeded CHECK lines from a test. NFC

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

5 years ago[X86] Fix stale comment. NFC
Craig Topper [Thu, 5 Sep 2019 17:24:15 +0000 (17:24 +0000)]
[X86] Fix stale comment. NFC

We aren't checking for a concat here. We're just always splitting
256-bit stores.

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

5 years agogn build: (manually) merge r371003
Nico Weber [Thu, 5 Sep 2019 17:22:55 +0000 (17:22 +0000)]
gn build: (manually) merge r371003

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

5 years ago[MergedLoadStoreMotion] Sink stores to BB with more than 2 predecessors
Denis Bakhvalov [Thu, 5 Sep 2019 17:00:32 +0000 (17:00 +0000)]
[MergedLoadStoreMotion] Sink stores to BB with more than 2 predecessors

If we have:

bb5:
  br i1 %arg3, label %bb6, label %bb7

bb6:
  %tmp = getelementptr inbounds i32, i32* %arg1, i64 2
  store i32 3, i32* %tmp, align 4
  br label %bb9

bb7:
  %tmp8 = getelementptr inbounds i32, i32* %arg1, i64 2
  store i32 3, i32* %tmp8, align 4
  br label %bb9

bb9:  ; preds = %bb4, %bb6, %bb7
  ...

We can't sink stores directly into bb9.
This patch creates new BB that is successor of %bb6 and %bb7
and sinks stores into that block.

SplitFooterBB is the parameter to the pass that controls
that behavior.

Change-Id: I7fdf50a772b84633e4b1b860e905bf7e3e29940f
Differential: https://reviews.llvm.org/D66234

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

5 years ago[x86] add test for horizontal math bug (PR43225); NFC
Sanjay Patel [Thu, 5 Sep 2019 16:58:18 +0000 (16:58 +0000)]
[x86] add test for horizontal math bug (PR43225); NFC

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

5 years ago[MemorySSA] Verify MSSAUpdater exists.
Alina Sbirlea [Thu, 5 Sep 2019 16:58:15 +0000 (16:58 +0000)]
[MemorySSA] Verify MSSAUpdater exists.

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

5 years ago[PGO][CHR] Speed up following long, interlinked use-def chains.
Hiroshi Yamauchi [Thu, 5 Sep 2019 16:56:55 +0000 (16:56 +0000)]
[PGO][CHR] Speed up following long, interlinked use-def chains.

Summary:
Avoid visiting an instruction more than once by using a map.

This is similar to https://reviews.llvm.org/rL361416.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Update MemorySSA when removing debug.value calls.
Alina Sbirlea [Thu, 5 Sep 2019 16:25:24 +0000 (16:25 +0000)]
[MemorySSA] Update MemorySSA when removing debug.value calls.

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

5 years ago[Hexagon] Fix type in HexagonTargetLowering::ReplaceNodeResults
Krzysztof Parzyszek [Thu, 5 Sep 2019 16:19:47 +0000 (16:19 +0000)]
[Hexagon] Fix type in HexagonTargetLowering::ReplaceNodeResults

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

5 years ago[Alignment][NFC] Change internal representation of TargetLowering.h
Guillaume Chatelet [Thu, 5 Sep 2019 15:44:33 +0000 (15:44 +0000)]
[Alignment][NFC] Change internal representation of TargetLowering.h

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[ARM] Add support for the s,j,x,N,O inline asm constraints
David Candler [Thu, 5 Sep 2019 15:17:25 +0000 (15:17 +0000)]
[ARM] Add support for the s,j,x,N,O inline asm constraints

A number of inline assembly constraints are currently supported by LLVM, but rejected as invalid by Clang:

Target independent constraints:

s: An integer constant, but allowing only relocatable values

ARM specific constraints:

j: An immediate integer between 0 and 65535 (valid for MOVW)
x: A 32, 64, or 128-bit floating-point/SIMD register: s0-s15, d0-d7, or q0-q3
N: An immediate integer between 0 and 31 (Thumb1 only)
O: An immediate integer which is a multiple of 4 between -508 and 508. (Thumb1 only)

This patch adds support to Clang for the missing constraints along with some checks to ensure that the constraints are used with the correct target and Thumb mode, and that immediates are within valid ranges (at least where possible). The constraints are already implemented in LLVM, but just a couple of minor corrections to checks (V8M Baseline includes MOVW so should work with 'j', 'N' and 'O' shouldn't be valid in Thumb2) so that Clang and LLVM are in line with each other and the documentation.

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

Change-Id: I18076619e319bac35fbb60f590c069145c9d9a0a

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

5 years ago[X86][SSE] EltsFromConsecutiveLoads - ignore non-zero offset base loads (PR43227)
Simon Pilgrim [Thu, 5 Sep 2019 15:07:07 +0000 (15:07 +0000)]
[X86][SSE] EltsFromConsecutiveLoads - ignore non-zero offset base loads (PR43227)

As discussed on D64551 and PR43227, we don't correctly handle cases where the base load has a non-zero byte offset.

Until we can properly handle this, we must bail from EltsFromConsecutiveLoads.

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

5 years ago[yaml2obj] Write the section header table after section contents
Fangrui Song [Thu, 5 Sep 2019 14:25:57 +0000 (14:25 +0000)]
[yaml2obj] Write the section header table after section contents

Linkers (ld.bfd/gold/lld) place the section header table at the very
end. This allows tools to strip it, which is optional in executable/shared objects.
In addition, if we add or section, the size of the section header table
will change. Placing the section header table in the end keeps section
offsets unchanged.

yaml2obj currently places the section header table immediately after the
program header. Follow what linkers do to make offset updating easier.

Reviewed By: grimar

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

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

5 years ago[LLVM][Alignment][NFC] Fixing wrong documentation
Guillaume Chatelet [Thu, 5 Sep 2019 14:17:08 +0000 (14:17 +0000)]
[LLVM][Alignment][NFC] Fixing wrong documentation

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

5 years ago[llvm-readelf] - Allow dumping dynamic symbols when there is no program headers.
George Rimar [Thu, 5 Sep 2019 14:02:58 +0000 (14:02 +0000)]
[llvm-readelf] - Allow dumping dynamic symbols when there is no program headers.

D62179 introduced a regression. llvm-readelf lose the ability to dump the dynamic symbols
when there is .dynamic section with a DT_SYMTAB, but there are no program headers:
https://reviews.llvm.org/D62179#1652778

Below is a program flow before the D62179 change:

1) Find SHT_DYNSYM.
2) Find there is no PT_DYNAMIC => don't try to parse it.
3) Print dynamic symbols using information about them found on step (1).

And after the change it became:

1) Find SHT_DYNSYM.
2) Find there is no PT_DYNAMIC => find SHT_DYNAMIC.
3) Parse dynamic table, but fail to handle the DT_SYMTAB because of the absence of the PT_LOAD. Report the "Virtual address is not in any segment" error.

This patch fixes the issue. For doing this it checks that the value of DT_SYMTAB was
mapped to a segment. If not - it ignores it.

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

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

5 years ago[ARM] Fixup the creation of VPT blocks
David Green [Thu, 5 Sep 2019 13:37:04 +0000 (13:37 +0000)]
[ARM] Fixup the creation of VPT blocks

This attempts to just fix the creation of VPT blocks, fixing up the iterating,
which instructions are considered in the bundle, and making sure that we do not
overrun the end of the block.

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

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

5 years ago[LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align
Guillaume Chatelet [Thu, 5 Sep 2019 13:09:42 +0000 (13:09 +0000)]
[LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align

Summary:
This is patch is part of a serie to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86][SSE] Add (failing) test case for PR43227
Simon Pilgrim [Thu, 5 Sep 2019 12:36:11 +0000 (12:36 +0000)]
[X86][SSE] Add (failing) test case for PR43227

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

5 years ago[MIPS GlobalISel] Select G_FENCE
Petar Avramovic [Thu, 5 Sep 2019 11:20:32 +0000 (11:20 +0000)]
[MIPS GlobalISel] Select G_FENCE

G_FENCE comes form fence instruction. For MIPS fence is generated in
AtomicExpandPass when atomic instruction gets surrounded with fence
instruction when needed.
G_FENCE arguments don't have LLT, because of that there is no job for
legalizer and regbankselect. Instruction select G_FENCE for MIPS32.

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

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

5 years ago[MIPS GlobalISel] Select llvm.trap intrinsic
Petar Avramovic [Thu, 5 Sep 2019 11:16:37 +0000 (11:16 +0000)]
[MIPS GlobalISel] Select llvm.trap intrinsic

Select G_INTRINSIC_W_SIDE_EFFECTS for Intrinsic::trap for MIPS32
via legalizeIntrinsic.

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

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

5 years ago[MIPS GlobalISel] Lower SRet pointer arguments
Petar Avramovic [Thu, 5 Sep 2019 11:12:01 +0000 (11:12 +0000)]
[MIPS GlobalISel] Lower SRet pointer arguments

Instead of returning structure by value clang usually adds pointer
to that structure as an argument. Pointers don't require special
handling no matter the SRet flag. Remove unsuccessful exit from
lowerCall for arguments with SRet flag if they are pointers.

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

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

5 years agoRevert rL370996 from llvm/trunk: [AArch64][GlobalISel] Teach AArch64CallLowering...
Simon Pilgrim [Thu, 5 Sep 2019 10:38:39 +0000 (10:38 +0000)]
Revert rL370996 from llvm/trunk: [AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls

This adds support for basic sibling call lowering in AArch64. The intent here is
to only handle tail calls which do not change the ABI (hence, sibling calls.)

At this point, it is very restricted. It does not handle

- Vararg calls.
- Calls with outgoing arguments.
- Calls whose calling conventions differ from the caller's calling convention.
- Tail/sibling calls with BTI enabled.

This patch adds

- `AArch64CallLowering::isEligibleForTailCallOptimization`, which is equivalent
   to the same function in AArch64ISelLowering.cpp (albeit with the restrictions
   above.)
- `mayTailCallThisCC` and `canGuaranteeTCO`, which are identical to those in
   AArch64ISelLowering.cpp.
- `getCallOpcode`, which is exactly what it sounds like.

Tail/sibling calls are lowered by checking if they pass target-independent tail
call positioning checks, and checking if they satisfy
`isEligibleForTailCallOptimization`. If they do, then a tail call instruction is
emitted instead of a normal call. If we have a sibling call (which is always the
case in this patch), then we do not emit any stack adjustment operations. When
we go to lower a return, we check if we've already emitted a tail call. If so,
then we skip the return lowering.

For testing, this patch

- Adds call-translator-tail-call.ll to test which tail calls we currently lower,
  which ones we don't, and which ones we shouldn't.
- Updates branch-target-enforcement-indirect-calls.ll to show that we fall back
  as expected.

Differential Revision: https://reviews.llvm.org/D67189
........
This fails on EXPENSIVE_CHECKS builds due to a -verify-machineinstrs test failure in CodeGen/AArch64/dllimport.ll

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

5 years ago[X86] X86SpeculativeLoadHardeningPass::canHardenRegister - fix out of bounds warning.
Simon Pilgrim [Thu, 5 Sep 2019 10:26:38 +0000 (10:26 +0000)]
[X86] X86SpeculativeLoadHardeningPass::canHardenRegister - fix out of bounds warning.

Fixes clang static-analyzer warning.

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

5 years ago[SystemZ] Recognize INLINEASM_BR in backend
Jonas Paulsson [Thu, 5 Sep 2019 10:20:05 +0000 (10:20 +0000)]
[SystemZ]  Recognize INLINEASM_BR in backend

Handle the remaining cases also by handling asm goto in
SystemZInstrInfo::getBranchInfo().

Review: Ulrich Weigand
https://reviews.llvm.org/D67151

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

5 years ago[X86] X86InstrInfo::optimizeCompareInstr - fix potential null dereference.
Simon Pilgrim [Thu, 5 Sep 2019 10:18:24 +0000 (10:18 +0000)]
[X86] X86InstrInfo::optimizeCompareInstr - fix potential null dereference.

Fixes clang static-analyzer warning.

Technically the MachineInstr *Sub might still be null if we're comparing zero (IsCmpZero == true), although this probably won't happen as SrcReg2 is probably == 0.

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

5 years ago[LLVM][Alignment] Make functions using log of alignment explicit
Guillaume Chatelet [Thu, 5 Sep 2019 10:00:22 +0000 (10:00 +0000)]
[LLVM][Alignment] Make functions using log of alignment explicit

Summary:
This patch renames functions that takes or returns alignment as log2, this patch will help with the transition to llvm::Align.
The renaming makes it explicit that we deal with log(alignment) instead of a power of two alignment.
A few renames uncovered dubious assignments:

 - `MirParser`/`MirPrinter` was expecting powers of two but `MachineFunction` and `MachineBasicBlock` were using deal with log2(align). This patch fixes it and updates the documentation.
 - `MachineBlockPlacement` exposes two flags (`align-all-blocks` and `align-all-nofallthru-blocks`) supposedly interpreted as power of two alignments, internally these values are interpreted as log2(align). This patch updates the documentation,
 - `MachineFunctionexposes` exposes `align-all-functions` also interpreted as power of two alignment, internally this value is interpreted as log2(align). This patch updates the documentation,

Reviewers: lattner, thegameg, courbet

Subscribers: dschuff, arsenm, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, Jim, s.egerton, llvm-commits, courbet

Tags: #llvm

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

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

5 years agoFix time-trace breaking flame graph assumptions
Russell Gallop [Thu, 5 Sep 2019 09:26:04 +0000 (09:26 +0000)]
Fix time-trace breaking flame graph assumptions

-ftime-trace could break flame-graph assumptions on Windows, with an
inner scope overrunning outer scopes. This was due to the way that times
were truncated. Changed this so time_points for the flame-graph are
truncated instead of durations, preserving the relative order of event
starts and ends.

I have tried to retain the extra precision for the totals, which count
thousands or millions of events.

Added assert to check this property holds in future.

Fixes PR43043

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

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

5 years agoWin: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)
Hans Wennborg [Thu, 5 Sep 2019 09:07:05 +0000 (09:07 +0000)]
Win: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)

After r361885, realPathFromHandle() ends up getting called on the working
directory on each Clang invocation. This unveiled that the code didn't work for
paths on network shares.

For example, if one maps the local dir c:\src\tmp to x:

  net use x: \\localhost\c$\tmp

and run e.g. "clang -c foo.cc" in x:\, realPathFromHandle will get
\\?\UNC\localhost\c$\src\tmp\ back from GetFinalPathNameByHandleW, and would
strip off the initial \\?\ prefix, ending up with a path that doesn't work.

This patch makes the prefix stripping a little smarter to handle this case.

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

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

5 years ago[lib/ObjectYAML] - Cleanup the private interface of ELFState<ELFT>. NFCI.
George Rimar [Thu, 5 Sep 2019 08:59:28 +0000 (08:59 +0000)]
[lib/ObjectYAML] - Cleanup the private interface of ELFState<ELFT>. NFCI.

In D62809 I accidentally added "ELFState<ELFT> &State" as the
first parameter to two methods. There is no reason for having that.
I removed this argument and also moved finalizeStrings declaration to
remove an excessive 'private:' tag.

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

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

5 years agoRecommit r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:52:26 +0000 (08:52 +0000)]
Recommit r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol."

Fix: added missing return "return 0;"

Original commit message:
This eliminates one of the error(1) call in this lib.
It is different from the others because happens on a fields mapping stage
and can be easily fixed.

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

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

5 years agoRevert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:39:44 +0000 (08:39 +0000)]
Revert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol." (2)

Forgot to revert the cpp file.

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

5 years agoRevert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:38:29 +0000 (08:38 +0000)]
Revert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol."

It broke BBots:

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/36387/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17117/steps/test/logs/stdio

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

5 years ago[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.
George Rimar [Thu, 5 Sep 2019 08:28:43 +0000 (08:28 +0000)]
[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.

This eliminates one of the error(1) call in this lib.
It is different from the others because happens on a fields mapping stage
and can be easily fixed.

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

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

5 years ago[DWARF] Fix referencing Range List Tables from CUs for DWARF64.
Igor Kudrin [Thu, 5 Sep 2019 07:02:28 +0000 (07:02 +0000)]
[DWARF] Fix referencing Range List Tables from CUs for DWARF64.

As DW_AT_rnglists_base points after the header and headers have
different sizes for DWARF32 and DWARF64, we have to use the format
of the CU to adjust the offset correctly in order to extract
the referenced range list table.

The patch also changes the type of RangeSectionBase because in DWARF64
it is 8-bytes long.

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

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

5 years ago[DWARF] Support DWARF64 in DWARFListTableHeader.
Igor Kudrin [Thu, 5 Sep 2019 06:49:05 +0000 (06:49 +0000)]
[DWARF] Support DWARF64 in DWARFListTableHeader.

This enables 64-bit DWARF support for parsing range and location list tables.

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

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

5 years agoAMDGPU: Add intrinsics for address space identification
Matt Arsenault [Thu, 5 Sep 2019 02:20:39 +0000 (02:20 +0000)]
AMDGPU: Add intrinsics for address space identification

The library currently uses ptrtoint and directly checks the queue ptr
for this, which counts as a pointer capture.

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

5 years agoAMDGPU/GlobalISel: Restore insert point when getting aperture
Matt Arsenault [Thu, 5 Sep 2019 02:20:32 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Restore insert point when getting aperture

Avoids SSA violations in a future patch.

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

5 years agoAMDGPU/GlobalISel: Fix placeholder value used for addrspacecast
Matt Arsenault [Thu, 5 Sep 2019 02:20:29 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Fix placeholder value used for addrspacecast

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

5 years agoAMDGPU/GlobalISel: Fix assert on load from constant address
Matt Arsenault [Thu, 5 Sep 2019 02:20:25 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Fix assert on load from constant address

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

5 years ago[mir-canon][NFC] Adding -verify-machineinstrs to mir-canon tests.
Puyan Lotfi [Thu, 5 Sep 2019 02:10:41 +0000 (02:10 +0000)]
[mir-canon][NFC] Adding -verify-machineinstrs to mir-canon tests.

In the review process for some of the refactoring of MIRCanonicalizationPass it
was noted that some of the tests didn't have verifier enabled. Enabling here.

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

5 years agoUse -mtriple to fix AMDGPU test sensitive to object file format
Reid Kleckner [Thu, 5 Sep 2019 00:34:01 +0000 (00:34 +0000)]
Use -mtriple to fix AMDGPU test sensitive to object file format

GOTPCREL32 doesn't exist on COFF, so it isn't used when this test runs
on Windows.

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

5 years ago[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls
Jessica Paquette [Wed, 4 Sep 2019 22:54:52 +0000 (22:54 +0000)]
[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls

This adds support for basic sibling call lowering in AArch64. The intent here is
to only handle tail calls which do not change the ABI (hence, sibling calls.)

At this point, it is very restricted. It does not handle

- Vararg calls.
- Calls with outgoing arguments.
- Calls whose calling conventions differ from the caller's calling convention.
- Tail/sibling calls with BTI enabled.

This patch adds

- `AArch64CallLowering::isEligibleForTailCallOptimization`, which is equivalent
   to the same function in AArch64ISelLowering.cpp (albeit with the restrictions
   above.)
- `mayTailCallThisCC` and `canGuaranteeTCO`, which are identical to those in
   AArch64ISelLowering.cpp.
- `getCallOpcode`, which is exactly what it sounds like.

Tail/sibling calls are lowered by checking if they pass target-independent tail
call positioning checks, and checking if they satisfy
`isEligibleForTailCallOptimization`. If they do, then a tail call instruction is
emitted instead of a normal call. If we have a sibling call (which is always the
case in this patch), then we do not emit any stack adjustment operations. When
we go to lower a return, we check if we've already emitted a tail call. If so,
then we skip the return lowering.

For testing, this patch

- Adds call-translator-tail-call.ll to test which tail calls we currently lower,
  which ones we don't, and which ones we shouldn't.
- Updates branch-target-enforcement-indirect-calls.ll to show that we fall back
  as expected.

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

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

5 years agogn build: Merge r370985
Nico Weber [Wed, 4 Sep 2019 21:34:21 +0000 (21:34 +0000)]
gn build: Merge r370985

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

5 years ago[mir-canon][NFC] Move MIR vreg renaming code to separate file for better reuse.
Puyan Lotfi [Wed, 4 Sep 2019 21:29:10 +0000 (21:29 +0000)]
[mir-canon][NFC] Move MIR vreg renaming code to separate file for better reuse.

Moving MIRCanonicalizerPass vreg renaming code to MIRVRegNamerUtils so that it
can be reused in another pass (ie planing to write a standalone mir-namer pass).

I'm going to write a mir-namer pass so that next time someone has to author a
test in MIR, they can use it to cleanup the naming and make it more readable by
having the numbered vregs swapped out with named vregs.

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

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

5 years agoAMDGPU/GlobalISel: Select G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 20:46:31 +0000 (20:46 +0000)]
AMDGPU/GlobalISel: Select G_BITREVERSE

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

5 years agoGlobalISel: Add basic legalization for G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 20:46:15 +0000 (20:46 +0000)]
GlobalISel: Add basic legalization for G_BITREVERSE

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