platform/upstream/llvm.git
5 years ago[libc++] Fix build when exceptions are turned off
Louis Dionne [Tue, 2 Apr 2019 22:02:17 +0000 (22:02 +0000)]
[libc++] Fix build when exceptions are turned off

llvm-svn: 357533

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code
Aaron Enye Shi [Tue, 2 Apr 2019 21:54:41 +0000 (21:54 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code

clang-format the changes to CUDA and HIP fat binary.

Reviewers: yaxunl, tra

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

llvm-svn: 357532

5 years ago[libc++] Fix error flags and exceptions propagated from input stream operations
Louis Dionne [Tue, 2 Apr 2019 21:43:07 +0000 (21:43 +0000)]
[libc++] Fix error flags and exceptions propagated from input stream operations

Summary:
Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

I will submit a paper in San Diego to clarify the Standard such that the
interpretation used in this commit (and other implementations) is the only
possible one.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 357531

5 years ago[NFC][TSan][libdispatch] Cleanup test
Julian Lettner [Tue, 2 Apr 2019 20:58:49 +0000 (20:58 +0000)]
[NFC][TSan][libdispatch] Cleanup test

llvm-svn: 357530

5 years ago[X86] Mark the default case of the X86InstrInfo::convertToThreeAddress switch as...
Craig Topper [Tue, 2 Apr 2019 20:52:16 +0000 (20:52 +0000)]
[X86] Mark the default case of the X86InstrInfo::convertToThreeAddress switch as unreachable.

This function should only be called with instructions that are really convertible. And all
convertible instructions need to be handled by the switch. So nothing should use the default.

llvm-svn: 357529

5 years ago[X86] Check MI.isConvertibleTo3Addr() before calling convertToThreeAddress in X86Fixu...
Craig Topper [Tue, 2 Apr 2019 20:52:10 +0000 (20:52 +0000)]
[X86] Check MI.isConvertibleTo3Addr() before calling convertToThreeAddress in X86FixupLEAs.

X86FixupLEAs just assumes convertToThreeAddress will return nullptr for any instruction that isn't convertible.

But the code in convertToThreeAddress for X86 assumes that any instruction coming in has at least 2 operands and that the second one is a register. But those properties aren't guaranteed of all instructions. We should check the instruction property first.

llvm-svn: 357528

5 years ago[TableGen] Properly calculate the minimum size needed or ConvertFn in GenAsmmatcher...
Craig Topper [Tue, 2 Apr 2019 20:52:04 +0000 (20:52 +0000)]
[TableGen] Properly calculate the minimum size needed or ConvertFn in GenAsmmatcher.inc files

We were using the number of Matchables rather than the number of rows in the converter table.

This only matters for a few of the targets where the number of matchables is more than 255, but the number of converters is less than 255. Many of the targets have more than 256 converters. So already required a uint16_t.

llvm-svn: 357527

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code 2
Aaron Enye Shi [Tue, 2 Apr 2019 20:49:41 +0000 (20:49 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code 2

Also for CUDA, we need to disable producing these fat binary functions when there is no GPU code.

Reviewers: yaxunl, tra

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

llvm-svn: 357526

5 years ago[LLD][COFF] Move type merging structures out of PDB.cpp. NFC
Alexandre Ganea [Tue, 2 Apr 2019 20:43:19 +0000 (20:43 +0000)]
[LLD][COFF] Move type merging structures out of PDB.cpp. NFC

Introduce a new TypeMerger class, out of some type-merge-specific structures from PDB.cpp

No changes intended / this is only moving code around.

This patch is step 3. in "Proposed commit strategy" in D59226

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

llvm-svn: 357525

5 years ago[NFC] Test is C++, not C
Julian Lettner [Tue, 2 Apr 2019 20:39:10 +0000 (20:39 +0000)]
[NFC] Test is C++, not C

llvm-svn: 357524

5 years ago[x86] add more tests for FP scalarization; NFC
Sanjay Patel [Tue, 2 Apr 2019 20:24:06 +0000 (20:24 +0000)]
[x86] add more tests for FP scalarization; NFC

llvm-svn: 357523

5 years ago[InstCombine] Added tests for PR41337
David Bolvansky [Tue, 2 Apr 2019 20:21:26 +0000 (20:21 +0000)]
[InstCombine] Added tests for PR41337

llvm-svn: 357522

5 years ago[InstCombine] Simplify ctlz/cttz with bitreverse
David Bolvansky [Tue, 2 Apr 2019 20:13:28 +0000 (20:13 +0000)]
[InstCombine] Simplify ctlz/cttz with bitreverse

Summary: Fixes PR41273

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357521

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code
Aaron Enye Shi [Tue, 2 Apr 2019 20:10:18 +0000 (20:10 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code

Skip producing the fat binary functions for HIP when no device code is present.

Reviewers: yaxunl

Differential Review: https://reviews.llvm.org/D60141

llvm-svn: 357520

5 years ago[TSan][libdispatch] We don't require any setup on Darwin
Julian Lettner [Tue, 2 Apr 2019 20:04:32 +0000 (20:04 +0000)]
[TSan][libdispatch] We don't require any setup on Darwin

llvm-svn: 357519

5 years ago[AArch64][GlobalISel] Select llvm.aarch64.stlxr(i64, i64*)
Jessica Paquette [Tue, 2 Apr 2019 19:57:26 +0000 (19:57 +0000)]
[AArch64][GlobalISel] Select llvm.aarch64.stlxr(i64, i64*)

This adds partial instruction selection support for llvm.aarch64.stlxr. It also
factors out selection for G_INTRINSIC_W_SIDE_EFFECTS into its own function. The
new function removes the restriction that the intrinsic ID on the
G_INTRINSIC_W_SIDE_EFFECTS be on operand 0.

Also add a test, and add a GISel line to arm64-ldxr-stxr.ll.

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

llvm-svn: 357518

5 years ago[libc++] Correctly handle Objective-C++ ARC qualifiers in std::is_pointer
Louis Dionne [Tue, 2 Apr 2019 19:48:39 +0000 (19:48 +0000)]
[libc++] Correctly handle Objective-C++ ARC qualifiers in std::is_pointer

Summary:
Otherwise, std::is_pointer<id __strong> works, but std::is_pointer<id __weak>
(and others) don't work as expected.

rdar://problem/49126333

Reviewers: ahatanak, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 357517

5 years ago[Sema] Fix a use-after-deallocate of a ParsedAttr
Erik Pilkington [Tue, 2 Apr 2019 19:48:11 +0000 (19:48 +0000)]
[Sema] Fix a use-after-deallocate of a ParsedAttr

moveAttrFromListToList only makes sense when moving an attribute to a list with
a pool that's either equivalent, or has a shorter lifetime. Therefore, using it
to move a ParsedAttr from a declarator to a declaration specifier doesn't make
sense, since the declaration specifier's pool outlives the declarator's. The
patch adds a new function, ParsedAttributes::takeOneFrom, which transfers the
attribute from one pool to another, fixing the use-after-deallocate.

rdar://49175426

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

llvm-svn: 357516

5 years ago[CodeGen] Fix a regression by emitting lambda expressions in EmitLValue
Erik Pilkington [Tue, 2 Apr 2019 19:48:07 +0000 (19:48 +0000)]
[CodeGen] Fix a regression by emitting lambda expressions in EmitLValue

This ability was removed in r351487, but it's needed when a lambda appears as an
OpaqueValueExpr subexpression of a PseudoObjectExpr.

rdar://49030379

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

llvm-svn: 357515

5 years ago[OPENMP]Add codegen for private vars with allocate clause.
Alexey Bataev [Tue, 2 Apr 2019 19:44:46 +0000 (19:44 +0000)]
[OPENMP]Add codegen for private vars with allocate clause.

Added codegen/test for the privatized variables with the allocate
clause.

llvm-svn: 357514

5 years ago[NativePDB] Don't fail on import modules.
Zachary Turner [Tue, 2 Apr 2019 19:39:45 +0000 (19:39 +0000)]
[NativePDB] Don't fail on import modules.

A recent patch to LLD started emitting information about import modules.
These are represented as compile units in the PDB, but with no
additional debug info.  This was confusing the native pdb reader, who
expected that the debug info stream be present.

This should fix failing tests on the Windows bots.

llvm-svn: 357513

5 years ago[libc++] Remove use of auto with actual type
Louis Dionne [Tue, 2 Apr 2019 19:20:47 +0000 (19:20 +0000)]
[libc++] Remove use of auto with actual type

For compatibility with C++03.

llvm-svn: 357512

5 years ago[libc++][NFC] Remove useless public: label at the end of class
Louis Dionne [Tue, 2 Apr 2019 19:11:22 +0000 (19:11 +0000)]
[libc++][NFC] Remove useless public: label at the end of class

llvm-svn: 357511

5 years ago[NFC][libdispatch] Improve a few tests
Julian Lettner [Tue, 2 Apr 2019 18:46:59 +0000 (18:46 +0000)]
[NFC][libdispatch] Improve a few tests

llvm-svn: 357510

5 years ago[FileCheck] Fix FileCheck.cpp compilation on Solaris
Rainer Orth [Tue, 2 Apr 2019 18:38:23 +0000 (18:38 +0000)]
[FileCheck] Fix FileCheck.cpp compilation on Solaris

Both LLVM 8.0.0 and current trunk fail to compile on Solaris with GCC 8.1.0:

  /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp: In function ‘void DumpAnnotatedInput(llvm::raw_ostream&, const llvm::FileCheckRequest&, llvm::StringRef, std::vector<InputAnnotation>&, unsigned int)’:
  /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp:408:41: error: call of overloaded ‘log10(unsigned int&)’ is ambiguous
     unsigned LineNoWidth = log10(LineCount) + 1;
                                           ^
  In file included from /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/math.h:24,
                   from /vol/gcc-8/include/c++/8.1.0/cmath:45,
                   from /vol/llvm/src/llvm/dist/include/llvm-c/DataTypes.h:28,
                   from /vol/llvm/src/llvm/dist/include/llvm/Support/DataTypes.h:16,
                   from /vol/llvm/src/llvm/dist/include/llvm/ADT/Hashing.h:47,
                   from /vol/llvm/src/llvm/dist/include/llvm/ADT/ArrayRef.h:12,
                   from /vol/llvm/src/llvm/dist/include/llvm/Support/CommandLine.h:22,
                   from /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp:18:
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:209:21: note: candidate: ‘long double std::log10(long double)’
    inline long double log10(long double __X) { return __log10l(__X); }
                       ^~~~~
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:170:15: note: candidate: ‘float std::log10(float)’
    inline float log10(float __X) { return __log10f(__X); }
                 ^~~~~
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:70:15: note: candidate: ‘double std::log10(double)’
   extern double log10 __P((double));
                 ^~~~~

Fixed by using std::log10 instead, which allowed the compilation on i386-pc-solaris2.11
and sparc-sun-solaris2.11 to continue.

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

llvm-svn: 357509

5 years ago[InstCombine] Added tests for PR41273
David Bolvansky [Tue, 2 Apr 2019 18:33:54 +0000 (18:33 +0000)]
[InstCombine] Added tests for PR41273

llvm-svn: 357508

5 years ago[Reproducers] Print warning when generating the reproducer.
Jonas Devlieghere [Tue, 2 Apr 2019 18:23:16 +0000 (18:23 +0000)]
[Reproducers] Print warning when generating the reproducer.

Encourage users to look at the directory so they know what data they'd
be sharing by uploading the reproducer.

llvm-svn: 357507

5 years ago[driver][mips] Check both `gnuabi64` and `gnu` suffixes in `getMultiarchTriple`
Simon Atanasyan [Tue, 2 Apr 2019 18:03:31 +0000 (18:03 +0000)]
[driver][mips] Check both `gnuabi64` and `gnu` suffixes in `getMultiarchTriple`

In case of N64 ABI toolchain paths migth have `mips-linux-gnuabi64`
or `mips-linux-gnu` directory regardless of selected environment.
Check both variants while detecting a multiarch triple.

Fix for the bug https://bugs.llvm.org/show_bug.cgi?id=41204

llvm-svn: 357506

5 years ago[driver] clang-format. Fix indentation, split long lines. NFC
Simon Atanasyan [Tue, 2 Apr 2019 18:03:15 +0000 (18:03 +0000)]
[driver] clang-format. Fix indentation, split long lines. NFC

llvm-svn: 357505

5 years agoClean up windows build bot.
Greg Clayton [Tue, 2 Apr 2019 17:50:08 +0000 (17:50 +0000)]
Clean up windows build bot.

llvm-svn: 357504

5 years ago[Remarks][NFCI] Remove useless include
Francis Visoiu Mistrih [Tue, 2 Apr 2019 17:48:55 +0000 (17:48 +0000)]
[Remarks][NFCI] Remove useless include

Remarks.h only uses LLVMBool, which comes from llvm-c/Types.h. Nothing
from llvm-c/Core.h is used.

llvm-svn: 357503

5 years agoFix problem with ar_to_bc.sh script introduced by r357450.
Peter Collingbourne [Tue, 2 Apr 2019 17:47:38 +0000 (17:47 +0000)]
Fix problem with ar_to_bc.sh script introduced by r357450.

The new code wasn't matching absolute paths correctly. Should unbreak
sanitizer-x86_64-linux bot.

llvm-svn: 357502

5 years ago[os_log] Mark os_log_helper `nounwind`
Vedant Kumar [Tue, 2 Apr 2019 17:42:38 +0000 (17:42 +0000)]
[os_log] Mark os_log_helper `nounwind`

Allow the optimizer to remove unnecessary EH cleanups surrounding calls
to os_log_helper, to save some code size.

As a follow-up, it might be worthwhile to add a BasicNoexcept exception
spec to os_log_helper, and to then teach CGCall to emit direct calls for
callees which can't throw. This could save some compile-time.

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

llvm-svn: 357501

5 years ago[ArgPromotion] Set debug location at updated callsites
Vedant Kumar [Tue, 2 Apr 2019 17:42:17 +0000 (17:42 +0000)]
[ArgPromotion] Set debug location at updated callsites

Set the correct debug location on instructions which load arguments in
preparation for a call to an arg-promoted function.

This prevents location cascade from misattributing the line/scope of one
of these loads to the location of the instruction preceding the call.

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

llvm-svn: 357500

5 years ago[DebugInfo] Fix pr41180 : Loop Vectorization Debugify Failure
Vedant Kumar [Tue, 2 Apr 2019 17:28:34 +0000 (17:28 +0000)]
[DebugInfo] Fix pr41180 : Loop Vectorization Debugify Failure

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

In the bug test case the debug location was missing for the cmp instruction in
the "middle block" BB. This patch fixes the bug by copying the debug location
from the cmp of the scalar loop's terminator branch, if it exists.

The patch also fixes the debug location on the subsequent branch instruction.
It was previously using the location of the of the original loop's pre-header
block terminator. Both of these instructions will now map to the source line of
the conditional branch in the original loop.

A regression test has been added that covers these issues.

Patch by Orlando Cazalet-Hyams!

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

llvm-svn: 357499

5 years ago[DAGCombiner] reduce code duplication; NFC
Sanjay Patel [Tue, 2 Apr 2019 17:20:54 +0000 (17:20 +0000)]
[DAGCombiner] reduce code duplication; NFC

llvm-svn: 357498

5 years ago[X86] Allow FixupLEAs to form INC/DEC under OptSize not just MinSize
Craig Topper [Tue, 2 Apr 2019 17:13:03 +0000 (17:13 +0000)]
[X86] Allow FixupLEAs to form INC/DEC under OptSize not just MinSize

This matches our usual INC/DEC heuristic used during isel.

llvm-svn: 357497

5 years ago[lldb-server] Use llgs namespace to avoid conflicts with Win32 API
Aaron Smith [Tue, 2 Apr 2019 17:10:12 +0000 (17:10 +0000)]
[lldb-server] Use llgs namespace to avoid conflicts with Win32 API

llvm-svn: 357496

5 years agoFix typo; NFC
Aaron Smith [Tue, 2 Apr 2019 17:02:21 +0000 (17:02 +0000)]
Fix typo; NFC

llvm-svn: 357495

5 years ago[PowerPC] Fix reversed bit issue in DCMX mask for "xvtstdcdp" and "xvtstdcsp" P9...
Stefan Pintilie [Tue, 2 Apr 2019 16:56:01 +0000 (16:56 +0000)]
[PowerPC] Fix reversed bit issue in DCMX mask for "xvtstdcdp" and "xvtstdcsp" P9 implementation

Did experiments on power 9 machine, checked the outputs for NaN & Infinity+
cases with corresponding DCMX bit set. Confirmed the DCMX mask bit for NaN and
infinity+ are reversed.

This patch fixes the issue.

Patch by Victor Huang.

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

llvm-svn: 357494

5 years ago[WideableCond] Fix a nasty bug in detection of "explicit guards"
Philip Reames [Tue, 2 Apr 2019 16:51:43 +0000 (16:51 +0000)]
[WideableCond] Fix a nasty bug in detection of "explicit guards"

The code was failing to actually check for the presence of the call to widenable_condition.  The whole point of specifying the widenable_condition intrinsic was allowing widening transforms.  A normal branch is not widenable.  A normal branch leading to a deopt is not widenable (in general).

I added a test case via LoopPredication, but GuardWidening has an analogous bug.  Those are the only two passes actually using this utility just yet. Noticed while working on LoopPredication for non-widenable branches; POC in D60111.

llvm-svn: 357493

5 years ago[llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flags
Jordan Rupprecht [Tue, 2 Apr 2019 16:49:56 +0000 (16:49 +0000)]
[llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flags

Summary:
Some flags accepted by --set-section-flags and --rename-section can change a SHT_NOBITS section to a SHT_PROGBITS section. Note that none of them can change a SHT_PROGBITS to SHT_NOBITS.

The full list (found via experimentation of individually setting each flag) that does this is: contents, load, noload, code, data, rom, and debug.

This was found by testing llvm-objcopy with the gnu binutils test suite, specifically this test case: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/testsuite/binutils-all/copy-1.d;h=f2b0d9e90df738c2891b4d5c7b62f62894b556ca;hb=HEAD

Reviewers: jhenderson, grimar, jakehehrlich, alexshap, espindola

Reviewed By: jhenderson

Subscribers: emaste, arichardson, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 357492

5 years agoFix buildbot where paths were not matching up.
Greg Clayton [Tue, 2 Apr 2019 16:36:34 +0000 (16:36 +0000)]
Fix buildbot where paths were not matching up.

llvm-svn: 357491

5 years ago[SLP] reorderInputsAccordingToOpcode is const method. NFCI.
Simon Pilgrim [Tue, 2 Apr 2019 16:27:11 +0000 (16:27 +0000)]
[SLP] reorderInputsAccordingToOpcode is const method. NFCI.

llvm-svn: 357490

5 years ago[BPF] Replace fstream and sstream with line_iterator
Fangrui Song [Tue, 2 Apr 2019 16:15:46 +0000 (16:15 +0000)]
[BPF] Replace fstream and sstream with line_iterator

Summary: This makes libLLVMBPFCodeGen.so 1128 bytes smaller for my build.

Reviewers: yonghong-song

Reviewed By: yonghong-song

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357489

5 years ago[OPENMP]Fix mapping of the pointers captured by reference.
Alexey Bataev [Tue, 2 Apr 2019 16:03:40 +0000 (16:03 +0000)]
[OPENMP]Fix mapping of the pointers captured by reference.

If the pointer is captured by reference, it must be mapped as
_PTR_AND_OBJ kind of mapping to correctly translate the pointer address
on the device.

llvm-svn: 357488

5 years ago[llvm-shlib] Fix cross-compilation for LLVM-C
Shoaib Meenai [Tue, 2 Apr 2019 15:58:05 +0000 (15:58 +0000)]
[llvm-shlib] Fix cross-compilation for LLVM-C

When we're cross-compiling, build and use a native llvm-nm instead of
attempting to use the one from the target's build tree.

A nice follow-up would be to add a cache variable to allow specifying a
path to an external native llvm-nm instead of building one ourselves,
similar to LLVM_TABLEGEN and LLVM_CONFIG_PATH.

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

llvm-svn: 357487

5 years ago[cmake] Add function for building native tool
Shoaib Meenai [Tue, 2 Apr 2019 15:58:03 +0000 (15:58 +0000)]
[cmake] Add function for building native tool

Instead of duplicating functionality for building native versions of
tblgen and llvm-config, add a function to set up a native tool build.
This will also be used for llvm-nm in a follow-up.

This should be NFC for tblgen, besides the slightly different COMMENT
for the custom command (it'll display the tablegen target name instead
of always saying TableGen).  For the native llvm-config, it's a behavior
change in that we'll use llvm_ExternalProject_BuildCmd instead of
constructing the build command manually, always build in Release, and
reference the correct binary path for multi-config generators. I believe
all of these changes to be bug fixes.

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

llvm-svn: 357486

5 years ago[SimplifyCFG] Don't split musttail call from ret
Joseph Tremoulet [Tue, 2 Apr 2019 15:48:58 +0000 (15:48 +0000)]
[SimplifyCFG] Don't split musttail call from ret

Summary:
When inserting an `unreachable` after a noreturn call, we must ensure
that it's not a musttail call to avoid breaking the IR invariants for
musttail calls.

Reviewers: fedor.sergeev, majnemer

Reviewed By: majnemer

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357485

5 years ago[SampleProfile] Repeat indirect call promotion only when the target is actually hot.
Taewook Oh [Tue, 2 Apr 2019 15:48:21 +0000 (15:48 +0000)]
[SampleProfile] Repeat indirect call promotion only when the target is actually hot.

Summary: It is possible that multiple indirect call targets have been promoted for a single callsite from the profiled binary. Current implementation repeats promotion for all these targets as far as the callsite itself is hot (the callsite is assumed to be hot if any one of these targets was "hot" during the profiling). However, even when one of the ICPed target is hot other targets may not, and we should not repeat promotion for "cold" targets.

Reviewers: danielcdh, wmi

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357484

5 years ago[PruneEH] Don't split musttail call from ret
Joseph Tremoulet [Tue, 2 Apr 2019 15:47:11 +0000 (15:47 +0000)]
[PruneEH] Don't split musttail call from ret

Summary:
When inserting an `unreachable` after a noreturn call, we must ensure
that it's not a musttail call to avoid breaking the IR invariants for
musttail calls.

Reviewers: fedor.sergeev, majnemer

Reviewed By: majnemer

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357483

5 years agoAllow partial UUID matching in Minidump core file plug-in
Greg Clayton [Tue, 2 Apr 2019 15:40:54 +0000 (15:40 +0000)]
Allow partial UUID matching in Minidump core file plug-in

Breakpad had bugs in earlier versions where it would take a 20 byte ELF build ID and put it into the minidump file as a 16 byte PDB70 UUID with an age of zero. This would make it impossible to do postmortem debugging with one of these older minidump files.

This fix allows partial matching of UUIDs. To do this we first try and match with the full UUID value, and then fall back to removing the original directory path from the module specification and we remove the UUID requirement, and then manually do the matching ourselves. This allows scripts to find symbols files using a symbol server, place them all in a directory, use the "setting set target.exec-search-paths" setting to specify the directory, and then load the core file. The Target::GetSharedModule() can then find the correct file without doing any other matching and load it.

Tests were added to cover a partial UUID match where the breakpad file has a 16 byte UUID and the actual file on disk has a 20 byte UUID, both where the first 16 bytes match, and don't match.

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

llvm-svn: 357482

5 years ago[SystemZ] Improve instruction selection of 64 bit shifts and rotates.
Jonas Paulsson [Tue, 2 Apr 2019 15:36:30 +0000 (15:36 +0000)]
[SystemZ]  Improve instruction selection of 64 bit shifts and rotates.

For shift and rotate instructions that only use the last 6 bits of the shift
amount, a shift amount of (x*64-s) can be substituted with (-s). This saves
one instruction and a register:

  lhi     %r1, 64
  sr      %r1, %r3
  sllg    %r2, %r2, 0(%r1)
  =>
  lcr     %r1, %r3
  sllg    %r2, %r2, 0(%r1)

Review: Ulrich Weigand
llvm-svn: 357481

5 years ago[Driver] Enable -fsanitize-address-globals-dead-stripping by default on PS4.
Pierre Gousseau [Tue, 2 Apr 2019 15:20:26 +0000 (15:20 +0000)]
[Driver] Enable -fsanitize-address-globals-dead-stripping by default on PS4.

Can be safely enabled on PS4.

Reviewed By: probinson

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

llvm-svn: 357480

5 years ago[Transforms] Redundant getValueOperand (NFC)
Brian Gesiak [Tue, 2 Apr 2019 14:57:56 +0000 (14:57 +0000)]
[Transforms] Redundant getValueOperand (NFC)

`StoreInst::getValueOperand` is identical to `getOperand(0)`, so the call to
`getOperand(0)` can be replaced. Further, `SI->getValueOperand` is redundantly
called just a few lines down, despite its return value being stored in variable
`DV`. No functional change.

llvm-svn: 357479

5 years agoSpecial case some duration arithmetic for GCC and PPC because their long double const...
Marshall Clow [Tue, 2 Apr 2019 14:46:36 +0000 (14:46 +0000)]
Special case some duration arithmetic for GCC and PPC because their long double constant folding is broken. Fixes PR#39696.

llvm-svn: 357478

5 years agogn build: Merge r357469
Nico Weber [Tue, 2 Apr 2019 14:44:34 +0000 (14:44 +0000)]
gn build: Merge r357469

llvm-svn: 357477

5 years agogn build: Add build files for non-framework xpc clangd bits
Nico Weber [Tue, 2 Apr 2019 14:39:34 +0000 (14:39 +0000)]
gn build: Add build files for non-framework xpc clangd bits

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

llvm-svn: 357476

5 years ago[llvm-objcopy]Allow llvm-objcopy to be used on an ELF file with no section headers
James Henderson [Tue, 2 Apr 2019 14:11:13 +0000 (14:11 +0000)]
[llvm-objcopy]Allow llvm-objcopy to be used on an ELF file with no section headers

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=41293 and
https://bugs.llvm.org/show_bug.cgi?id=41045. llvm-objcopy assumed that
it could always read a section header string table. This isn't the case
when the sections were previously all stripped, and the e_shstrndx field
was set to 0. This patch fixes this. It also fixes a double space in an
error message relating to this issue, and prevents llvm-objcopy from
adding extra space for non-existent section headers, meaning that
--strip-sections on the output of a previous --strip-sections run
produces identical output, simplifying the test.

Reviewed by: rupprecht, grimar

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

llvm-svn: 357475

5 years agoFix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for the catch.
Marshall Clow [Tue, 2 Apr 2019 14:00:36 +0000 (14:00 +0000)]
Fix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for the catch.

llvm-svn: 357474

5 years ago[mips] Remove the override of the `isMachineVerifierClean()`
Simon Atanasyan [Tue, 2 Apr 2019 13:57:38 +0000 (13:57 +0000)]
[mips] Remove the override of the `isMachineVerifierClean()`

All issues found by machine verifier in MIPS target have been fixed.

llvm-svn: 357473

5 years ago[mips] Use AltOrders to prevent using odd FP-registers
Simon Atanasyan [Tue, 2 Apr 2019 13:57:32 +0000 (13:57 +0000)]
[mips] Use AltOrders to prevent using odd FP-registers

To disable using of odd floating-point registers (O32 ABI and
-mno-odd-spreg command line option) such registers and their
super-registers added to the set of reserved registers. In general, it
works. But there is at least one problem - in case of enabled machine
verifier pass some floating-point tests failed because live ranges of
register units that are reserved is not empty and verification pass
failed with "Live segment doesn't end at a valid instruction" error
message.

There is D35985 patch which tries to solve the problem by explicit
removing of register units. This solution did not get approval.

I would like to use another approach for prevent using odd floating
point registers - define `AltOrders` and `AltOrderSelect` for MIPS
floating point register classes. Such `AltOrders` contains reduced set
of registers. At first glance, such solution does not break any test
cases and allows enabling machine instruction verification for all MIPS
test cases.

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

llvm-svn: 357472

5 years ago[ObjectYAML] Fix build issue
Michael Liao [Tue, 2 Apr 2019 13:01:45 +0000 (13:01 +0000)]
[ObjectYAML] Fix build issue

- ObjectYAML depends on Object as minidump support adds additional
  dependency.

llvm-svn: 357471

5 years ago[RISCV] Support assembling @plt symbol operands
Alex Bradbury [Tue, 2 Apr 2019 12:47:20 +0000 (12:47 +0000)]
[RISCV] Support assembling @plt symbol operands

This patch allows symbols appended with @plt to parse and assemble with the
R_RISCV_CALL_PLT relocation.

Differential Revision: https://reviews.llvm.org/D55335
Patch by Lewis Revill.

llvm-svn: 357470

5 years agoAdd minidump support to obj2yaml
Pavel Labath [Tue, 2 Apr 2019 11:58:37 +0000 (11:58 +0000)]
Add minidump support to obj2yaml

Summary:
This patch adds the code needed to parse a minidump file into the
MinidumpYAML model, and the necessary glue code so that obj2yaml can
recognise the minidump files and process them.

Reviewers: jhenderson, zturner, clayborg

Subscribers: mgorny, lldb-commits, amccarth, markmentovai, aprantl, llvm-commits

Tags: #llvm

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

llvm-svn: 357469

5 years ago[clang-tidy] make getLangOpts return a const ref
Alexander Kornienko [Tue, 2 Apr 2019 11:31:56 +0000 (11:31 +0000)]
[clang-tidy] make getLangOpts return a const ref

llvm-svn: 357468

5 years agoFix Wimplicit-fallthrough warning introduced in rL357466. NFCI.
Simon Pilgrim [Tue, 2 Apr 2019 11:25:38 +0000 (11:25 +0000)]
Fix Wimplicit-fallthrough warning introduced in rL357466. NFCI.

llvm-svn: 357467

5 years ago[PowerPC] Fix issue with inline asm - soft float mode
Strahinja Petrovic [Tue, 2 Apr 2019 11:00:09 +0000 (11:00 +0000)]
[PowerPC] Fix issue with inline asm - soft float mode

This patch prevents floating point register
constraints in soft float mode.

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

llvm-svn: 357466

5 years ago[X86][AVX] Add test case showing failure to fold broadcast load if its also used...
Simon Pilgrim [Tue, 2 Apr 2019 10:31:00 +0000 (10:31 +0000)]
[X86][AVX] Add test case showing failure to fold broadcast load if its also used as a scalar

llvm-svn: 357465

5 years agoMake operator==s consistent between c++ and python APIs
Pavel Labath [Tue, 2 Apr 2019 10:18:46 +0000 (10:18 +0000)]
Make operator==s consistent between c++ and python APIs

Summary:
modify-python-lldb.py had code to insert python equality operators to
some classes. Some of those classes already had c++ equality operators,
and some didn't.

This makes the situation more consistent, by removing all equality
handilng from modify-python-lldb. Instead, I add c++ operators to
classes where they were missing, and expose them in the swig interface
files so that they are available to python too.

The only tricky case was the SBAddress class, which had an operator==
defined as a free function, which is not handled by swig. This function
cannot be removed without breaking ABI, and we cannot add an extra
operator== member, as that would make equality comparisons ambiguous.
For this class, I define a python __eq__ function by hand and have it
delegate to the operator!=, which I have defined as a member function.

This isn't fully NFC, as the semantics of some equality functions in
python changes slightly, but I believe it changes for the better (e.g.,
previously SBBreakpoint.__eq__ would consider two breakpoints with the
same ID as equal, even if they belonged to different targets; now they
are only equal if they belong to the same target).

Reviewers: jingham, clayborg, zturner

Subscribers: jdoerfert, JDevlieghere, lldb-commits

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

llvm-svn: 357463

5 years agoFix tests after r357452
Hans Wennborg [Tue, 2 Apr 2019 10:06:39 +0000 (10:06 +0000)]
Fix tests after r357452

llvm-svn: 357462

5 years agoFix compiler warning, remove extra ";" [NFC]
Mikael Holmen [Tue, 2 Apr 2019 10:01:09 +0000 (10:01 +0000)]
Fix compiler warning, remove extra ";" [NFC]

At least gcc 7.4 complained with
../tools/clang/lib/StaticAnalyzer/Checkers/Taint.cpp:26:53: warning: extra ';' [-Wpedantic]
                                        TaintTagType);
                                                     ^

llvm-svn: 357461

5 years agoEnforce StackID definition in PEI
Sander de Smalen [Tue, 2 Apr 2019 09:46:52 +0000 (09:46 +0000)]
Enforce StackID definition in PEI

There are various places in LLVM where the definition of StackID is not
properly honoured, for example in PEI where objects with a StackID > 0 are
allocated on the default stack (StackID0). This patch enforces that PEI
only considers allocating objects to StackID 0.

Reviewers: arsenm, thegameg, MatzeB

Reviewed By: arsenm

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

llvm-svn: 357460

5 years agoFix flakyness in TestCommandScriptImmediateOutput
Pavel Labath [Tue, 2 Apr 2019 09:45:40 +0000 (09:45 +0000)]
Fix flakyness in TestCommandScriptImmediateOutput

I'm not sure why this surfaced at this particular point, but
TestCommandScriptImmediateOutput (a pexpect test) had a synchronization
issue, where the (lldb) promts it was expecting were getting out of
sync. This happened for two reasons:
- it did not expect the initial (lldb) prompt we print at startup
- launchArgs() returned None, which resulted in an extra "target create
  None" command being issued to lldb (and an extra unhandled prompt
  being printed).

Resolving these two issues seems to fix (or at least, improve) the test.

llvm-svn: 357459

5 years ago[Internalize] Replace uses of std::set with DenseSet
Fangrui Song [Tue, 2 Apr 2019 09:25:31 +0000 (09:25 +0000)]
[Internalize] Replace uses of std::set with DenseSet

This makes it faster and saves 104 bytes for my build.

llvm-svn: 357458

5 years ago[Internalize] Replace fstream with line_iterator for -internalize-public-api-file
Fangrui Song [Tue, 2 Apr 2019 09:11:18 +0000 (09:11 +0000)]
[Internalize] Replace fstream with line_iterator for -internalize-public-api-file

This makes my libLLVMipo.so.9svn smaller by 360 bytes.

llvm-svn: 357457

5 years agoFix llvm_unreachable in TestWriteMemory
Pavel Labath [Tue, 2 Apr 2019 08:56:22 +0000 (08:56 +0000)]
Fix llvm_unreachable in TestWriteMemory

The test was hitting llvm_unreachable in
Platform::GetSoftwareBreakpointTrapOpcode because it could not figure
out the architecture of the process. Since that is not the purpose of
the test, I change the test to use an explicit
CreateTargetWithFileAndTargetTriple command to specify it.

llvm-svn: 357456

5 years agoPDBFPO: Refactor register reference resolution
Pavel Labath [Tue, 2 Apr 2019 08:44:24 +0000 (08:44 +0000)]
PDBFPO: Refactor register reference resolution

Summary:
This refactors moves the register name->number resolution out of the
FPOProgramNodeRegisterRef class. Instead I create a special
FPOProgramNodeSymbol class, which holds unresolved symbols, and move the
resolution into the ResolveRegisterRefs visitor.

The background here is that I'd like to use this code for Breakpad
unwind info, which uses similar syntax to describe unwind info. For
example, a simple breakpad unwind program might look like:
    .cfa: $esp 8 + $ebp: .cfa 8 - ^

To be able to do this, I need to be able to customize register
resolving, as that is presently hardcoded to use codeview register
names, but breakpad supports a lot more architectures with different
register names. Moving the resolution into a separate class will allow
each user to use a different resolution logic.

Reviewers: aleksandr.urakov, zturner, amccarth

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 357455

5 years ago[clangd] Use capacity() instead of size() in RefSlab::bytes()
Ilya Biryukov [Tue, 2 Apr 2019 08:24:37 +0000 (08:24 +0000)]
[clangd] Use capacity() instead of size() in RefSlab::bytes()

Patch by Nathan Ridge.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357454

5 years agoFix a number of bugs in __val_expr's subset operator[].
Eric Fiselier [Tue, 2 Apr 2019 08:05:23 +0000 (08:05 +0000)]
Fix a number of bugs in __val_expr's subset operator[].

The current definitions were entirely broken. They didn't call any
existing constructor and the forgot to friend the expression types they
were trying to construct.

llvm-svn: 357453

5 years agoSimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used...
Hans Wennborg [Tue, 2 Apr 2019 08:01:38 +0000 (08:01 +0000)]
SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)

The code was previously checking that candidates for sinking had exactly
one use or were a store instruction (which can't have uses). This meant
we could sink call instructions only if they had a use.

That limitation seemed a bit arbitrary, so this patch changes it to
"instruction has zero or one use" which seems more natural and removes
the need to special-case stores.

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

llvm-svn: 357452

5 years agoSimplify TestGdbRemoteRegisterState
Pavel Labath [Tue, 2 Apr 2019 07:47:38 +0000 (07:47 +0000)]
Simplify TestGdbRemoteRegisterState

While reviewing D56233 it became clear to me that this test can be
simplified. There's no need for a start-stop cycle in the inferior -- we
can start fiddling with its registers as soon as it is launched.

llvm-svn: 357451

5 years agoar_to_bc.sh: replace readlink -f with custom relative path resolution
Fangrui Song [Tue, 2 Apr 2019 04:58:29 +0000 (04:58 +0000)]
ar_to_bc.sh: replace readlink -f with custom relative path resolution

llvm-ar is a crunchgen-style executable dispatching to dlltool,ranlib,lib,ar based on argv[0].
In our content-addressable storage, readlink -f resolves paths to some
digest and thus lost the original "llvm-ar" filename.

Replace it with a custom path resolution to fix the problem.

llvm-svn: 357450

5 years ago[compiler-rt][test] Make instrprof-set-dir-mode test tolerant of group ID
Matt Davis [Tue, 2 Apr 2019 03:24:12 +0000 (03:24 +0000)]
[compiler-rt][test] Make instrprof-set-dir-mode test tolerant of group ID

Patch from 'troyj':
Hi, I ran into a problem with this test when the source was located in
certain directories. The mkdir(2) man page states that the set-group-ID
bit is inherited from the parent directory, but this test was written in
such a way that it assumes the bit is unset. Whether that assumption is
true depends on where the checkout lives, which leads to some people
being able to reproduce the problem whereas others cannot. I think the
correct fix is to exclude the bit from the check.

Making probinson a reviewer since they reviewed the original test.

Patch landed for troyj, thanks!

Differential Revision: D53832

llvm-svn: 357449

5 years ago[LoopPredication] Simplify widenable condition handling [NFC]
Philip Reames [Tue, 2 Apr 2019 02:42:57 +0000 (02:42 +0000)]
[LoopPredication] Simplify widenable condition handling [NFC]

The code doesn't actually need any of the information about the widenable condition at this level.  The only thing we need is to ensure the WC call is the last thing anded in, and even that is a quirk we should really look to remove.

llvm-svn: 357448

5 years agoAdd an optional list of blocks to avoid when looking for a path in isPotentiallyReach...
Nick Lewycky [Tue, 2 Apr 2019 01:05:48 +0000 (01:05 +0000)]
Add an optional list of blocks to avoid when looking for a path in isPotentiallyReachable.

The leads to some ambiguous overloads, so update three callers.

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

llvm-svn: 357447

5 years ago[X86] Add test cases to fixup-lea.ll for optsize and no size optimization. Add +...
Craig Topper [Tue, 2 Apr 2019 00:54:22 +0000 (00:54 +0000)]
[X86] Add test cases to fixup-lea.ll for optsize and no size optimization. Add +/-slow-incdec command lines

We only form inc/dec in FixupLEAs under minsize today, but all other locations in the compiler for inc/dec with optsize.

llvm-svn: 357446

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 2 Apr 2019 00:54:15 +0000 (00:54 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 357445

5 years ago[X86] Use unsigned type for opcodes throughout X86FixupLEAs.
Craig Topper [Tue, 2 Apr 2019 00:50:58 +0000 (00:50 +0000)]
[X86] Use unsigned type for opcodes throughout X86FixupLEAs.

All of the interfaces related to opcode in MachineInstr and MCInstrInfo refer to opcodes as unsigned.

llvm-svn: 357444

5 years agoInstSimplify: Add missing case from r357386
Matt Arsenault [Tue, 2 Apr 2019 00:46:19 +0000 (00:46 +0000)]
InstSimplify: Add missing case from r357386

llvm-svn: 357443

5 years ago[AMDGPU] Add more test cases of D59608.
Michael Liao [Tue, 2 Apr 2019 00:36:37 +0000 (00:36 +0000)]
[AMDGPU] Add more test cases of D59608.

Summary: - Add more test cases.

Reviewers: arsenm

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

Tags: #llvm

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

llvm-svn: 357442

5 years agoAMDGPU: Fix test filename
Matt Arsenault [Tue, 2 Apr 2019 00:36:04 +0000 (00:36 +0000)]
AMDGPU: Fix test filename

llvm-svn: 357441

5 years ago[ARM] Optimize expressions like "return x != 0;" for Thumb1.
Eli Friedman [Tue, 2 Apr 2019 00:01:23 +0000 (00:01 +0000)]
[ARM] Optimize expressions like "return x != 0;" for Thumb1.

There's an existing optimization for x != C, but somehow it was missing
a special case for 0.

While I'm here, also cleaned up the code/comments a bit: the second
value produced by the MERGE_VALUES was actually dead, since a CMOV only
produces one result.

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

llvm-svn: 357437

5 years ago[ARM] Don't try to create "push {r12, lr}" in Thumb1 at -Oz.
Eli Friedman [Mon, 1 Apr 2019 23:55:57 +0000 (23:55 +0000)]
[ARM] Don't try to create "push {r12, lr}" in Thumb1 at -Oz.

It's a little tricky to make this issue show up because
prologue/epilogue emission normally likes to push at least two
registers... but it doesn't when lr is force-spilled due to function
length.  Not sure if that really makes sense, but I decided not to touch
it for now.

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

llvm-svn: 357436

5 years ago[LoopPred] Rename a variable to simply a future patch [NFC]
Philip Reames [Mon, 1 Apr 2019 22:39:54 +0000 (22:39 +0000)]
[LoopPred] Rename a variable to simply a future patch [NFC]

llvm-svn: 357433

5 years ago[AArch64][GlobalISe] Select STRQui for stores into v264s instead of scalarizing
Jessica Paquette [Mon, 1 Apr 2019 22:19:13 +0000 (22:19 +0000)]
[AArch64][GlobalISe] Select STRQui for stores into v264s instead of scalarizing

This improves selection for vector stores into v2s64s. Before we just
scalarized them, but we can just use a STRQui instead.

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

llvm-svn: 357432

5 years ago[CMake] Only the Python scirpt interpreter should link against Python.
Jonas Devlieghere [Mon, 1 Apr 2019 22:03:04 +0000 (22:03 +0000)]
[CMake] Only the Python scirpt interpreter should link against Python.

This patch removes spurious links against Python.

llvm-svn: 357431

5 years agoFix clangd unittest _WIN32 ifdef
Reid Kleckner [Mon, 1 Apr 2019 21:16:17 +0000 (21:16 +0000)]
Fix clangd unittest _WIN32 ifdef

WIN32 is not defined, _WIN32 is, use that instead.

llvm-svn: 357429

5 years ago[Process] Use early returns in Process::WriteMemory (NFC)
Jonas Devlieghere [Mon, 1 Apr 2019 20:39:03 +0000 (20:39 +0000)]
[Process] Use early returns in Process::WriteMemory (NFC)

I found the code of Process::WriteMemory particularly hard to follow
when reviewing Ismail's change in D60022. This simplifies the code and
hopefully prevents similar oversights in the future.

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

llvm-svn: 357428

5 years ago[NFC] Remove dead parameter "FreeInLoop", fix some typos and trailing whitespace.
Nick Lewycky [Mon, 1 Apr 2019 20:37:56 +0000 (20:37 +0000)]
[NFC] Remove dead parameter "FreeInLoop", fix some typos and trailing whitespace.

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

llvm-svn: 357427