Commit Graph

313546 Commits

Author SHA1 Message Date
David Bolvansky 5ba60b22a4 [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
2019-04-02 20:13:28 +00:00
Aaron Enye Shi 13d8e92940 [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
2019-04-02 20:10:18 +00:00
Julian Lettner 9ca4ff2666 [TSan][libdispatch] We don't require any setup on Darwin
llvm-svn: 357519
2019-04-02 20:04:32 +00:00
Jessica Paquette 22c6215c7e [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
2019-04-02 19:57:26 +00:00
Louis Dionne aac9285377 [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
2019-04-02 19:48:39 +00:00
Erik Pilkington af91315668 [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
2019-04-02 19:48:11 +00:00
Erik Pilkington 3299ead8e9 [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
2019-04-02 19:48:07 +00:00
Alexey Bataev 0fd3c68c1a [OPENMP]Add codegen for private vars with allocate clause.
Added codegen/test for the privatized variables with the allocate
clause.

llvm-svn: 357514
2019-04-02 19:44:46 +00:00
Zachary Turner a31347f17d [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
2019-04-02 19:39:45 +00:00
Louis Dionne 6cd8126360 [libc++] Remove use of auto with actual type
For compatibility with C++03.

llvm-svn: 357512
2019-04-02 19:20:47 +00:00
Louis Dionne f401a749e1 [libc++][NFC] Remove useless public: label at the end of class
llvm-svn: 357511
2019-04-02 19:11:22 +00:00
Julian Lettner 3a23fb1e04 [NFC][libdispatch] Improve a few tests
llvm-svn: 357510
2019-04-02 18:46:59 +00:00
Rainer Orth 010982f750 [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
2019-04-02 18:38:23 +00:00
David Bolvansky 9bba938de4 [InstCombine] Added tests for PR41273
llvm-svn: 357508
2019-04-02 18:33:54 +00:00
Jonas Devlieghere 1c5250abaa [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
2019-04-02 18:23:16 +00:00
Simon Atanasyan 751510cd78 [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
2019-04-02 18:03:31 +00:00
Simon Atanasyan 27c0f204d7 [driver] clang-format. Fix indentation, split long lines. NFC
llvm-svn: 357505
2019-04-02 18:03:15 +00:00
Greg Clayton 380c2420ec Clean up windows build bot.
llvm-svn: 357504
2019-04-02 17:50:08 +00:00
Francis Visoiu Mistrih 1ed4bbb9ab [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
2019-04-02 17:48:55 +00:00
Peter Collingbourne a720381bb5 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
2019-04-02 17:47:38 +00:00
Vedant Kumar 37b0f9ad95 [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
2019-04-02 17:42:38 +00:00
Vedant Kumar 9da8a68d6b [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
2019-04-02 17:42:17 +00:00
Vedant Kumar c6bceec01a [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
2019-04-02 17:28:34 +00:00
Sanjay Patel 7cb7daabbb [DAGCombiner] reduce code duplication; NFC
llvm-svn: 357498
2019-04-02 17:20:54 +00:00
Craig Topper 0d3a533270 [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
2019-04-02 17:13:03 +00:00
Aaron Smith 41a7950cfb [lldb-server] Use llgs namespace to avoid conflicts with Win32 API
llvm-svn: 357496
2019-04-02 17:10:12 +00:00
Aaron Smith b622809b2d Fix typo; NFC
llvm-svn: 357495
2019-04-02 17:02:21 +00:00
Stefan Pintilie fa6cd5ceb9 [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
2019-04-02 16:56:01 +00:00
Philip Reames d3d5d76a7b [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
2019-04-02 16:51:43 +00:00
Jordan Rupprecht 017deaf1ae [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
2019-04-02 16:49:56 +00:00
Greg Clayton 5050586860 Fix buildbot where paths were not matching up.
llvm-svn: 357491
2019-04-02 16:36:34 +00:00
Simon Pilgrim a3b71018d9 [SLP] reorderInputsAccordingToOpcode is const method. NFCI.
llvm-svn: 357490
2019-04-02 16:27:11 +00:00
Fangrui Song 83db88717b [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
2019-04-02 16:15:46 +00:00
Alexey Bataev c2b831fe1b [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
2019-04-02 16:03:40 +00:00
Shoaib Meenai 7c16c5b6ae [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
2019-04-02 15:58:05 +00:00
Shoaib Meenai f92acf1299 [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
2019-04-02 15:58:03 +00:00
Joseph Tremoulet fb4d9f7287 [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
2019-04-02 15:48:58 +00:00
Taewook Oh 6a27c48be2 [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
2019-04-02 15:48:21 +00:00
Joseph Tremoulet b69afa8e9b [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
2019-04-02 15:47:11 +00:00
Greg Clayton 838bba9c34 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
2019-04-02 15:40:54 +00:00
Jonas Paulsson f76fe45426 [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
2019-04-02 15:36:30 +00:00
Pierre Gousseau 0b9527119f [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
2019-04-02 15:20:26 +00:00
Brian Gesiak 1c44ed8b76 [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
2019-04-02 14:57:56 +00:00
Marshall Clow 3bf63cf3b3 Special case some duration arithmetic for GCC and PPC because their long double constant folding is broken. Fixes PR#39696.
llvm-svn: 357478
2019-04-02 14:46:36 +00:00
Nico Weber 709ee69d0a gn build: Merge r357469
llvm-svn: 357477
2019-04-02 14:44:34 +00:00
Nico Weber 7d3e97d6fa gn build: Add build files for non-framework xpc clangd bits
Differential Revision: https://reviews.llvm.org/D60124

llvm-svn: 357476
2019-04-02 14:39:34 +00:00
James Henderson 38cb238f75 [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
2019-04-02 14:11:13 +00:00
Marshall Clow 68ad5c34e0 Fix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for the catch.
llvm-svn: 357474
2019-04-02 14:00:36 +00:00
Simon Atanasyan 4cefa15a14 [mips] Remove the override of the `isMachineVerifierClean()`
All issues found by machine verifier in MIPS target have been fixed.

llvm-svn: 357473
2019-04-02 13:57:38 +00:00
Simon Atanasyan 2634a141fd [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
2019-04-02 13:57:32 +00:00