platform/upstream/llvm.git
5 years ago[obj2yaml] - Fix BB after r373315.
George Rimar [Tue, 1 Oct 2019 10:02:47 +0000 (10:02 +0000)]
[obj2yaml] - Fix BB after r373315.

The success return value for data extractor's cursor
should also be checked.

llvm-svn: 373319

5 years ago[clangd] Handle template arguments in findExplicitReferences
Ilya Biryukov [Tue, 1 Oct 2019 10:02:23 +0000 (10:02 +0000)]
[clangd] Handle template arguments in findExplicitReferences

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373318

5 years agoReland "[utils] Implement the llvm-locstats tool"
Djordje Todorovic [Tue, 1 Oct 2019 09:59:15 +0000 (09:59 +0000)]
Reland "[utils] Implement the llvm-locstats tool"

The tool reports verbose output for the DWARF debug location coverage.
The llvm-locstats for each variable or formal parameter DIE computes what
percentage from the code section bytes, where it is in scope, it has
location description. The line 0 shows the number (and the percentage) of
DIEs with no location information, but the line 100 shows the number (and
the percentage) of DIEs where there is location information in all code
section bytes (where the variable or parameter is in the scope). The line
50..59 shows the number (and the percentage) of DIEs where the location
information is in between 50 and 59 percentage of its scope covered.

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

llvm-svn: 373317

5 years ago[yaml2obj] - Allow specifying custom Link values for SHT_HASH section.
George Rimar [Tue, 1 Oct 2019 09:54:40 +0000 (09:54 +0000)]
[yaml2obj] - Allow specifying custom Link values for SHT_HASH section.

This allows setting any sh_link values for SHT_HASH sections.

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

llvm-svn: 373316

5 years ago[yaml2obj/obj2yaml] - Add support for SHT_HASH sections.
George Rimar [Tue, 1 Oct 2019 09:45:59 +0000 (09:45 +0000)]
[yaml2obj/obj2yaml] - Add support for SHT_HASH sections.

SHT_HASH specification is:
http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash

In short the format is the following: it has 2 uint32 fields
in its header: nbucket and nchain followed by (nbucket + nchain)
uint32 values.

This patch allows dumping and parsing such sections.

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

llvm-svn: 373315

5 years agoFixup r373278: Move test to X86 directory
Diana Picus [Tue, 1 Oct 2019 09:27:20 +0000 (09:27 +0000)]
Fixup r373278: Move test to X86 directory

...since it's using an x86 triple.

llvm-svn: 373314

5 years ago[llvm-exegesis][NFC] Refactor X86 tests fixtures into a base class.
Clement Courbet [Tue, 1 Oct 2019 09:20:36 +0000 (09:20 +0000)]
[llvm-exegesis][NFC] Refactor X86 tests fixtures into a base class.

Reviewers: gchatelet, a.sidorin

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 373313

5 years ago[clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource
Raphael Isemann [Tue, 1 Oct 2019 09:02:05 +0000 (09:02 +0000)]
[clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSource

NFC preparation work for upcoming ExternalASTMerger patches.

llvm-svn: 373312

5 years agoRevert "[OCaml] Handle nullptr in Llvm.global_initializer"
Dmitri Gribenko [Tue, 1 Oct 2019 08:29:07 +0000 (08:29 +0000)]
Revert "[OCaml] Handle nullptr in Llvm.global_initializer"

This reverts commit r373299. It broke tests:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18485

llvm-svn: 373311

5 years agoRevert "GlobalISel: Handle llvm.read_register"
Dmitri Gribenko [Tue, 1 Oct 2019 08:24:01 +0000 (08:24 +0000)]
Revert "GlobalISel: Handle llvm.read_register"

This reverts commit r373294. It broke Clang's
CodeGen/arm64-microsoft-status-reg.cpp:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18483

llvm-svn: 373310

5 years ago[NFC][HardwareLoops] Update some iterators
Sam Parker [Tue, 1 Oct 2019 07:53:28 +0000 (07:53 +0000)]
[NFC][HardwareLoops] Update some iterators

llvm-svn: 373309

5 years agoDecrease the verbosity of the -ftime-trace option
Sylvestre Ledru [Tue, 1 Oct 2019 07:52:42 +0000 (07:52 +0000)]
Decrease the verbosity of the -ftime-trace option
And move the relevant information in the doc.

Summary:
Currently, building a large software like Firefox shows
'Use chrome://tracing or Speedscope App (https://www.speedscope.app) for flamegraph visualization'
for each file.

Reviewers: anton-afanasyev

Reviewed By: anton-afanasyev

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373308

5 years ago[clangd] Handle OverloadExpr in targetDecl
Ilya Biryukov [Tue, 1 Oct 2019 07:27:55 +0000 (07:27 +0000)]
[clangd] Handle OverloadExpr in targetDecl

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

llvm-svn: 373305

5 years ago[clang-tidy] Fix module registry name and description for Darwin clang-tidy module.
Dmitri Gribenko [Tue, 1 Oct 2019 07:17:26 +0000 (07:17 +0000)]
[clang-tidy] Fix module registry name and description for Darwin clang-tidy module.

Summary: When creating the module, must have copy-pasted from the misc module, and forgotten to update the name/description of the module in the registry.

Reviewers: stephanemoore, benhamilton, gribozavr

Reviewed By: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra, #llvm

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

llvm-svn: 373304

5 years ago[X86] Consider isCodeGenOnly in the EVEX2VEX pass to make VMAXPD/PS map to the non...
Craig Topper [Tue, 1 Oct 2019 07:10:09 +0000 (07:10 +0000)]
[X86] Consider isCodeGenOnly in the EVEX2VEX pass to make VMAXPD/PS map to the non-commutable VEX instruction. Use EVEX2VEX override to fix the scalar instructions.

Previously the match was ambiguous and VMAXPS/PD and VMAXCPS/PD
were mapped to the same VEX instruction. But we should keep
the commutableness when change the opcode.

llvm-svn: 373303

5 years ago[WebAssembly] Make sure EH pads are preferred in sorting
Heejin Ahn [Tue, 1 Oct 2019 06:53:28 +0000 (06:53 +0000)]
[WebAssembly] Make sure EH pads are preferred in sorting

Summary:
In CFGSort, we try to make EH pads have higher priorities as soon as
they are ready to be sorted, to prevent creation of unwind destination
mismatches in CFGStackify. We did that by making priority queues'
comparison function  prefer EH pads, but it was possible for an EH pad
to be popped from `Preferred` queue and then not sorted immediately and
enter `Ready` queue instead in a certain condition. This patch makes
sure that special condition does not consider EH pads as its candidates.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 373302

5 years ago[WebAssembly] Unstackify regs after fixing unwinding mismatches
Heejin Ahn [Tue, 1 Oct 2019 06:21:53 +0000 (06:21 +0000)]
[WebAssembly] Unstackify regs after fixing unwinding mismatches

Summary:
Fixing unwind mismatches for exception handling can result in splicing
existing BBs and moving some of instructions to new BBs. In this case
some of stackified def registers in the original BB can be used in the
split BB. For example, we have this BB and suppose %r0 is a stackified
register.
```
bb.1:
  %r0 = call @foo
  ... use %r0 ...
```

After fixing unwind mismatches in CFGStackify, `bb.1` can be split and
some instructions can be moved to a newly created BB:
```
bb.1:
  %r0 = call @foo

bb.split (new):
  ... use %r0 ...
```

In this case we should make %r0 un-stackified, because its use is now in
another BB.

When spliting a BB, this CL unstackifies all def registers that have
uses in the new split BB.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 373301

5 years ago[Windows] Added support of watchpoints to `NativeProcessWindows`
Aleksandr Urakov [Tue, 1 Oct 2019 05:52:16 +0000 (05:52 +0000)]
[Windows] Added support of watchpoints to `NativeProcessWindows`

Summary: This patch adds support of watchpoints to the new `NativeProcessWindows` plugin. The same tests as in D67168 pass with these changes when the old plugin is turned off, so they will cover this functionality when the old plugin is gone.

Reviewers: asmith, amccarth, stella.stamenova, labath

Reviewed By: labath

Subscribers: labath, jfb, JDevlieghere, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 373300

5 years ago[OCaml] Handle nullptr in Llvm.global_initializer
Aditya Kumar [Tue, 1 Oct 2019 03:45:09 +0000 (03:45 +0000)]
[OCaml] Handle nullptr in Llvm.global_initializer

LLVMGetInitializer returns nullptr in case there is no
initializer. There is not much that can be done with nullptr in OCaml,
not even test if it is null. Also, there does not seem to be a C or
OCaml API to test if there is an initializer. So this diff changes
Llvm.global_initializer to return an option.

Differential Revision: https://reviews.llvm.org/D65195
Reviewed by: whitequark
Authored by: kren1

llvm-svn: 373299

5 years agoAMDGPU/GlobalISel: Select s1 src G_SITOFP/G_UITOFP
Matt Arsenault [Tue, 1 Oct 2019 02:23:20 +0000 (02:23 +0000)]
AMDGPU/GlobalISel: Select s1 src G_SITOFP/G_UITOFP

llvm-svn: 373298

5 years agoRemove a undefined constructor introduced by r373244.
Yuanfang Chen [Tue, 1 Oct 2019 02:08:14 +0000 (02:08 +0000)]
Remove a undefined constructor introduced by r373244.

llvm-svn: 373297

5 years agoAMDGPU/GlobalISel: Add support for init.exec intrinsics
Matt Arsenault [Tue, 1 Oct 2019 02:07:25 +0000 (02:07 +0000)]
AMDGPU/GlobalISel: Add support for init.exec intrinsics

TThe existing wave32 behavior seems broken and incomplete, but this
reproduces it.

llvm-svn: 373296

5 years agoAMDGPU/GlobalISel: Allow scc/vcc alternative mappings for s1 constants
Matt Arsenault [Tue, 1 Oct 2019 02:07:19 +0000 (02:07 +0000)]
AMDGPU/GlobalISel: Allow scc/vcc alternative mappings for s1 constants

llvm-svn: 373295

5 years agoGlobalISel: Handle llvm.read_register
Matt Arsenault [Tue, 1 Oct 2019 02:07:16 +0000 (02:07 +0000)]
GlobalISel: Handle llvm.read_register

SelectionDAG has a bunch of machinery to defer this to selection time
for some reason. Just directly emit a copy during IRTranslator. The
x86 usage does somewhat questionably check hasFP, which could depend
on the whole function being at minimum translated.

This does lose the convergent bit if the callsite had it, which may be
a problem. We also lose that in general for intrinsics, which may also
be a problem.

llvm-svn: 373294

5 years agoAMDGPU/GlobalISel: Avoid creating shift of 0 in arg lowering
Matt Arsenault [Tue, 1 Oct 2019 01:44:46 +0000 (01:44 +0000)]
AMDGPU/GlobalISel: Avoid creating shift of 0 in arg lowering

This is sort of papering over the fact that we don't run a combiner
anywhere, but avoiding creating 2 instructions in the first place is
easy.

llvm-svn: 373293

5 years agoTLI: Remove DAG argument from getRegisterByName
Matt Arsenault [Tue, 1 Oct 2019 01:44:39 +0000 (01:44 +0000)]
TLI: Remove DAG argument from getRegisterByName

Replace with the MachineFunction. X86 is the only user, and only uses
it for the function. This removes one obstacle from using this in
GlobalISel. The other is the more tolerable EVT argument.

The X86 use of the function seems questionable to me. It checks hasFP,
before frame lowering.

llvm-svn: 373292

5 years ago[llvm-readobj/llvm-readelf] Delete --arm-attributes (alias for --arch-specific)
Fangrui Song [Tue, 1 Oct 2019 01:31:15 +0000 (01:31 +0000)]
[llvm-readobj/llvm-readelf] Delete --arm-attributes (alias for --arch-specific)

D68110 added --arch-specific (supported by GNU readelf) and made
--arm-attributes an alias for it. The tests were later migrated to use
--arch-specific.

Note, llvm-readelf --arch-specific currently just uses llvm-readobj
style output for ARM attributes. The readelf-style output is not
implemented.

Reviewed By: compnerd, kongyi, rupprecht

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

llvm-svn: 373291

5 years ago[X86] Add test case to show missed opportunity to shrink a constant index to a gather...
Craig Topper [Tue, 1 Oct 2019 01:27:52 +0000 (01:27 +0000)]
[X86] Add test case to show missed opportunity to shrink a constant index to a gather in order to avoid splitting.

Also add a test case for an index that could be shrunk, but
would create a narrow type. We can go ahead and do it we just
need to be before type legalization.

Similar test cases for scatter as well.

llvm-svn: 373290

5 years agoDon't elide the use of the thread wrapper for a thread_local constinit
Richard Smith [Tue, 1 Oct 2019 01:23:23 +0000 (01:23 +0000)]
Don't elide the use of the thread wrapper for a thread_local constinit
variable with non-trivial destruction.

We still need to invoke the thread wrapper to trigger registration of
the destructor call on thread shutdown.

llvm-svn: 373289

5 years agoAMDGPU/GlobalISel: Select G_UADDO/G_USUBO
Matt Arsenault [Tue, 1 Oct 2019 01:23:13 +0000 (01:23 +0000)]
AMDGPU/GlobalISel: Select G_UADDO/G_USUBO

llvm-svn: 373288

5 years agoGlobalISel: Implement widenScalar for G_SITOFP/G_UITOFP sources
Matt Arsenault [Tue, 1 Oct 2019 01:06:48 +0000 (01:06 +0000)]
GlobalISel: Implement widenScalar for G_SITOFP/G_UITOFP sources

Legalize 16-bit G_SITOFP/G_UITOFP for AMDGPU.

llvm-svn: 373287

5 years agoAMDGPU/GlobalISel: Legalize G_GLOBAL_VALUE
Matt Arsenault [Tue, 1 Oct 2019 01:06:43 +0000 (01:06 +0000)]
AMDGPU/GlobalISel: Legalize G_GLOBAL_VALUE

Handle other cases besides LDS. Mostly a straight port of the existing
handling, without the intermediate custom nodes.

llvm-svn: 373286

5 years agoFile::Clear() -> File::TakeStreamAndClear()
Lawrence D'Anna [Tue, 1 Oct 2019 01:05:02 +0000 (01:05 +0000)]
File::Clear() -> File::TakeStreamAndClear()

Summary:
File::Clear() is an ugly function.  It's only used in one place,
which is the swig typemaps for FILE*.   This patch refactors and
renames that function to make it clear what it's really for and
why nobody else should use it.

Both File::TakeStreamAndClear() and the FILE* typemaps will be
removed in later patches after a suitable replacement is in place.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373285

5 years agocompiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM
Vitaly Buka [Tue, 1 Oct 2019 00:58:29 +0000 (00:58 +0000)]
compiler-rt: use __GLIBC_PREREQ for SANITIZER_INTERCEPT_GETRANDOM

Summary: Fixes https://github.com/google/oss-fuzz/issues/2836

Reviewers: eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373284

5 years agocompiler-rt: move all __GLIBC_PREREQ into own header file
Vitaly Buka [Tue, 1 Oct 2019 00:58:28 +0000 (00:58 +0000)]
compiler-rt: move all __GLIBC_PREREQ into own header file

Reviewers: eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373283

5 years agoRename tsan_interceptors.cpp into tsan_interceptors_posix.cpp
Vitaly Buka [Tue, 1 Oct 2019 00:58:26 +0000 (00:58 +0000)]
Rename tsan_interceptors.cpp into tsan_interceptors_posix.cpp

Summary:
It's needed to use __GLIBC_PREREQ from <features.h>

tsan didn't let us to include <features.h> by using --sysroot=. to disable system includes on
anything that is not named as "tsan*posix*", "tsan*mac*", "tsan*linux*".
See compiler-rt/lib/tsan/CMakeLists.txt

Reviewers: eugenis, dvyukov, kcc

Reviewed By: kcc

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373282

5 years ago[c++20] Add a C++20 version of the existing turing machine test.
Richard Smith [Tue, 1 Oct 2019 00:47:41 +0000 (00:47 +0000)]
[c++20] Add a C++20 version of the existing turing machine test.

Unlike the C++11 version, this one uese mutable state and dynamic
allocation instead of a carefully balanced and ever-accumulating pile of
temporaries.

llvm-svn: 373281

5 years agoAllow the internal-state-thread free access to the TargetAPI mutex.
Jim Ingham [Tue, 1 Oct 2019 00:47:25 +0000 (00:47 +0000)]
Allow the internal-state-thread free access to the TargetAPI mutex.

It is always doing work on behalf of another thread that presumably
has the mutex, so if it is calling SB API's it should have free access
to the mutex.  This is the same decision as we made earlier with the
process RunLock.

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

llvm-svn: 373280

5 years agoDuring constant evaluation, handle CXXBindTemporaryExprs for
Richard Smith [Tue, 1 Oct 2019 00:41:16 +0000 (00:41 +0000)]
During constant evaluation, handle CXXBindTemporaryExprs for
array-of-class types, not just for class types.

llvm-svn: 373279

5 years agoDebugInfo: Add parsing support for debug_loc base address specifiers
David Blaikie [Tue, 1 Oct 2019 00:29:13 +0000 (00:29 +0000)]
DebugInfo: Add parsing support for debug_loc base address specifiers

llvm-svn: 373278

5 years ago[Docs] Document lldb-instr
Jonas Devlieghere [Tue, 1 Oct 2019 00:12:47 +0000 (00:12 +0000)]
[Docs] Document lldb-instr

This adds some information on how to instrument the API classes.

llvm-svn: 373277

5 years ago[c++20] Fix crash when constant-evaluating an assignment with a
Richard Smith [Tue, 1 Oct 2019 00:07:14 +0000 (00:07 +0000)]
[c++20] Fix crash when constant-evaluating an assignment with a
reference member access on its left-hand side.

llvm-svn: 373276

5 years agoFix Driver/modules.cpp test to work when build directory name contains '.s'
Tom Stellard [Mon, 30 Sep 2019 23:42:17 +0000 (23:42 +0000)]
Fix Driver/modules.cpp test to work when build directory name contains '.s'

Reviewers: dyung, rsmith, hansw

Subscribers: mati865, mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 373275

5 years ago[SimplifyLibCalls] Define the value of the Euler number
Evandro Menezes [Mon, 30 Sep 2019 23:21:02 +0000 (23:21 +0000)]
[SimplifyLibCalls] Define the value of the Euler number

This patch fixes the build break on Windows hosts.

There must be a better way of accessing the equivalent POSIX math constant
`M_E`.

llvm-svn: 373274

5 years agoDebugInfo: Simplify section label caching/usage
David Blaikie [Mon, 30 Sep 2019 23:19:10 +0000 (23:19 +0000)]
DebugInfo: Simplify section label caching/usage

llvm-svn: 373273

5 years agoFix crash on value-dependent delete-expressions.
Richard Smith [Mon, 30 Sep 2019 22:55:27 +0000 (22:55 +0000)]
Fix crash on value-dependent delete-expressions.

We used to miscompute the 'value-dependent' bit, and would crash if we
tried to evaluate a delete expression that should be value-dependent.

llvm-svn: 373272

5 years agoAdd partial bswap test to the X86 backend. NFC
Amaury Sechet [Mon, 30 Sep 2019 22:52:28 +0000 (22:52 +0000)]
Add partial bswap test to the X86 backend. NFC

llvm-svn: 373271

5 years ago[DAGCombiner] Clang format MatchRotate. NFC
Amaury Sechet [Mon, 30 Sep 2019 21:41:52 +0000 (21:41 +0000)]
[DAGCombiner] Clang format MatchRotate. NFC

llvm-svn: 373269

5 years agoMake function static that didn't need linkage.
Erich Keane [Mon, 30 Sep 2019 21:24:04 +0000 (21:24 +0000)]
Make function static that didn't need linkage.

In r373247 I added a helper function, but neglected to make it static.

llvm-svn: 373268

5 years ago[StackFrameList][DFS] Turn a few raw pointers into references, NFC
Vedant Kumar [Mon, 30 Sep 2019 21:20:14 +0000 (21:20 +0000)]
[StackFrameList][DFS] Turn a few raw pointers into references, NFC

llvm-svn: 373267

5 years agoRemove else-after-return
David Blaikie [Mon, 30 Sep 2019 21:02:06 +0000 (21:02 +0000)]
Remove else-after-return

llvm-svn: 373266

5 years ago[bugpoint] Update runPasses to take ArrayRef instead of a pointer (NFC)
Florian Hahn [Mon, 30 Sep 2019 21:00:50 +0000 (21:00 +0000)]
[bugpoint] Update runPasses to take ArrayRef instead of a pointer (NFC)

This makes it slightly easier to pass extra arguments to runPasses
and simplifies the code slightly.

Reviewers: efriedma, bogner, dblaikie, diegotf, hiraditya

Reviewed By: dblaikie, hiraditya

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

llvm-svn: 373265

5 years ago[globalisel][knownbits] Allow targets to call GISelKnownBits::computeKnownBitsImpl()
Daniel Sanders [Mon, 30 Sep 2019 20:55:53 +0000 (20:55 +0000)]
[globalisel][knownbits] Allow targets to call GISelKnownBits::computeKnownBitsImpl()

Summary:
It seems we missed that the target hook can't query the known-bits for the
inputs to a target instruction. Fix that oversight

Reviewers: aditya_nandakumar

Subscribers: rovka, hiraditya, volkan, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 373264

5 years agoRefactor default constructor SFINAE in pair and tuple.
Eric Fiselier [Mon, 30 Sep 2019 20:55:30 +0000 (20:55 +0000)]
Refactor default constructor SFINAE in pair and tuple.

Refactor the  recent implicit default constructor changes to match the
existing SFINAE style.

llvm-svn: 373263

5 years ago[ConstantFolding] Fold constant calls to log2()
Evandro Menezes [Mon, 30 Sep 2019 20:53:23 +0000 (20:53 +0000)]
[ConstantFolding] Fold constant calls to log2()

Somehow, folding calls to `log2()` with a constant was missing.

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

llvm-svn: 373262

5 years ago[InstCombine] Expand the simplification of log()
Evandro Menezes [Mon, 30 Sep 2019 20:52:21 +0000 (20:52 +0000)]
[InstCombine] Expand the simplification of log()

Expand the simplification of special cases of `log()` to include `log2()`
and `log10()` as well as intrinsics and more types.

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

llvm-svn: 373261

5 years ago[DAGCombiner] Update MatchRotate so that it returns an SDValue. NFC
Amaury Sechet [Mon, 30 Sep 2019 20:47:23 +0000 (20:47 +0000)]
[DAGCombiner] Update MatchRotate so that it returns an SDValue. NFC

llvm-svn: 373260

5 years agoFix failure caused by r373247
Erich Keane [Mon, 30 Sep 2019 20:45:12 +0000 (20:45 +0000)]
Fix failure caused by r373247

I incorrectly thought that the 'isLambda' check never fired, so when
splitting up a helper function, I lost the 'nullptr' return value.
ClangD Hover functionality apparently uses this, so the Unittest caught
that.

This patch correctly propogates the nullptr from the helper function.

llvm-svn: 373259

5 years ago[NFC] Fix tests, second try
David Bolvansky [Mon, 30 Sep 2019 20:41:56 +0000 (20:41 +0000)]
[NFC] Fix tests, second try

llvm-svn: 373258

5 years ago[OPENMP50]Mark declare variant attribute as inheritable.
Alexey Bataev [Mon, 30 Sep 2019 20:39:29 +0000 (20:39 +0000)]
[OPENMP50]Mark declare variant attribute as inheritable.

Attribute must be inherited by the redeclarations.

llvm-svn: 373257

5 years ago[NFCI] Updated broken test
David Bolvansky [Mon, 30 Sep 2019 20:23:22 +0000 (20:23 +0000)]
[NFCI] Updated broken test

llvm-svn: 373256

5 years agoELF: Don't merge SHF_LINK_ORDER sections for different output sections in relocatable...
Peter Collingbourne [Mon, 30 Sep 2019 20:23:00 +0000 (20:23 +0000)]
ELF: Don't merge SHF_LINK_ORDER sections for different output sections in relocatable links.

Merging SHF_LINK_ORDER sections can affect semantics if the sh_link
fields point to different sections.

Specifically, for SHF_LINK_ORDER sections, the sh_link field acts as a reverse
dependency from the linked section, causing the SHF_LINK_ORDER section to
be included if the linked section is included. Merging sections with different
sh_link fields will cause the entire contents of the SHF_LINK_ORDER section
to be associated with a single (arbitrarily chosen) output section, whereas the
correct semantics are for the individual pieces of the SHF_LINK_ORDER section
to be associated with their linked output sections. As a result we can end up
incorrectly dropping SHF_LINK_ORDER section contents or including the wrong
section contents, depending on which linked sections were chosen.

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

llvm-svn: 373255

5 years ago[LegacyPassManager] Deprecate the BasicBlockPass/Manager.
Alina Sbirlea [Mon, 30 Sep 2019 20:17:23 +0000 (20:17 +0000)]
[LegacyPassManager] Deprecate the BasicBlockPass/Manager.

Summary:
The BasicBlockManager is potentially broken and should not be used.
Replace all uses of the BasicBlockPass with a FunctionBlockPass+loop on
blocks.

Reviewers: chandlerc

Subscribers: jholewinski, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 373254

5 years agobuild: serialise `LLVM_ENABLE_UNWIND_TABLES` into LLVMConfig
Saleem Abdulrasool [Mon, 30 Sep 2019 20:03:59 +0000 (20:03 +0000)]
build: serialise `LLVM_ENABLE_UNWIND_TABLES` into LLVMConfig

Serialize the value of the configuration option into the configuration so that
builds which integrate LLVM can identify the value of the flag that was used to
build the libraries.  This is intended to be used by Swift to control tests
which rely on the unwind information.

llvm-svn: 373253

5 years ago[Diagnostics] Warn if enumeration type mismatch in conditional expression
David Bolvansky [Mon, 30 Sep 2019 19:55:50 +0000 (19:55 +0000)]
[Diagnostics] Warn if enumeration type mismatch in conditional expression

Summary:
- Useful warning
- GCC compatibility (GCC warns in C++ mode)

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373252

5 years ago[FunctionAttrs] Added noalias for memccpy/mempcpy arguments
David Bolvansky [Mon, 30 Sep 2019 19:43:48 +0000 (19:43 +0000)]
[FunctionAttrs] Added noalias for memccpy/mempcpy arguments

llvm-svn: 373251

5 years agoTry to update Windows unit test for API change.
Adrian Prantl [Mon, 30 Sep 2019 19:38:52 +0000 (19:38 +0000)]
Try to update Windows unit test for API change.

llvm-svn: 373250

5 years ago[InstCombine][NFC] visitShl(): call SimplifyQuery::getWithInstruction() once
Roman Lebedev [Mon, 30 Sep 2019 19:16:00 +0000 (19:16 +0000)]
[InstCombine][NFC] visitShl(): call SimplifyQuery::getWithInstruction() once

llvm-svn: 373249

5 years ago[NFC][InstCombine] Redundant-left-shift-input-masking: add some more undef tests
Roman Lebedev [Mon, 30 Sep 2019 19:15:51 +0000 (19:15 +0000)]
[NFC][InstCombine] Redundant-left-shift-input-masking: add some more undef tests

llvm-svn: 373248

5 years agoTeach CallGraph to look into Generic Lambdas.
Erich Keane [Mon, 30 Sep 2019 19:12:29 +0000 (19:12 +0000)]
Teach CallGraph to look into Generic Lambdas.

CallGraph visited LambdaExpr by getting the Call Operator from
CXXRecordDecl (LambdaExpr::getCallOperator calls
CXXRecordDecl::getLambdaCallOperator), which replaced generic lambda
call operators with the non-instantiated FunctionDecl.  The result was
that the CallGraph would only pick up non-dependent calls.

This patch does a few things:
1- Extend CXXRecordDecl to have a getDependentLambdaCallOperator, which
will get the FunctionTemplateDecl, rather than immediately getting the
TemplateDecl.
2- Define getLambdaCallOperator and getDependentLambdaCallOperator in
terms of a common function.
3- Extend LambdaExpr with a getDependentCallOperator, which just calls
the above function.
4- Changes CallGraph to handle Generic LambdaExprs.

llvm-svn: 373247

5 years ago[X86] Mask off upper bits of splat element in LowerBUILD_VECTORvXi1 when forming...
Craig Topper [Mon, 30 Sep 2019 18:43:44 +0000 (18:43 +0000)]
[X86] Mask off upper bits of splat element in LowerBUILD_VECTORvXi1 when forming a SELECT.

The i1 scalar would have been type legalized to i8, but that
doesn't guarantee anything about the upper bits. If we're going
to use it as condition we need to make sure the upper bits are 0.

I've special cased ISD::SETCC conditions since that should
guarantee zero upper bits. We could go further and use
computeKnownBits, but we have no tests that would need that.

Fixes PR43507.

llvm-svn: 373246

5 years ago[X86] Address post-commit review from code I accidentally commited in r373136.
Craig Topper [Mon, 30 Sep 2019 18:43:27 +0000 (18:43 +0000)]
[X86] Address post-commit review from code I accidentally commited in r373136.

See https://reviews.llvm.org/D68167

llvm-svn: 373245

5 years agoFix build warning for r373240.
Yuanfang Chen [Mon, 30 Sep 2019 18:32:38 +0000 (18:32 +0000)]
Fix build warning for r373240.

llvm-svn: 373244

5 years ago[OPENMP50]Do not emit warning for the function with the currently
Alexey Bataev [Mon, 30 Sep 2019 18:24:35 +0000 (18:24 +0000)]
[OPENMP50]Do not emit warning for the function with the currently
defined body.

If the function is currently defined, we should not emit a warning that
it might be emitted already because it was not really emitted.

llvm-svn: 373243

5 years agoRevert "[MC] Emit unused undefined symbol even if its binding is not set"
Nico Weber [Mon, 30 Sep 2019 18:13:48 +0000 (18:13 +0000)]
Revert "[MC] Emit unused undefined symbol even if its binding is not set"

This reverts r373168. It caused PR43511.

llvm-svn: 373242

5 years ago[PGO] Don't group COMDAT variables for compiler generated profile variables in ELF
Rong Xu [Mon, 30 Sep 2019 18:11:22 +0000 (18:11 +0000)]
[PGO] Don't group COMDAT variables for compiler generated profile variables in ELF

With this patch, compiler generated profile variables will have its own COMDAT
name for ELF format, which syncs the behavior with COFF. Tested with clang
PGO bootstrap. This shows a modest reduction in object sizes in ELF format.

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

llvm-svn: 373241

5 years ago[NewPM] Port MachineModuleInfo to the new pass manager.
Yuanfang Chen [Mon, 30 Sep 2019 17:54:50 +0000 (17:54 +0000)]
[NewPM] Port MachineModuleInfo to the new pass manager.

Existing clients are converted to use MachineModuleInfoWrapperPass. The
new interface is for defining a new pass manager API in CodeGen.

Reviewers: fedor.sergeev, philip.pfaffe, chandlerc, arsenm

Reviewed By: arsenm, fedor.sergeev

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

llvm-svn: 373240

5 years ago[msan] Intercept __getrlimit.
Evgeniy Stepanov [Mon, 30 Sep 2019 17:49:48 +0000 (17:49 +0000)]
[msan] Intercept __getrlimit.

Summary:
This interceptor is useful on its own, but the main purpose of this
change is to intercept libpthread initialization on linux/glibc in
order to run __msan_init before any .preinit_array constructors.

We used to trigger on pthread_initialize_minimal -> getrlimit(), but
that call has changed to __getrlimit at some point.

Reviewers: vitalybuka, pcc

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 373239

5 years agoFix buildbot failure from r373217 (don't match metadata id exactly)
Teresa Johnson [Mon, 30 Sep 2019 17:26:48 +0000 (17:26 +0000)]
Fix buildbot failure from r373217 (don't match metadata id exactly)

Fix this failure by ignoring the id of the metadata being checked:
    http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/3046/consoleFull#-21332887158254eaf0-7326-4999-85b0-388101f2d404

llvm-svn: 373237

5 years ago[MCA] Use references to LSUnitBase in class Scheduler and add helper methods to acqui...
Andrea Di Biagio [Mon, 30 Sep 2019 17:24:25 +0000 (17:24 +0000)]
[MCA] Use references to LSUnitBase in class Scheduler and add helper methods to acquire/release LS queue entries. NFCI

llvm-svn: 373236

5 years ago[LegacyPassManager] Attempt to fix BasicBlockManager
Alina Sbirlea [Mon, 30 Sep 2019 17:23:49 +0000 (17:23 +0000)]
[LegacyPassManager] Attempt to fix BasicBlockManager

Temporarily fix BaiscBlockManager based on the code in the other
managers.
Replacement of all uses of the BasicBlockPass to follow.

Resolves PR42264.

llvm-svn: 373235

5 years ago[X86] Add ANY_EXTEND to switch in ReplaceNodeResults, but just fall back to default...
Craig Topper [Mon, 30 Sep 2019 17:14:22 +0000 (17:14 +0000)]
[X86] Add ANY_EXTEND to switch in ReplaceNodeResults, but just fall back to default handling.

ANY_EXTEND of v8i8 is marked Custom on AVX512 for handling extends
from v8i8. But the type legalization infrastructure will call
ReplaceNodeResults for v8i8 results. We should just defer it the
default handling instead of asserting in the default of the switch.

Fixes PR43509.

llvm-svn: 373234

5 years ago[test] Make TestBasicEntryValuesX86_64 run on Linux as well as Darwin
Vedant Kumar [Mon, 30 Sep 2019 17:11:46 +0000 (17:11 +0000)]
[test] Make TestBasicEntryValuesX86_64 run on Linux as well as Darwin

I think a reasonable plan here is to add support for OSes following the
SysV ABI one by one, watching the bots as we go.

llvm-svn: 373233

5 years ago[AArch64][SVE] Implement punpk[hi|lo] intrinsics
Kerry McLaughlin [Mon, 30 Sep 2019 17:10:21 +0000 (17:10 +0000)]
[AArch64][SVE] Implement punpk[hi|lo] intrinsics

Summary:
Adds the following two intrinsics:
  - int_aarch64_sve_punpkhi
  - int_aarch64_sve_punpklo

This patch also contains a fix which allows LLVMHalfElementsVectorType
to forward reference overloadable arguments.

Reviewers: sdesmalen, rovka, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, greened, cfe-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 373232

5 years ago[EarlyCSE] Pass preserves AA.
Alina Sbirlea [Mon, 30 Sep 2019 17:08:40 +0000 (17:08 +0000)]
[EarlyCSE] Pass preserves AA.

llvm-svn: 373231

5 years ago[InstCombine] fold negate disguised as select+mul
Sanjay Patel [Mon, 30 Sep 2019 17:02:26 +0000 (17:02 +0000)]
[InstCombine] fold negate disguised as select+mul

  Name: negate if true
  %sel = select i1 %cond, i32 -1, i32 1
  %r = mul i32 %sel, %x
  =>
  %m = sub i32 0, %x
  %r = select i1 %cond, i32 %m, i32 %x

  Name: negate if false
  %sel = select i1 %cond, i32 1, i32 -1
  %r = mul i32 %sel, %x
  =>
  %m = sub i32 0, %x
  %r = select i1 %cond, i32 %x, i32 %m

https://rise4fun.com/Alive/Nlh

llvm-svn: 373230

5 years ago[lldb][NFC] Updating test to reflect made by D67966
Shafik Yaghmour [Mon, 30 Sep 2019 16:57:35 +0000 (16:57 +0000)]
[lldb][NFC] Updating test to reflect made by D67966

Summary:
D67966 changes the output when dumping DWARF expressions and this updates basic_entry_values_x86_64 test to reflect this change.

llvm-svn: 373229

5 years agoFix doc for t inline asm constraints for ARM/Thumb
Pablo Barrio [Mon, 30 Sep 2019 16:55:10 +0000 (16:55 +0000)]
Fix doc for t inline asm constraints for ARM/Thumb

Summary: The constraint goes up to regs d15 and q7, not d16 and q8.

Subscribers: kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 373228

5 years ago[AArch64][GlobalISel] Support lowering variadic musttail calls
Jessica Paquette [Mon, 30 Sep 2019 16:49:13 +0000 (16:49 +0000)]
[AArch64][GlobalISel] Support lowering variadic musttail calls

This adds support for lowering variadic musttail calls. To do this, we have
to...

- Detect a musttail call in a variadic function before attempting to lower the
  call's formal arguments. This is done in the IRTranslator.
- Compute forwarded registers in `lowerFormalArguments`, and add copies for
  those registers.
- Restore the forwarded registers in `lowerTailCall`.

Because there doesn't seem to be any nice way to wrap these up into the outgoing
argument handler, the restore code in `lowerTailCall` is done separately.

Also, irritatingly, you have to make sure that the registers don't overlap with
any passed parameters. Otherwise, the scheduler doesn't know what to do with the
extra copies and asserts.

Add call-translator-variadic-musttail.ll to test this. This is pretty much the
same as the X86 musttail-varargs.ll test. We didn't have as nice of a test to
base this off of, but the idea is the same.

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

llvm-svn: 373226

5 years ago[mips] Fix code indentation. NFC
Simon Atanasyan [Mon, 30 Sep 2019 16:47:21 +0000 (16:47 +0000)]
[mips] Fix code indentation. NFC

llvm-svn: 373225

5 years agoRemove unused "append" parameter from FindTypes API
Adrian Prantl [Mon, 30 Sep 2019 16:42:28 +0000 (16:42 +0000)]
Remove unused "append" parameter from FindTypes API

I noticed that SymbolFileDWARFDebugMap::FindTypes was implementing it
incorrectly (passing append=false in a for-loop to recursive calls to
FindTypes would yield only the very last set of results), but instead
of fixing it, removing it seemed like an even better option.

rdar://problem/54412692

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

llvm-svn: 373224

5 years agoAdd tests for rotate with demanded bits. NFC
Amaury Sechet [Mon, 30 Sep 2019 16:26:09 +0000 (16:26 +0000)]
Add tests for rotate with demanded bits. NFC

llvm-svn: 373223

5 years ago[InstCombine] add tests for negate disguised as mul; NFC
Sanjay Patel [Mon, 30 Sep 2019 15:43:27 +0000 (15:43 +0000)]
[InstCombine] add tests for negate disguised as mul; NFC

llvm-svn: 373222

5 years ago [AMDGPU] SIFoldOperands should not fold register acrocc the EXEC definition
Alexander Timofeev [Mon, 30 Sep 2019 15:31:17 +0000 (15:31 +0000)]
   [AMDGPU] SIFoldOperands should not fold register acrocc the EXEC definition

      Reviewers: rampitec

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

llvm-svn: 373221

5 years ago[SSP] [3/3] cmpxchg and addrspacecast instructions can now
Paul Robinson [Mon, 30 Sep 2019 15:11:23 +0000 (15:11 +0000)]
[SSP] [3/3] cmpxchg and addrspacecast instructions can now
trigger stack protectors.  Fixes PR42238.

Add test coverage for llvm.memset, as proxy for all llvm.mem*
intrinsics. There are two issues here: (1) they could be lowered to a
libc call, which could be intercepted, and do Bad Stuff; (2) with a
non-constant size, they could overwrite the current stack frame.

The test was mostly written by Matt Arsenault in r363169, which was
later reverted; I tweaked what he had and added the llvm.memset part.

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

llvm-svn: 373220

5 years ago[SSP] [2/3] Refactor an if/dyn_cast chain to switch on opcode. NFC
Paul Robinson [Mon, 30 Sep 2019 15:08:38 +0000 (15:08 +0000)]
[SSP] [2/3] Refactor an if/dyn_cast chain to switch on opcode. NFC

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

llvm-svn: 373219

5 years ago[Clang] Use -main-file-name for source filename if not set
Teresa Johnson [Mon, 30 Sep 2019 15:05:35 +0000 (15:05 +0000)]
[Clang] Use -main-file-name for source filename if not set

-main-file-name is currently used to set the source name used in debug
information.

If the source filename is "-" and -main-file-name is set, then use the
filename also for source_filename and ModuleID of the output.

The argument is generally used outside the internal clang calls when
running clang in a wrapper like icecc which gives the source via stdin
but still wants to get a object file with the original source filename
both in debug info and IR code.

Patch by: the_jk (Joel Klinghed)

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

llvm-svn: 373217

5 years ago[SSP] [1/3] Revert "StackProtector: Use PointerMayBeCaptured"
Paul Robinson [Mon, 30 Sep 2019 15:01:35 +0000 (15:01 +0000)]
[SSP] [1/3] Revert "StackProtector: Use PointerMayBeCaptured"
"Captured" and "relevant to Stack Protector" are not the same thing.

This reverts commit f29366b1f594f48465c5a2754bcffac6d70fd0b1.
aka r363169.

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

llvm-svn: 373216

5 years agoFix breakage of sphinx builders. Sorry for leaving this broken over the
Kevin P. Neal [Mon, 30 Sep 2019 14:51:59 +0000 (14:51 +0000)]
Fix breakage of sphinx builders. Sorry for leaving this broken over the
weekend!

llvm-svn: 373215

5 years agoSupport MemoryLocation::UnknownSize in TargetLowering::IntrinsicInfo
Tamas Berghammer [Mon, 30 Sep 2019 14:44:24 +0000 (14:44 +0000)]
Support MemoryLocation::UnknownSize in TargetLowering::IntrinsicInfo

Summary:
Previously IntrinsicInfo::size was an unsigned what can't represent the
64 bit value used by MemoryLocation::UnknownSize.

Reviewers: jmolloy

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373214