platform/upstream/llvm.git
6 years ago[DAGCombiner] Extending pattern detection for vector shuffle.
Simon Pilgrim [Fri, 4 Aug 2017 12:46:35 +0000 (12:46 +0000)]
[DAGCombiner] Extending pattern detection for vector shuffle.

If all the operands of a BUILD_VECTOR extract elements from same vector then split the vector efficiently based on the maximum vector access index.

Committed on behalf of @jbhateja (Jatin Bhateja)

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

llvm-svn: 310058

6 years agoRevert r304953 for release 5.0.0
Stefan Maksimovic [Fri, 4 Aug 2017 12:37:34 +0000 (12:37 +0000)]
Revert r304953 for release 5.0.0

This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.

Faliures manifest for stage2 mips build.

llvm-svn: 310057

6 years ago[ForwardOpTree] Refactor out forwardSpeculatable(). NFC.
Michael Kruse [Fri, 4 Aug 2017 12:28:42 +0000 (12:28 +0000)]
[ForwardOpTree] Refactor out forwardSpeculatable(). NFC.

The method forwardSpeculatable forwards speculatively executable
instructions and is currently the only way to forward an
instruction.

In the future we intend to add more methods.

llvm-svn: 310056

6 years ago[DSE] Merge stores when the later store only writes to memory locations the early...
Filipe Cabecinhas [Fri, 4 Aug 2017 12:28:36 +0000 (12:28 +0000)]
[DSE] Merge stores when the later store only writes to memory locations the early store also wrote to.

Summary:
This fixes PR31777.

If both stores' values are ConstantInt, we merge the two stores
(shifting the smaller store appropriately) and replace the earlier (and
larger) store with an updated constant.

In the future we should also support vectors of integers. And maybe
float/double if we can.

Reviewers: hfinkel, junbuml, jfb, RKSimon, bkramer

Subscribers: llvm-commits

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

llvm-svn: 310055

6 years ago[InstCombine] Canonicalize clamp of float types to minmax in fast mode.
Nikolai Bozhenov [Fri, 4 Aug 2017 12:22:17 +0000 (12:22 +0000)]
[InstCombine] Canonicalize clamp of float types to minmax in fast mode.

Summary:
This commit allows matchSelectPattern to recognize clamp of float
arguments in the presence of FMF the same way as already done for
integers.

This case is a little different though. With integers, given the
min/max pattern is recognized, DAGBuilder starts selecting MIN/MAX
"automatically". That is not the case for float, because for them only
full FMINNAN/FMINNUM/FMAXNAN/FMAXNUM ISD nodes exist and they do care
about NaNs. On the other hand, some backends (e.g. X86) have only
FMIN/FMAX nodes that do not care about NaNS and the former NAN/NUM
nodes are illegal thus selection is not happening. So I decided to do
such kind of transformation in IR (InstCombiner) instead of
complicating the logic in the backend.

Reviewers: spatel, jmolloy, majnemer, efriedma, craig.topper

Reviewed By: efriedma

Subscribers: hiraditya, javed.absar, n.bozhenov, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

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

llvm-svn: 310054

6 years agoAdd some tests for cast+clamp/min/max before D33186.
Nikolai Bozhenov [Fri, 4 Aug 2017 12:21:03 +0000 (12:21 +0000)]
Add some tests for cast+clamp/min/max before D33186.

Summary:
- add more tests
- pr27236.ll: rename %tmpN -> %N because otherwise a FileCheck
  variable for newly appeared unnamed value would use the same name as
  tmpN (as generated by update_test_checks.py)
- run update_test_checks.py

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: n.bozhenov, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

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

llvm-svn: 310053

6 years ago[PM] Make the new-pm passes behave more like the legacy passes
Philip Pfaffe [Fri, 4 Aug 2017 11:28:51 +0000 (11:28 +0000)]
[PM] Make the new-pm passes behave more like the legacy passes

Summary:
Testing the new-pm passes becomes much easier once they behave more like the
old passes in terms of the order in which Scops are processed and printed. This
requires three changes:
- ScopInfo: Use an ordered map to store scops
- ScopInfo: Iterate and print Scops in reverse order to match legacy PM behaviour
- ScopDetection: print function name in ScopAnalysisPrinter

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

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

llvm-svn: 310052

6 years ago[clang-tidy] Add missing documents for "IgnoreMacros" option.
Haojian Wu [Fri, 4 Aug 2017 11:25:05 +0000 (11:25 +0000)]
[clang-tidy] Add missing documents for "IgnoreMacros" option.

llvm-svn: 310051

6 years ago[clang-tidy] Ignore macros in make-unique check.
Haojian Wu [Fri, 4 Aug 2017 11:18:00 +0000 (11:18 +0000)]
[clang-tidy] Ignore macros in make-unique check.

Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 310050

6 years ago[ELF] - Move getSymbols() methods to InputFile.
George Rimar [Fri, 4 Aug 2017 11:07:42 +0000 (11:07 +0000)]
[ELF] - Move getSymbols() methods to InputFile.

It can help to detemplate code.

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

llvm-svn: 310049

6 years ago[AMDGPU] Fixed MSVC build break
Florian Gross [Fri, 4 Aug 2017 10:53:07 +0000 (10:53 +0000)]
[AMDGPU] Fixed MSVC build break

Error was:

field of type 'llvm::ArgDescriptor' has private default constructor
const AMDGPUFunctionArgInfo AMDGPUArgumentUsageInfo::ExternFunctionInfo{};
                                                                        ^

llvm-svn: 310048

6 years ago[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.
Florian Hahn [Fri, 4 Aug 2017 10:40:18 +0000 (10:40 +0000)]
[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.

Summary:
M-class profiles do not support ARM execution mode, so providing
-marm/-mno-thumb does not make sense in combination with -mcpu/-march
options that support the M-profile.

This is a follow-up patch to D35569 and it seemed pretty clear that we
should emit an error in the driver in this case.

We probably also should warn/error if the provided -mcpu/-march options
do not match, e.g. -mcpu=cortex-m0 -march=armv8-a is invalid, as
cortex-m0 does not support armv8-a. But that should be a separate patch
I think.

Reviewers: echristo, richard.barton.arm, rengolin, labrinea, charles.baylis

Reviewed By: rengolin

Subscribers: aemerson, javed.absar, kristof.beyls, cfe-commits

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

llvm-svn: 310047

6 years ago[ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.
George Rimar [Fri, 4 Aug 2017 10:34:14 +0000 (10:34 +0000)]
[ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.

D35945 introduces change when there is useless to check Error flag
in few places, but ErrorCount must be checked instead.

But then we probably can just check ErrorCount always. That should simplify
things. Patch do that.

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

llvm-svn: 310046

6 years ago[ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts"
George Rimar [Fri, 4 Aug 2017 10:25:29 +0000 (10:25 +0000)]
[ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts"

This is PR33889,

Patch adds support of combination of linkerscript and
-symbol-ordering-file option.

If no sorting commands are present in script inside section declaration
and no --sort-section option specified, code uses sorting from ordering
file if any exist.

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

llvm-svn: 310045

6 years ago[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
Zoran Jovanovic [Fri, 4 Aug 2017 10:18:44 +0000 (10:18 +0000)]
[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
Author: milena.vujosevic.janicic
The patch extends size reduction pass for MicroMIPS.
The following instructions are examined and transformed, if possible:
ADDIU instruction is transformed into 16-bit instruction ADDIUSP
ADDIU instruction is transformed into 16-bit instruction ADDIUR1SP
Usage of u_int64_t replaced by uint64_t to avoid issues because of which previous patch version was reverted:
Differential Revision: https://reviews.llvm.org/D34511

llvm-svn: 310044

6 years ago[Polly][PM] Register polly passes with the opt tool for the new-pm path
Philip Pfaffe [Fri, 4 Aug 2017 09:28:09 +0000 (09:28 +0000)]
[Polly][PM] Register polly passes with the opt tool for the new-pm path

Summary: When polly is linked into the tools because of the LLVM_POLLY_LINK_INTO_TOOLS option being set, we need to register its passes with the PassBuilder. Because polly is linked in, we can directly call its callback registration method, which registers the appropriate callbacks with the new PM's PassBuilder. This essentially follows exactly the way it worked with the legacy PM.

Reviewers: grosser, chandlerc, bollu

Reviewed By: grosser

Subscribers: pollydev, llvm-commits

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

llvm-svn: 310043

6 years ago[ELF] Explicitly write null bytes in string tables
James Henderson [Fri, 4 Aug 2017 09:07:55 +0000 (09:07 +0000)]
[ELF] Explicitly write null bytes in string tables

Following r309829, if a string table appears in an executable segment, the strings
will not be null terminated. This is a problem, for example, for the .dynstr
section when using -no-rosegment. The strings end up being terminated with 0xcc
because prior to this patch, LLD did not explicitly write the null terminators.
This change fixes that by always writing the null terminators.

Reviewers: rafael

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

llvm-svn: 310042

6 years agoFix typo and update documentation.
Manuel Klimek [Fri, 4 Aug 2017 08:41:42 +0000 (08:41 +0000)]
Fix typo and update documentation.

The hasDeclaration documentation was outdated after r288366.

llvm-svn: 310041

6 years ago[ELF] - Replace parallelForEach with ranged form.
George Rimar [Fri, 4 Aug 2017 08:30:16 +0000 (08:30 +0000)]
[ELF] - Replace parallelForEach with ranged form.

Makes code a bit more convinent to write/read.

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

llvm-svn: 310040

6 years ago[NFC] Fix r310036: Appease clang-format
Philip Pfaffe [Fri, 4 Aug 2017 08:26:45 +0000 (08:26 +0000)]
[NFC] Fix r310036: Appease clang-format

llvm-svn: 310039

6 years ago[mips] Fix typo (missed space) in the warning message
Simon Atanasyan [Fri, 4 Aug 2017 08:25:15 +0000 (08:25 +0000)]
[mips] Fix typo (missed space) in the warning message

llvm-svn: 310038

6 years ago[mips] Code formatting fix. NFC
Simon Atanasyan [Fri, 4 Aug 2017 08:25:09 +0000 (08:25 +0000)]
[mips] Code formatting fix. NFC

llvm-svn: 310037

6 years ago[NFC] ScopPass: Remove unused AnalysisKey from OwningInnerAnalysisManagerProxy
Philip Pfaffe [Fri, 4 Aug 2017 08:12:31 +0000 (08:12 +0000)]
[NFC] ScopPass: Remove unused AnalysisKey from OwningInnerAnalysisManagerProxy

llvm-svn: 310036

6 years ago[clang-tidy] Support initializer-list constructor cases in modernize-make-unique.
Haojian Wu [Fri, 4 Aug 2017 08:07:05 +0000 (08:07 +0000)]
[clang-tidy] Support initializer-list constructor cases in modernize-make-unique.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: malcolm.parsons, JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 310035

6 years agoDo not declare a variable which is used only in assert. NFC
Max Kazantsev [Fri, 4 Aug 2017 07:41:24 +0000 (07:41 +0000)]
Do not declare a variable which is used only in assert. NFC

llvm-svn: 310034

6 years ago[msan] Switch the pvalloc overflow test to a lit test
Benjamin Kramer [Fri, 4 Aug 2017 07:32:10 +0000 (07:32 +0000)]
[msan] Switch the pvalloc overflow test to a lit test

The test was not passing on targets where allocator_may_return_null
defaults to true. Change the test to a lit test so that we can test both
situations.

Patch by Kostya Kortchinsky!

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

llvm-svn: 310033

6 years ago[IRCE] Handle loops with step different from 1/-1
Max Kazantsev [Fri, 4 Aug 2017 07:01:04 +0000 (07:01 +0000)]
[IRCE] Handle loops with step different from 1/-1

This patch generalizes IRCE to handle IV steps that are not equal to 1 or -1.

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

llvm-svn: 310032

6 years ago[AMDGPU] Preserve inverted bit in SI_IF in presence of SI_KILL
Stanislav Mekhanoshin [Fri, 4 Aug 2017 06:58:42 +0000 (06:58 +0000)]
[AMDGPU] Preserve inverted bit in SI_IF in presence of SI_KILL

In case if SI_KILL is in between of the SI_IF and SI_END_CF we need
to preserve the bits actually flipped by if rather then restoring
the original mask.

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

llvm-svn: 310031

6 years agoRevert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."
NAKAMURA Takumi [Fri, 4 Aug 2017 06:35:32 +0000 (06:35 +0000)]
Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."

It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm"

llvm-svn: 310030

6 years agoAvoid comparison between signed and unsigned in SCEVExitLimitForget tests
Max Kazantsev [Fri, 4 Aug 2017 06:03:51 +0000 (06:03 +0000)]
Avoid comparison between signed and unsigned in SCEVExitLimitForget tests

llvm-svn: 310029

6 years ago[AVR] Update target machine to use new constructor parameters
Dylan McKay [Fri, 4 Aug 2017 05:48:20 +0000 (05:48 +0000)]
[AVR] Update target machine to use new constructor parameters

The required parameters were changed in r309911.

llvm-svn: 310028

6 years ago[IRCE] Recognize loops with unsigned latch conditions
Max Kazantsev [Fri, 4 Aug 2017 05:40:20 +0000 (05:40 +0000)]
[IRCE] Recognize loops with unsigned latch conditions

This patch enables recognition of loops with ult/ugt latch conditions.

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

llvm-svn: 310027

6 years agoRevert "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Fri, 4 Aug 2017 05:33:44 +0000 (05:33 +0000)]
Revert "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"

This breaks the build on clang-s390x-linux.

This reverts commit r310018.

llvm-svn: 310026

6 years ago[InstCombine] Move the call to foldSelectICmpAnd into foldSelectInstWithICmp. NFCI
Craig Topper [Fri, 4 Aug 2017 05:12:37 +0000 (05:12 +0000)]
[InstCombine] Move the call to foldSelectICmpAnd into foldSelectInstWithICmp. NFCI

llvm-svn: 310025

6 years ago[InstCombine] Remove unnecessary casts. NFC
Craig Topper [Fri, 4 Aug 2017 05:12:35 +0000 (05:12 +0000)]
[InstCombine] Remove unnecessary casts. NFC

We're calling an overload of getOpcode that already returns Instruction::CastOps.

llvm-svn: 310024

6 years agoFix SCEVExitLimitForget tests to make Sanitizer happy
Max Kazantsev [Fri, 4 Aug 2017 05:06:44 +0000 (05:06 +0000)]
Fix SCEVExitLimitForget tests to make Sanitizer happy

llvm-svn: 310023

6 years agoPrevent unused warning in non-assert builds (introduced in r310014).
Daniel Jasper [Fri, 4 Aug 2017 05:05:29 +0000 (05:05 +0000)]
Prevent unused warning in non-assert builds (introduced in r310014).

llvm-svn: 310022

6 years agoUn-revert r310014: false revert, it wasn't the cause of build break
Victor Leschuk [Fri, 4 Aug 2017 04:51:15 +0000 (04:51 +0000)]
Un-revert r310014: false revert, it wasn't the cause of build break

llvm-svn: 310021

6 years agoRevert r310014 as it breaks build lld-x86_64-darwin13
Victor Leschuk [Fri, 4 Aug 2017 04:43:54 +0000 (04:43 +0000)]
Revert r310014 as it breaks build lld-x86_64-darwin13

llvm-svn: 310020

6 years agoRevert "[coverage] Special-case calls to noreturn functions."
Vedant Kumar [Fri, 4 Aug 2017 04:08:23 +0000 (04:08 +0000)]
Revert "[coverage] Special-case calls to noreturn functions."

This reverts commit r309995. It looks like it's responsible for breaking
the stage2 coverage build:

http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402

The cfe-commits discussion re: r309995 has more context.

llvm-svn: 310019

6 years agoReland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Fri, 4 Aug 2017 03:17:37 +0000 (03:17 +0000)]
Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"

This change adds the "-O binary" flag which directs llvm-objcopy to
output the object file to the same format as GNU objcopy does when given
the flag "-O binary". This was done by splitting the Object class into
two subclasses ObjectELF and ObjectBianry which each output a different
format but relay on the same code to read in the Object in Object.

Patch by Jake Ehrlich

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

llvm-svn: 310018

6 years ago[Driver][Fuchsia] Pass --hash-style=gnu to the linker
Petr Hosek [Fri, 4 Aug 2017 02:39:27 +0000 (02:39 +0000)]
[Driver][Fuchsia] Pass --hash-style=gnu to the linker

The .gnu_hash format is superior, and all versions of the Fuchsia
dynamic linker support it.

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

llvm-svn: 310017

6 years ago[Support] Update comments about stdout, raw_fd_ostream, and outs()
Reid Kleckner [Fri, 4 Aug 2017 01:39:23 +0000 (01:39 +0000)]
[Support] Update comments about stdout, raw_fd_ostream, and outs()

The full story is in the comments:

  // Do not attempt to close stdout or stderr. We used to try to maintain the
  // property that tools that support writing file to stdout should not also
  // write informational output to stdout, but in practice we were never able to
  // maintain this invariant. Many features have been added to LLVM and clang
  // (-fdump-record-layouts, optimization remarks, etc) that print to stdout, so
  // users must simply be aware that mixed output and remarks is a possibility.

NFC, I am just updating comments to reflect reality.

llvm-svn: 310016

6 years agocoverage: Update tests to reflect changes from r310012
Vedant Kumar [Fri, 4 Aug 2017 01:22:19 +0000 (01:22 +0000)]
coverage: Update tests to reflect changes from r310012

llvm-svn: 310015

6 years agoTeach GlobalSRA to update the debug info for split-up globals.
Adrian Prantl [Fri, 4 Aug 2017 01:19:54 +0000 (01:19 +0000)]
Teach GlobalSRA to update the debug info for split-up globals.

This is similar to what we are doing in "regular" SROA and creates
DW_OP_LLVM_fragment operations to describe the resulting variables.

rdar://problem/33654891

llvm-svn: 310014

7 years ago[AMDGPU] Add missing hazard for DPP-after-EXEC-write
Connor Abbott [Fri, 4 Aug 2017 01:09:43 +0000 (01:09 +0000)]
[AMDGPU] Add missing hazard for DPP-after-EXEC-write

Summary:
Following the docs, we need at least 5 wait states between an EXEC write
and an instruction that uses DPP.

Reviewers: tstellar, arsenm

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

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

llvm-svn: 310013

7 years ago[llvm-cov] Ignore unclosed line segments when setting line counts
Vedant Kumar [Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)]
[llvm-cov] Ignore unclosed line segments when setting line counts

This patch makes a slight change to the way llvm-cov determines line
execution counts. If there are multiple line segments on a line, the
line count is the max count among the regions which start *and* end on
the line. This avoids an issue posed by deferred regions which start on
the same line as a terminated region, e.g:

  if (false)
    return; //< The line count should be 0, even though a new region
            //< starts at the semi-colon.
  foo();

Another change is that counts from line segments which don't correspond
to region entries are considered. This enables the first change, and
corrects an outstanding issue (see the showLineExecutionCounts.cpp test
change).

This is related to D35925.

Testing: check-profile, llvm-cov lit tests

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

llvm-svn: 310012

7 years ago[llvm-cov] NFC: make_unique-ify two allocations
Vedant Kumar [Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)]
[llvm-cov] NFC: make_unique-ify two allocations

llvm-svn: 310011

7 years ago[Coverage] Precise region termination with deferred regions
Vedant Kumar [Fri, 4 Aug 2017 00:29:20 +0000 (00:29 +0000)]
[Coverage] Precise region termination with deferred regions

The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang
llvm-svn: 310010

7 years agoDisable libFuzzer tests on Windows
George Karpenkov [Fri, 4 Aug 2017 00:26:12 +0000 (00:26 +0000)]
Disable libFuzzer tests on Windows

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

llvm-svn: 310009

7 years agoRevert "[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is...
Vitaly Buka [Fri, 4 Aug 2017 00:25:24 +0000 (00:25 +0000)]
Revert "[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true"

Breaks check-llvm under ubsan.

This reverts commit r309949.

llvm-svn: 310008

7 years agoAMDGPU: Remove pointless asserts
Matt Arsenault [Fri, 4 Aug 2017 00:00:13 +0000 (00:00 +0000)]
AMDGPU: Remove pointless asserts

llvm-svn: 310007

7 years ago[Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.
Akira Hatanaka [Thu, 3 Aug 2017 23:55:42 +0000 (23:55 +0000)]
[Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.

This commit fixes a bug where clang/llvm doesn't emit an unwind table
for a function when it is marked noexcept. Without this patch, the
following code terminates with an uncaught exception on ARM64:

int foo1() noexcept {
  try {
    throw 0;
  } catch (int i) {
    return 0;
  }
  return 1;
}

int main() {
  return foo1();
}

rdar://problem/32411865

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

llvm-svn: 310006

7 years agoUse profile summary to disable peeling for huge working sets
Teresa Johnson [Thu, 3 Aug 2017 23:42:58 +0000 (23:42 +0000)]
Use profile summary to disable peeling for huge working sets

Summary:
Detect when the working set size of a profiled application is huge,
by comparing the number of counts required to reach the hot percentile
in the profile summary to a large threshold*.

When the working set size is determined to be huge, disable peeling
to avoid bloating the working set further.

*Note that the selected threshold (15K) is significantly larger than the
largest working set value in SPEC cpu2006 (which is gcc at around 11K).

Reviewers: davidxl

Subscribers: mehdi_amini, mzolotukhin, eraman, llvm-commits

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

llvm-svn: 310005

7 years agoAMDGPU: Don't use report_fatal_error for unsupported call types
Matt Arsenault [Thu, 3 Aug 2017 23:32:41 +0000 (23:32 +0000)]
AMDGPU: Don't use report_fatal_error for unsupported call types

llvm-svn: 310004

7 years agoAMDGPU: Remove error on calls for amdgcn
Matt Arsenault [Thu, 3 Aug 2017 23:24:05 +0000 (23:24 +0000)]
AMDGPU: Remove error on calls for amdgcn

Repurpose the -amdgpu-function-calls flag. Rather
than require it to emit a call, only use it to
run the always inline path or not.

llvm-svn: 310003

7 years agoAMDGPU: Fix implicitarg.ptr handling special inputs
Matt Arsenault [Thu, 3 Aug 2017 23:12:44 +0000 (23:12 +0000)]
AMDGPU: Fix implicitarg.ptr handling special inputs

llvm-svn: 310002

7 years agoSupport: WOA64 and WOA Signals
Martell Malone [Thu, 3 Aug 2017 23:12:33 +0000 (23:12 +0000)]
Support: WOA64 and WOA Signals

Reviewers: rnk

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

llvm-svn: 310001

7 years ago[llvm-pdbutil] Add an option to only dump specific module indices.
Zachary Turner [Thu, 3 Aug 2017 23:11:52 +0000 (23:11 +0000)]
[llvm-pdbutil] Add an option to only dump specific module indices.

Often something interesting (like a symbol) is in a particular
module, and you don't want to dump symbols from all other 300
modules to see the one you want.  This adds a -modi option so that
we only dump the specified module.

llvm-svn: 310000

7 years agoEnable AddressSanitizer for Fuchsia targets
Petr Hosek [Thu, 3 Aug 2017 23:02:22 +0000 (23:02 +0000)]
Enable AddressSanitizer for Fuchsia targets

Patch by Roland McGrath

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

llvm-svn: 309999

7 years agoAMDGPU: Pass special input registers to functions
Matt Arsenault [Thu, 3 Aug 2017 23:00:29 +0000 (23:00 +0000)]
AMDGPU: Pass special input registers to functions

llvm-svn: 309998

7 years agoFix typo.
Eric Christopher [Thu, 3 Aug 2017 22:41:12 +0000 (22:41 +0000)]
Fix typo.

llvm-svn: 309997

7 years agoAMDGPU: Add analysis pass for function argument info
Matt Arsenault [Thu, 3 Aug 2017 22:30:46 +0000 (22:30 +0000)]
AMDGPU: Add analysis pass for function argument info

This will allow only adding necessary inputs to callee functions
that need special inputs forwarded from the kernel.

llvm-svn: 309996

7 years ago[coverage] Special-case calls to noreturn functions.
Eli Friedman [Thu, 3 Aug 2017 22:27:36 +0000 (22:27 +0000)]
[coverage] Special-case calls to noreturn functions.

The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

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

llvm-svn: 309995

7 years ago[Inliner] Increase threshold for hot callsites without PGO.
Easwaran Raman [Thu, 3 Aug 2017 22:23:33 +0000 (22:23 +0000)]
[Inliner] Increase threshold for hot callsites without PGO.

Summary:
This increases the inlining threshold for hot callsites. Hotness is
defined in terms of block frequency of the callsite relative to the
caller's entry block's frequency. Since this requires BFI in the
inliner, this only affects the new PM pipeline. This is enabled by
default at -O3.

This improves the performance of some internal benchmarks. Notably, an
internal benchmark for Gipfeli compression
(https://github.com/google/gipfeli) improves by ~7%. Povray in SPEC2006
improves by ~2.5%. I am running more experiments and will update the
thread if other benchmarks show improvement/regression.

In terms of text size, LLVM test-suite shows an 1.22% text size
increase. Diving into the results, 13 of the benchmarks in the
test-suite increases by > 10%. Most of these are small, but
Adobe-C++/loop_unroll (17.6% increases) and tramp3d(20.7% size increase)
have >250K text size. On a large application, the text size increases by
2%

Reviewers: chandlerc, davidxl

Subscribers: llvm-commits

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

llvm-svn: 309994

7 years ago[Mips] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Thu, 3 Aug 2017 22:12:30 +0000 (22:12 +0000)]
[Mips] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309993

7 years ago[VirtualInstruction] Handle MetadataAsValue as constant.
Michael Kruse [Thu, 3 Aug 2017 22:00:01 +0000 (22:00 +0000)]
[VirtualInstruction] Handle MetadataAsValue as constant.

The complication of bspatch.cc of the AOSP buildbot currently fails
presumably because the occurance of a MetadataAsValue in an operand.
This kind of value can occur as operands of intrinsics, the typical
example being the debug intrinsics.

Polly currently ignores the debug intrinsics and it is not yet clear
which other intrinic might occur. For such cases, and to unbreak the
AOSP buildbot, treat a MetadataAsValue as a constant because it can be
referenced without modification in generated code.

llvm-svn: 309992

7 years agoDAG: Provide access to Pass instance from SelectionDAG
Matt Arsenault [Thu, 3 Aug 2017 21:54:00 +0000 (21:54 +0000)]
DAG: Provide access to Pass instance from SelectionDAG

This allows accessing an analysis pass during lowering.

llvm-svn: 309991

7 years ago[GlobalISel] Make GlobalISel a non-optional library.
Quentin Colombet [Thu, 3 Aug 2017 21:52:25 +0000 (21:52 +0000)]
[GlobalISel] Make GlobalISel a non-optional library.

With this change, the GlobalISel library gets always built. In
particular, this is not possible to opt GlobalISel out of the build
using the LLVM_BUILD_GLOBAL_ISEL variable any more.

llvm-svn: 309990

7 years ago[PDB] Loosen checks for section contribution sizes
Reid Kleckner [Thu, 3 Aug 2017 21:20:41 +0000 (21:20 +0000)]
[PDB] Loosen checks for section contribution sizes

The PDB debug data directory entry has an absolute path in it. This will
make it different on every machine.

llvm-svn: 309989

7 years ago[NewGVN] Fix the case where we have a phi-of-ops which goes away.
Davide Italiano [Thu, 3 Aug 2017 21:17:49 +0000 (21:17 +0000)]
[NewGVN] Fix the case where we have a phi-of-ops which goes away.

Patch by Daniel Berlin, fixes PR33196 (and probably something else).

llvm-svn: 309988

7 years ago[PDB] Fix section contributions
Reid Kleckner [Thu, 3 Aug 2017 21:15:09 +0000 (21:15 +0000)]
[PDB] Fix section contributions

Summary:
PDB section contributions are supposed to use output section indices and
offsets, not input section indices and offsets.

This allows the debugger to look up the index of the module that it
should look up in the modules stream for symbol information. With this
change, windbg can now find line tables, but it still cannot print local
variables.

Fixes PR34048

Reviewers: zturner

Subscribers: hiraditya, ruiu, llvm-commits

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

llvm-svn: 309987

7 years ago[LVI] Constant-propagate a zero extension of the switch condition value through case...
Hiroshi Yamauchi [Thu, 3 Aug 2017 21:11:30 +0000 (21:11 +0000)]
[LVI] Constant-propagate a zero extension of the switch condition value through case edges

Summary:
(This is a second attempt as https://reviews.llvm.org/D34822 was reverted.)

LazyValueInfo currently computes the constant value of the switch condition through case edges, which allows the constant value to be propagated through the case edges.

But we have seen a case where a zero-extended value of the switch condition is used past case edges for which the constant propagation doesn't occur.

This patch adds a small logic to handle such a case in getEdgeValueLocal().

This is motivated by the Python 2.7 eval loop in PyEval_EvalFrameEx() where the lack of the constant propagation causes longer live ranges and more spill code than necessary.

With this patch, we see that the code size of PyEval_EvalFrameEx() decreases by ~5.4% and a performance test improves by ~4.6%.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 309986

7 years agoMove unit test to the proper location
Taewook Oh [Thu, 3 Aug 2017 21:07:12 +0000 (21:07 +0000)]
Move unit test to the proper location

Summary: Move test/CodeGen/AArch64/reg-bank-128bit.mir to test/CodeGen/AArch64/GlobalISel/reg-bank-128bit.mir so that the test is executed only when global-isel is enabled. lit.local.cfg under test/CodeGen/AArch64/GlobalISel checks if 'global-isel' is in the available_features while the same file under test/CodeGen/AArch64 doesn't.

Reviewers: qcolombet, davide

Reviewed By: davide

Subscribers: davide, aemerson, javed.absar, igorb, kristof.beyls, llvm-commits

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

llvm-svn: 309985

7 years agoUse "foo-12345.o" instead of "foo.o-12345" as temporary file name.
Nico Weber [Thu, 3 Aug 2017 21:06:36 +0000 (21:06 +0000)]
Use "foo-12345.o" instead of "foo.o-12345" as temporary file name.

This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj", tools
like this will now skip the temp files as well.

https://reviews.llvm.org/D36238

llvm-svn: 309984

7 years ago[llvm-pdbutil] Allow diff to force module equivalencies.
Zachary Turner [Thu, 3 Aug 2017 20:30:09 +0000 (20:30 +0000)]
[llvm-pdbutil] Allow diff to force module equivalencies.

Sometimes the normal module equivalence detection algorithm doesn't
quite work.  For example, you might build the same program with
MSVC and clang-cl, outputting to different object files, exes, and
PDBs, then compare them.  If the object files have different names
though, then they won't be treated as equivalent.  This way we
can force specific module indices to be treated as equivalent.

llvm-svn: 309983

7 years ago[libFuzzer] Un-reverting change in tests after fixing the failure on Linux.
George Karpenkov [Thu, 3 Aug 2017 20:28:16 +0000 (20:28 +0000)]
[libFuzzer] Un-reverting change in tests after fixing the failure on Linux.

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

llvm-svn: 309982

7 years agotest commit
Connor Abbott [Thu, 3 Aug 2017 20:22:30 +0000 (20:22 +0000)]
test commit

llvm-svn: 309981

7 years agoFix llvm-for-windows-on-linux build after LLVM r272701.
Nico Weber [Thu, 3 Aug 2017 20:10:47 +0000 (20:10 +0000)]
Fix llvm-for-windows-on-linux build after LLVM r272701.

The file is called "intrin.h". When building targeting Windows on a Linux
system, with the SDK mounted in a case-insensitive file system, "Intrin.h" will
miss clang's intrin.h header (because that's not in a case-insensitive file
system) but then find intrin.h in the Microsoft SDK. clang can't handle the
SDK's intrin.h.

https://reviews.llvm.org/D36281

llvm-svn: 309980

7 years ago[test] Fix clang library dir in LD_LIBRARY_PATH For stand-alone build
Michal Gorny [Thu, 3 Aug 2017 19:41:33 +0000 (19:41 +0000)]
[test] Fix clang library dir in LD_LIBRARY_PATH For stand-alone build

Prepend the clang library directory (determined using SHLIBDIR, alike
in clang) to the LD_LIBRARY_PATH to ensure that just-built clang
libraries will be used instead of a previous installed version.

When a stand-alone build is performed, LLVM_LIBS_DIR contains the path
to installed LLVM library directory. The same directory frequently
contains a previously installed version of clang. SHLIBDIR, on the other
hand, is always the build-tree directory, and therefore contains
the freshly built clang libraries.

In a non-stand-alone build, both paths will be the same and therefore
including them both will not cause any issues.

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

llvm-svn: 309979

7 years ago[mips] Revert r309942 & r309940
Simon Dardis [Thu, 3 Aug 2017 19:39:51 +0000 (19:39 +0000)]
[mips] Revert r309942 & r309940

This reverts commit r309942 & commit r309940.

A revert was requested following post commit review.

llvm-svn: 309978

7 years agoCut and paste error from r23162.
Jim Ingham [Thu, 3 Aug 2017 19:38:38 +0000 (19:38 +0000)]
Cut and paste error from r23162.

llvm-svn: 309977

7 years agoRevert accidentally-committed files.
Richard Smith [Thu, 3 Aug 2017 19:25:02 +0000 (19:25 +0000)]
Revert accidentally-committed files.

llvm-svn: 309976

7 years agoDon't emit undefined-internal warnings for CXXDeductionGuideDecls.
Richard Smith [Thu, 3 Aug 2017 19:24:27 +0000 (19:24 +0000)]
Don't emit undefined-internal warnings for CXXDeductionGuideDecls.

Patch by ~paul (cynecx on phabricator)! Some test massaging by me.

llvm-svn: 309975

7 years ago[builtins] Use Interlocked* intrinsics for atomics on MSVC
Martin Storsjo [Thu, 3 Aug 2017 19:04:28 +0000 (19:04 +0000)]
[builtins] Use Interlocked* intrinsics for atomics on MSVC

Tested on MSVC 2013, 2015 and 2017 targeting X86, X64 and ARM.

This fixes building emutls.c for Windows for ARM (both with clang
which don't need these atomics fallbacks at all, but just failed
due to the immintrin.h include before, and with MSVC).

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

llvm-svn: 309974

7 years agoThese tests use 80-bit long doubles, which are x86 only. Mark them so.
Sterling Augustine [Thu, 3 Aug 2017 18:56:54 +0000 (18:56 +0000)]
These tests use 80-bit long doubles, which are x86 only. Mark them so.

This avoids having each new target need to mark them as unsupported.

llvm-svn: 309973

7 years agoAdd an auto-continue flag to breakpoints & locations.
Jim Ingham [Thu, 3 Aug 2017 18:13:24 +0000 (18:13 +0000)]
Add an auto-continue flag to breakpoints & locations.

You can get a breakpoint to auto-continue by adding "continue"
as a command, but that has the disadvantage that if you hit two
breakpoints simultaneously, the continue will force the process
to continue, and maybe even forstalling the commands on the other.
The auto-continue flag means the breakpoints can negotiate about
whether to stop.

Writing tests, I wanted to supply some commands when I made the
breakpoints, so I also added that ability.

llvm-svn: 309969

7 years ago[Analyzer] Add support for displaying cross-file diagnostic paths in HTML output
Devin Coughlin [Thu, 3 Aug 2017 18:12:22 +0000 (18:12 +0000)]
[Analyzer] Add support for displaying cross-file diagnostic paths in HTML output

This change adds support for cross-file diagnostic paths in html output. If the
diagnostic path is not cross-file, there is no change in the output.

Patch by Vlad Tsyrklevich!

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

llvm-svn: 309968

7 years agoFix check-lit compatibility with multi-config CMake generators
Greg Bedwell [Thu, 3 Aug 2017 17:55:54 +0000 (17:55 +0000)]
Fix check-lit compatibility with multi-config CMake generators

Multi-configuration CMake generators such as those for Visual Studio or Xcode do not
specify a build config at configure time, but let the user choose at build
time.  In these cases binaries go into build/${Configuration}/bin rather than
build/bin.  Prior to this commit, check-lit would fail when using multi-configuration
generators as it did not know how to resolve ${Configuration} in order
to find tools such as FileCheck.  This commit teaches it to resolve
llvm_tools_dir within lit using the value specified with --param
build_mode.

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

llvm-svn: 309967

7 years agoDisable loop peeling during full unrolling pass.
Teresa Johnson [Thu, 3 Aug 2017 17:52:38 +0000 (17:52 +0000)]
Disable loop peeling during full unrolling pass.

Summary:
Peeling should not occur during the full unrolling invocation early
in the pipeline, but rather later with partial and runtime loop
unrolling. The later loop unrolling invocation will also eventually
utilize profile summary and branch frequency information, which
we would like to use to control peeling. And for ThinLTO we want
to delay peeling until the backend (post thin link) phase, just as
we do for most types of unrolling.

Ensure peeling doesn't occur during the full unrolling invocation
by adding a parameter to the shared implementation function, similar
to the way partial and runtime loop unrolling are disabled.

Performance results for ThinLTO suggest this has a neutral to positive
effect on some internal benchmarks.

Reviewers: chandlerc, davidxl

Subscribers: mzolotukhin, llvm-commits, mehdi_amini

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

llvm-svn: 309966

7 years agoDo not want to use BFI to get profile count for sample pgo
Dehao Chen [Thu, 3 Aug 2017 17:11:41 +0000 (17:11 +0000)]
Do not want to use BFI to get profile count for sample pgo

Summary: For SamplePGO, we already record the callsite count in the call instruction itself. So we do not want to use BFI to get profile count as it is less accurate.

Reviewers: tejohnson, davidxl, eraman

Reviewed By: eraman

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 309964

7 years ago[X86] Adding a test for vector shuffle extractions.
Simon Pilgrim [Thu, 3 Aug 2017 17:04:59 +0000 (17:04 +0000)]
[X86] Adding a test for vector shuffle extractions.

When both the vector inputs of the shuffle vector is comprising of same vector or shuffle mask is accessing elements from only one operand vector (like in PR33758 test already present).

Committed on behalf of @jbhateja (Jatin Bhateja)

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

llvm-svn: 309963

7 years agoRevert "[AArch64] Simplify AES*Tied pseudo expansion (NFC)."
Tim Northover [Thu, 3 Aug 2017 16:59:36 +0000 (16:59 +0000)]
Revert "[AArch64] Simplify AES*Tied pseudo expansion (NFC)."

This reverts commit r309821.

My suggestion was wrong because it left the MachineOperands tied which
confused the verifier. Since there's no easy way to untie operands, the
original BuildMI solution is probably best.

llvm-svn: 309962

7 years ago[X86][AVX512] Tidied up v64i8 vector shuffle tests with triple
Simon Pilgrim [Thu, 3 Aug 2017 16:56:52 +0000 (16:56 +0000)]
[X86][AVX512] Tidied up v64i8 vector shuffle tests with triple

llvm-svn: 309961

7 years agoRevert r304836.
Nico Weber [Thu, 3 Aug 2017 16:46:17 +0000 (16:46 +0000)]
Revert r304836.

See discussion in https://reviews.llvm.org/D33900#824172

llvm-svn: 309960

7 years agoAMDGPU/SI: Don't fix a PHI under uniform branch in SIFixSGPRCopies only when sources...
Changpeng Fang [Thu, 3 Aug 2017 16:37:02 +0000 (16:37 +0000)]
AMDGPU/SI: Don't fix a PHI under uniform branch in SIFixSGPRCopies only when sources and destination are all sgprs

Summary:
  If a PHI has at lease one VGPR operand, we have to fix the PHI
in SIFixSGPRCopies.

Reviewer:
  Matt

Differential Revision:
  http://reviews.llvm.org/D34727

llvm-svn: 309959

7 years ago[diagtool] Add ability to pass in the id and return the name for a
Don Hinton [Thu, 3 Aug 2017 16:13:13 +0000 (16:13 +0000)]
[diagtool] Add ability to pass in the id and return the name for a
particular diagnostic.

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

llvm-svn: 309955

7 years ago[ELF] - Do not segfault if linkerscript tries to access Target too early.
George Rimar [Thu, 3 Aug 2017 16:05:08 +0000 (16:05 +0000)]
[ELF] - Do not segfault if linkerscript tries to access Target too early.

Following possible scripts triggered accessing to Target when it was not yet
initialized (was nullptr).

MEMORY { name : ORIGIN = DATA_SEGMENT_RELRO_END; }
MEMORY { name : ORIGIN = CONSTANT(COMMONPAGESIZE); }

Patch errors out instead.

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

llvm-svn: 309953

7 years agoFix use after free in unit test.
Benjamin Kramer [Thu, 3 Aug 2017 15:59:37 +0000 (15:59 +0000)]
Fix use after free in unit test.

llvm-svn: 309952

7 years ago[DAG] Allow merging of stores of vector loads
Nirav Dave [Thu, 3 Aug 2017 15:51:20 +0000 (15:51 +0000)]
[DAG]  Allow merging of stores of vector loads

Remove restriction disallowing merging of stores vector loads into
larger store of larger vector load.

Reviewers: RKSimon, efriedma, spatel

Subscribers: llvm-commits

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

llvm-svn: 309951