lldb.git
3 years agoFix/unify the spelling of Objective-C.
Adrian Prantl [Wed, 13 Jun 2018 16:21:24 +0000 (16:21 +0000)]
Fix/unify the spelling of Objective-C.

llvm-svn: 334614

3 years ago[PowerPC] The __float128 type should only be available on Power9
Stefan Pintilie [Wed, 13 Jun 2018 16:05:05 +0000 (16:05 +0000)]
[PowerPC] The __float128 type should only be available on Power9

Diasble the use of the type __float128 for PPC machines older
than Power9.

The use of -mfloat128 for PPC machine older than Power9 will result
in an error.

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

llvm-svn: 334613

3 years ago[libclang] Make c-index-test.c ISO C90 compliant.
Matt Morehouse [Wed, 13 Jun 2018 16:00:39 +0000 (16:00 +0000)]
[libclang] Make c-index-test.c ISO C90 compliant.

Fixes a build bot breakage caused by r334593.

llvm-svn: 334612

3 years agoAdd modules support for lldb headers in include/
Raphael Isemann [Wed, 13 Jun 2018 15:50:45 +0000 (15:50 +0000)]
Add modules support for lldb headers in include/

Summary:
This patch adds a modulemap which allows compiling the lldb headers into C++ modules
(for example in builds with LLVM_ENABLE_MODULES=On).

Even though most of the affected code has been cleaned up to work with the more strict
C++ module semantics, there are still some workarounds left in the current modulemap
(the most obvious one is the big `lldb` wrapper module).

It also moves the Obj-C++ files in lldb to their own subdirectories. This was necessary
because we need to filter out the modules flags for this code.

Note: With the latest clang and libstdc++ it seems necessary to have a STL C++ module
to get a working LLVM_ENABLE_MODULES build for lldb. Otherwise clang will falsely
detect ODR violations in the textually included STL code inside the lldb modules.

Reviewers: aprantl, bruno

Reviewed By: aprantl, bruno

Subscribers: mgorny, yamaguchi, v.g.vassilev, lldb-commits

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

llvm-svn: 334611

3 years ago[llvm-mca] Flush the output stream before we start the analysis of a new code region...
Andrea Di Biagio [Wed, 13 Jun 2018 15:43:56 +0000 (15:43 +0000)]
[llvm-mca] Flush the output stream before we start the analysis of a new code region. NFC

llvm-svn: 334610

3 years ago[AMDGPU][MC][GFX8][GFX9] Allow LDS direct reads for BUFFER_LOAD_DWORDX2/X3/X4
Dmitry Preobrazhensky [Wed, 13 Jun 2018 15:32:46 +0000 (15:32 +0000)]
[AMDGPU][MC][GFX8][GFX9] Allow LDS direct reads for BUFFER_LOAD_DWORDX2/X3/X4

See bug 37653: https://bugs.llvm.org/show_bug.cgi?id=37653

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 334609

3 years ago[DAGCombiner] remove hasOneUse() check from fadd constants transform
Sanjay Patel [Wed, 13 Jun 2018 15:22:48 +0000 (15:22 +0000)]
[DAGCombiner] remove hasOneUse() check from fadd constants transform

We're constant folding here, so we shouldn't check uses. This matches
the IR optimizer behavior.

The x86 test shows the expected win. The AArch64 test shows something
else. This only seems to happen if the "generic" AArch64 CPU model is
used by MachineCombiner, so I'll file a bug report to follow-up.

llvm-svn: 334608

3 years agoAMDGPU: Move isSDNodeSourceOfDivergence() implementation to SITargetLowering
Tom Stellard [Wed, 13 Jun 2018 15:06:37 +0000 (15:06 +0000)]
AMDGPU: Move isSDNodeSourceOfDivergence() implementation to SITargetLowering

Summary:
The code that handles ISD:Register and ISD::CopyFromReg assumes
the target is amdgcn, so this is broken on r600.  We don't
need this analysis on r600 anyway so we can safely move
it to SITargetLowering.

Reviewers: alex-t, arsenm, nhaehnle

Reviewed By: arsenm

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

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

llvm-svn: 334607

3 years agoReverting r334604 due to failing tests.
Aaron Ballman [Wed, 13 Jun 2018 15:02:34 +0000 (15:02 +0000)]
Reverting r334604 due to failing tests.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/31500

llvm-svn: 334606

3 years ago[x86] add test for fadd with more than one use; NFC
Sanjay Patel [Wed, 13 Jun 2018 15:01:07 +0000 (15:01 +0000)]
[x86] add test for fadd with more than one use; NFC

The equivalent AArch64 test added at rL334556 isn't showing
the expected output from the DAGCombiner code change that
would fix this example. That's a machine combiner bug from
what I see.

llvm-svn: 334605

3 years agoAdd a new class to analyze whether an expression is mutated within a statement.
Aaron Ballman [Wed, 13 Jun 2018 14:41:42 +0000 (14:41 +0000)]
Add a new class to analyze whether an expression is mutated within a statement.

ExprMutationAnalyzer is a generally useful helper that can be used in different clang-tidy checks for checking whether a given expression is (potentially) mutated within a statement (typically the enclosing compound statement.) This is a more general and more powerful/accurate version of isOnlyUsedAsConst, which is used in ForRangeCopyCheck, UnnecessaryCopyInitialization.

Patch by Shuai Wang

llvm-svn: 334604

3 years ago[FPEnv] Expand constrained FP operations
Cameron McInally [Wed, 13 Jun 2018 14:32:12 +0000 (14:32 +0000)]
[FPEnv] Expand constrained FP operations

Add a helper function to expand constrained FP operations as needed.
Note that the Strict POWI operation is not handled in this patch since
the format is slightly different from the others.

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

llvm-svn: 334603

3 years agoDo not enforce absolute path argv0 in windows
Hans Wennborg [Wed, 13 Jun 2018 14:29:26 +0000 (14:29 +0000)]
Do not enforce absolute path argv0 in windows

Even if we support no-canonical-prefix on
clang-cl(https://reviews.llvm.org/D47480), argv0 becomes absolute path
in clang-cl and that embeds absolute path in /showIncludes.

This patch removes such full path normalization from InitLLVM on
windows, and that removes absolute path from clang-cl output
(obj/stdout/stderr) when debug flag is disabled.

Patch by Takuto Ikuta!

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

llvm-svn: 334602

3 years ago[llvm-exegesis] Fix buildbot - power was using native target for X86.
Guillaume Chatelet [Wed, 13 Jun 2018 14:07:36 +0000 (14:07 +0000)]
[llvm-exegesis] Fix buildbot - power was using native target for X86.

Reviewers: courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 334601

3 years agoAdd -fforce-emit-vtables
Piotr Padlewski [Wed, 13 Jun 2018 13:55:42 +0000 (13:55 +0000)]
Add -fforce-emit-vtables

Summary:
 In many cases we can't devirtualize
 because definition of vtable is not present. Most of the
 time it is caused by inline virtual function not beeing
 emitted. Forcing emitting of vtable adds a reference of these
 inline virtual functions.
 Note that GCC was always doing it.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
llvm-svn: 334600

3 years ago[llvm-exegesis] Fix failing assert when creating Snippet for LAHF.
Guillaume Chatelet [Wed, 13 Jun 2018 13:53:56 +0000 (13:53 +0000)]
[llvm-exegesis] Fix failing assert when creating Snippet for LAHF.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 334599

3 years agoRevert "Improve handling of COPY instructions with identical value numbers"
Krzysztof Parzyszek [Wed, 13 Jun 2018 13:49:06 +0000 (13:49 +0000)]
Revert "Improve handling of COPY instructions with identical value numbers"

This reverts r334594, it breaks buildbots and fails with expensive checks.

llvm-svn: 334598

3 years agoCorrect behavior of __builtin_*_overflow and constexpr.
Erich Keane [Wed, 13 Jun 2018 13:25:11 +0000 (13:25 +0000)]
Correct behavior of __builtin_*_overflow and constexpr.

Enable these builtins to be called across a lambda
boundary with captureless const/constexpr, as brought up by
Eli here: https://reviews.llvm.org/D48040

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

llvm-svn: 334597

3 years ago[llvm-exegesis] Cleaner design without mutable data.
Guillaume Chatelet [Wed, 13 Jun 2018 13:24:41 +0000 (13:24 +0000)]
[llvm-exegesis] Cleaner design without mutable data.

Summary: Previous design was relying on the 'mutate' keyword and was quite confusing. This version separate mutable from immutable data and makes it clearer what changes and what doesn't.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 334596

3 years ago[mips][microMIPS] Extending size reduction pass with LWP and SWP
Zoran Jovanovic [Wed, 13 Jun 2018 12:51:37 +0000 (12:51 +0000)]
[mips][microMIPS] Extending size reduction pass with LWP and SWP
Author: milena.vujosevic.janicic
Reviewers: sdardis
The patch extends size reduction pass for MicroMIPS.
It introduces reduction of two instructions into one instruction:
Two SW instructions are transformed into one SWP instrucition.
Two LW instructions are transformed into one LWP instrucition.
Differential Revision: https://reviews.llvm.org/D39115

llvm-svn: 334595

3 years agoImprove handling of COPY instructions with identical value numbers
Krzysztof Parzyszek [Wed, 13 Jun 2018 12:47:17 +0000 (12:47 +0000)]
Improve handling of COPY instructions with identical value numbers

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

llvm-svn: 334594

3 years ago[libclang] Optionally add code completion results for arrow instead of dot
Ivan Donchevskii [Wed, 13 Jun 2018 12:37:08 +0000 (12:37 +0000)]
[libclang] Optionally add code completion results for arrow instead of dot

Follow up for D41537 - libclang part.

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

llvm-svn: 334593

3 years ago[x86] eliminate even more sign-bit tests with vector select
Sanjay Patel [Wed, 13 Jun 2018 12:28:32 +0000 (12:28 +0000)]
[x86] eliminate even more sign-bit tests with vector select

This shortcoming was noted in D47330, and the test diffs show we already
had other examples where we failed to fold to a SHRUNKBLEND:

/// Dynamic (non-constant condition) vector blend where only the sign bits
/// of the condition elements are used. This is used to enforce that the
/// condition mask is not valid for generic VSELECT optimizations.

This patch implements an idea from D48043 and would obsolete that patch
because it catches more cases (notable the AVX1 case that was missed there).
All we're doing is allowing the existing transform to fire more often by
removing the post-legalize constraint. All of the relevant feature checks
and other predicates are left as-is.

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

llvm-svn: 334592

3 years ago[RISCV] Add codegen support for atomic load/stores with RV32A
Alex Bradbury [Wed, 13 Jun 2018 12:04:51 +0000 (12:04 +0000)]
[RISCV] Add codegen support for atomic load/stores with RV32A

Fences are inserted according to table A.6 in the current draft of version 2.3
of the RISC-V Instruction Set Manual, which incorporates the memory model
changes and definitions contributed by the RISC-V Memory Consistency Model
task group.

Instruction selection failures will now occur for 8/16/32-bit atomicrmw and
cmpxchg operations when targeting RV32IA until lowering for these operations
is added in a follow-on patch.

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

llvm-svn: 334591

3 years ago[RISCV] Codegen support for atomic operations on RV32I
Alex Bradbury [Wed, 13 Jun 2018 11:58:46 +0000 (11:58 +0000)]
[RISCV] Codegen support for atomic operations on RV32I

This patch adds lowering for atomic fences and relies on AtomicExpandPass to
lower atomic loads/stores, atomic rmw, and cmpxchg to __atomic_* libcalls.

test/CodeGen/RISCV/atomic-* are modelled on the exhaustive
test/CodeGen/PPC/atomics-regression.ll, and will prove more useful once RV32A
codegen support is introduced.

Fence mappings are taken from table A.6 in the current draft of version 2.3 of
the RISC-V Instruction Set Manual, which incorporates the memory model changes
and definitions contributed by the RISC-V Memory Consistency Model task group.

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

llvm-svn: 334590

3 years agoRevert "[clangd] Log completion context type. NFC"
Sam McCall [Wed, 13 Jun 2018 11:31:20 +0000 (11:31 +0000)]
Revert "[clangd] Log completion context type. NFC"

This reverts commit r334572, which has a potential use-after-free.

llvm-svn: 334589

3 years ago[SLPVectorizer] getSameOpcode - remove useless cast [NFC]
Simon Pilgrim [Wed, 13 Jun 2018 10:49:24 +0000 (10:49 +0000)]
[SLPVectorizer] getSameOpcode - remove useless cast [NFC]

There's no need to cast the base Value to an Instruction

llvm-svn: 334588

3 years ago[SLPVectorizer] getSameOpcode - remove unusued alternate code [NFC]
Simon Pilgrim [Wed, 13 Jun 2018 10:14:27 +0000 (10:14 +0000)]
[SLPVectorizer] getSameOpcode - remove unusued alternate code [NFC]

We early-out for the case where we don't use alternate opcodes, so no need to check for it later.

llvm-svn: 334587

3 years ago[TableGen] Emit a fatal error on inconsistencies in resource units vs cycles.
Clement Courbet [Wed, 13 Jun 2018 09:41:49 +0000 (09:41 +0000)]
[TableGen] Emit a fatal error on inconsistencies in resource units vs cycles.

Summary:
For targets I'm not familiar with, I've automatically made the "default to 1 for each resource" behaviour explicit in the td files.
For more obvious cases, I've ventured a fix.

Some notes:
 - Exynos is especially fishy.
 - AArch64SchedThunderX2T99.td had some truncated entries. If I understand correctly, the person who wrote that interpreted the ResourceCycle as a range. I made the decision to use the upper/lower bound for consistency with the 'Latency' value. I'm sure there is a better choice.
 - The change to X86ScheduleBtVer2.td is an NFC, it just makes values more explicit.

Also see PR37310.

Reviewers: RKSimon, craig.topper, javed.absar

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 334586

3 years ago[clangd] Move caching of compile args out of ClangdServer.
Ilya Biryukov [Wed, 13 Jun 2018 09:20:41 +0000 (09:20 +0000)]
[clangd] Move caching of compile args out of ClangdServer.

Summary:
Caching is now handled by ClangdLSPServer and hidden behind the
GlobalCompilationDatabase interface. This simplifies ClangdServer.
This change also removes the SkipCache flag from addDocument,
which is now obsolete.

No behavioral changes are intended, the clangd binary still caches the
compile commands on the first read.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 334585

3 years agoGettingStarted.rst: Fix 'If you you' typo (PR37787)
Hans Wennborg [Wed, 13 Jun 2018 09:11:10 +0000 (09:11 +0000)]
GettingStarted.rst: Fix 'If you you' typo (PR37787)

llvm-svn: 334584

3 years ago[PowerPC] fix trivial typos in comment, NFC
Hiroshi Inoue [Wed, 13 Jun 2018 08:54:13 +0000 (08:54 +0000)]
[PowerPC] fix trivial typos in comment, NFC

llvm-svn: 334583

3 years agoFix -DLLVM_ENABLE_THREADS=OFF build after r334537
Hans Wennborg [Wed, 13 Jun 2018 08:43:03 +0000 (08:43 +0000)]
Fix -DLLVM_ENABLE_THREADS=OFF build after r334537

llvm-svn: 334582

3 years ago[WebAssembly] Fix broken build due to missing attributes.inc
Aaron Smith [Wed, 13 Jun 2018 08:38:23 +0000 (08:38 +0000)]
[WebAssembly] Fix broken build due to missing attributes.inc

WebAssembly depends on attributes.h which includes attributes.inc.
Unless cmake explicitly specifies this dependency, the .inc file
is sometimes generated after the build tries to use it.

Patch by Stella Stamenova

llvm-svn: 334581

3 years agoFix "Optional" is ambiguous error on some bots
Pavel Labath [Wed, 13 Jun 2018 08:29:19 +0000 (08:29 +0000)]
Fix "Optional" is ambiguous error on some bots

llvm-svn: 334580

3 years ago[PowerPC] avoid verification failure due to PowerPC VSX Swap Removal pass
Hiroshi Inoue [Wed, 13 Jun 2018 08:25:14 +0000 (08:25 +0000)]
[PowerPC] avoid verification failure due to PowerPC VSX Swap Removal pass

This patch fixes a failure in lnt tests with -verify-machineinstrs option.
When VSX Swap Removal pass swaps two register operands, it did not maintain kill flags associated with operands. This patch swaps flags as well as register number to avoid inconsistent kill flags information.

llvm-svn: 334579

3 years ago[DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entries
Pavel Labath [Wed, 13 Jun 2018 08:14:27 +0000 (08:14 +0000)]
[DWARF/AccelTable] Remove getDIESectionOffset for DWARF v5 entries

Summary:
This method was not correct for entries in DWO files as it assumed it
could just add up the CU and DIE offsets to get the absolute DIE offset.
This is not correct for the DWO files, as here the CU offset will
reference the skeleton unit, whereas the DIE offset will be the offset
in the full unit in the DWO file.

Unfortunately, this means that we are not able to determine the absolute
DIE offset using the information in the .debug_names section alone,
which means we have to offload some of this work to the users of this
class.

To demonstrate how this can be done, I've added/fixed the ability to
lookup entries using accelerator tables in DWO files in llvm-dwarfdump.
To make this happen, I've needed to make two extra changes in other
classes:
- made the DWARFContext method to lookup a CU based on the section
  offset public. I've needed this functionality to lookup a CU, and this
  seems like a useful thing in general.
- made DWARFUnit::getDWOId call extractDIEsIfNeeded. Before this, the
  DWOId was filled in only if the root DIE happened to be parsed
  before we called the accessor. Since the lazy parsing is supposed to
  happen under the hood, calling extractDIEsIfNeeded seems appropriate.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: mgrang, llvm-commits

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

llvm-svn: 334578

3 years ago[X86] Remove masking from avx512vbmi2 concat and shift by immediate builtins. Use...
Craig Topper [Wed, 13 Jun 2018 07:19:28 +0000 (07:19 +0000)]
[X86] Remove masking from avx512vbmi2 concat and shift by immediate builtins. Use select builtins instead.

llvm-svn: 334577

3 years ago[X86] Remove masking from avx512vbmi2 concat and shift by immediate intrinsics. Use...
Craig Topper [Wed, 13 Jun 2018 07:19:21 +0000 (07:19 +0000)]
[X86] Remove masking from avx512vbmi2 concat and shift by immediate intrinsics. Use select in IR instead.

llvm-svn: 334576

3 years ago[XRay] Set an explicit dependency on libc++ when needed
Petr Hosek [Wed, 13 Jun 2018 07:08:28 +0000 (07:08 +0000)]
[XRay] Set an explicit dependency on libc++ when needed

When XRay is being built as part of the just built compiler together
with libc++ as part of the runtimes build, we need an explicit
dependency from XRay to libc++ to make sure that the library is
available by the time we start building XRay.

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

llvm-svn: 334575

3 years agocrash-report-modules.m: Shorten path length to make Windows bot happy
Hans Wennborg [Wed, 13 Jun 2018 06:48:40 +0000 (06:48 +0000)]
crash-report-modules.m: Shorten path length to make Windows bot happy

llvm-svn: 334574

3 years agoRemove extraneous semicolon.
Bill Wendling [Wed, 13 Jun 2018 06:33:59 +0000 (06:33 +0000)]
Remove extraneous semicolon.

llvm-svn: 334573

3 years ago[clangd] Log completion context type. NFC
Sam McCall [Wed, 13 Jun 2018 06:25:36 +0000 (06:25 +0000)]
[clangd] Log completion context type. NFC

llvm-svn: 334572

3 years agoSet the code model when specified.
Bill Wendling [Wed, 13 Jun 2018 05:53:59 +0000 (05:53 +0000)]
Set the code model when specified.

llvm-svn: 334571

3 years agoReland "Passthrough additional flags to custom libcxx CMake build"
Petr Hosek [Wed, 13 Jun 2018 05:32:22 +0000 (05:32 +0000)]
Reland "Passthrough additional flags to custom libcxx CMake build"

This is needed when we're cross-compiling compiler-rt.

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

llvm-svn: 334570

3 years ago[Sema] When the address of a member function is used as a template
Akira Hatanaka [Wed, 13 Jun 2018 05:26:23 +0000 (05:26 +0000)]
[Sema] When the address of a member function is used as a template
argument, use the context in which it is used for checking its
accessibility.

This fixes PR32898.

rdar://problem/33737747

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

llvm-svn: 334569

3 years agoutils/release: Add merge-git.sh
Tom Stellard [Wed, 13 Jun 2018 05:14:10 +0000 (05:14 +0000)]
utils/release: Add merge-git.sh

Summary:
This script allows you to use git to backport a commit to a stable
branch while generating the exact same commit message (ignoring
whitespace) that you would get from using the merge.sh script with svn.

Reviewers: hansw

Subscribers: llvm-commits

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

llvm-svn: 334568

3 years ago[SimplifyIndVars] Ignore dead users
Max Kazantsev [Wed, 13 Jun 2018 02:25:32 +0000 (02:25 +0000)]
[SimplifyIndVars] Ignore dead users

IndVarSimplify sometimes makes transforms basing on users that are trivially dead. In particular,
if DCE wasn't run before it, there may be a dead `sext/zext` in loop that will trigger widening
transforms, however it makes no sense to do it.

This patch teaches IndVarsSimplify ignore the mist trivial cases of that.

Differential Revision: https://reviews.llvm.org/D47974
Reviewed By: sanjoy

llvm-svn: 334567

3 years agoRevert "Fix how LLVMOPTIONALCOMPONENTS is passed to llvm-build"
Ahmed Bougacha [Wed, 13 Jun 2018 02:16:01 +0000 (02:16 +0000)]
Revert "Fix how LLVMOPTIONALCOMPONENTS is passed to llvm-build"

This reverts commit r334543.

My understanding is, that commit is intended to make the llvm-build
invocation have a correct "--enable-optional-components" value, but:
- it already has a value: it's quoted in the command line a few lines
  below, and, if I hack llvm-build to print sys.argv, it does look correct:
    -- llvm-build output: ['.../utils/llvm-build/llvm-build',
      '--native-target', 'X86', '--enable-targets', 'X86;ARM;AArch64',
      '--enable-optional-components', '',
      '--write-library-table',
      '.../build/tools/llvm-config/LibraryDependencies.inc',
      '--write-cmake-fragment', '.../build/LLVMBuild.cmake']
- the " " string seems to evaluate to TRUE in CMake (*sigh*), so this
  basically force-enables LLVM_USE_INTEL_JITEVENTS, regardless of the
  value of the option.
  On Darwin, JITEvents is not supported, so this bypasses that OS check
  but is guaranteed to fail later.

llvm-svn: 334566

3 years agoFix crash emitting transparent list initializer for a large aggregate.
Richard Smith [Wed, 13 Jun 2018 02:06:28 +0000 (02:06 +0000)]
Fix crash emitting transparent list initializer for a large aggregate.

llvm-svn: 334565

3 years agoUse shorter names for #lo, #hi, #ha, etc. NFC.
Rui Ueyama [Wed, 13 Jun 2018 00:50:17 +0000 (00:50 +0000)]
Use shorter names for #lo, #hi, #ha, etc. NFC.

Since these functions are file-local, the new names shouldn't be ambiguous.

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

llvm-svn: 334564

3 years ago[X86] Mark all instructions that have masked store semantics with NotMemoryFoldable...
Craig Topper [Wed, 13 Jun 2018 00:04:08 +0000 (00:04 +0000)]
[X86] Mark all instructions that have masked store semantics with NotMemoryFoldable. Remove dependency on SchedRW from memory table autogenerator.

Previously we were whitelisting in instructions based on their SchedRW value. With the masked store instructions explicitly removed via NotMemoryFoldable, we don't seem to need this check anymore.

llvm-svn: 334563

3 years ago[X86] Remove VPCOMPRESSB/W from the autogenerated load folding table.
Craig Topper [Wed, 13 Jun 2018 00:04:04 +0000 (00:04 +0000)]
[X86] Remove VPCOMPRESSB/W from the autogenerated load folding table.

llvm-svn: 334562

3 years ago[CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes
Yaxun Liu [Tue, 12 Jun 2018 23:58:59 +0000 (23:58 +0000)]
[CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes

There are HIP applications e.g. Tensorflow 1.3 using amdgpu kernel attributes, however
currently they are only allowed on OpenCL kernel functions.

This patch will allow amdgpu kernel attributes to be applied to CUDA/HIP __global__
functions.

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

llvm-svn: 334561

3 years ago[analyzer] Do not crash in the visitor when the function is given more arguments...
George Karpenkov [Tue, 12 Jun 2018 23:53:54 +0000 (23:53 +0000)]
[analyzer] Do not crash in the visitor when the function is given more arguments than it has parameters

rdar://40335545

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

llvm-svn: 334560

3 years ago[AMDGPU] DAG combine to produce V_PERM_B32
Stanislav Mekhanoshin [Tue, 12 Jun 2018 23:50:37 +0000 (23:50 +0000)]
[AMDGPU] DAG combine to produce V_PERM_B32

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

llvm-svn: 334559

3 years ago[ASAN] disable fgets_fputs test for android and darwin
Peter Wu [Tue, 12 Jun 2018 23:05:03 +0000 (23:05 +0000)]
[ASAN] disable fgets_fputs test for android and darwin

aarch64/aosp_marlin-userdebug/OPR4.170623.016] builder unexpectedly
failed the fgets test (`assertion "fp" failed`). macOS unexpectedly
passes the fputs test without triggering ASAN.

llvm-svn: 334558

3 years agoDisable warnings for the generated LLDB wrapper source
Raphael Isemann [Tue, 12 Jun 2018 22:51:20 +0000 (22:51 +0000)]
Disable warnings for the generated LLDB wrapper source

Summary:
This source files emits all kind of compiler warnings on different platforms. As the source code
in the file is generated and we therefore can't actually fix the warnings, we might as well disable
them.

Reviewers: aprantl, davide

Reviewed By: davide

Subscribers: davide, mgorny, lldb-commits

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

llvm-svn: 334557

3 years ago[AArch64] add tests for fadd with more than one use; NFC
Sanjay Patel [Tue, 12 Jun 2018 22:50:37 +0000 (22:50 +0000)]
[AArch64] add tests for fadd with more than one use; NFC

llvm-svn: 334556

3 years agoAdded missing include to AMDHSAKernelDescriptor.h
Raphael Isemann [Tue, 12 Jun 2018 22:40:20 +0000 (22:40 +0000)]
Added missing include to AMDHSAKernelDescriptor.h

We use size_t in this header, so we also need to include
cstddef to make it compile. Fixes the module builds.

llvm-svn: 334555

3 years ago[analyzer] Ensure that loop widening does not invalidate references
Matthew Voss [Tue, 12 Jun 2018 22:22:35 +0000 (22:22 +0000)]
[analyzer] Ensure that loop widening does not invalidate references

Loop widening can invalidate a reference. If the analyzer attempts to visit the
destructor to a non-existent reference, it will crash. This patch ensures that
the reference is preserved.

https://reviews.llvm.org/D47044

llvm-svn: 334554

3 years ago[DAGCombiner] Recognize more patterns for ABS
Krzysztof Parzyszek [Tue, 12 Jun 2018 21:51:49 +0000 (21:51 +0000)]
[DAGCombiner] Recognize more patterns for ABS

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

llvm-svn: 334553

3 years agoFix /WholeArchive bug.
Rui Ueyama [Tue, 12 Jun 2018 21:47:31 +0000 (21:47 +0000)]
Fix /WholeArchive bug.

`lld-link foo.lib /wholearchive:foo.lib` should work the same way as
`lld-link /wholearchive:foo.lib foo.lib`. Previously, /wholearchive in
the former case was ignored.

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

llvm-svn: 334552

3 years ago[X86] add avx512 tests for potentially miscompiling cvttp2si/cvttp2ui (PR37751).
Craig Topper [Tue, 12 Jun 2018 21:42:42 +0000 (21:42 +0000)]
[X86] add avx512 tests for potentially miscompiling cvttp2si/cvttp2ui (PR37751).

llvm-svn: 334551

3 years ago[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename.
Ahmed Bougacha [Tue, 12 Jun 2018 21:27:36 +0000 (21:27 +0000)]
[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename.

This was changed in r334477.

llvm-svn: 334550

3 years agoAdded modulemap for lldb-mi
Raphael Isemann [Tue, 12 Jun 2018 21:22:52 +0000 (21:22 +0000)]
Added modulemap for lldb-mi

Summary: This patch allows building a C++ module for the lldb-mi headers.

Reviewers: bruno, aprantl

Reviewed By: aprantl

Subscribers: lldb-commits, ki.stfu

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

llvm-svn: 334549

3 years ago[COFF] Fix crash when emitting symbol tables with GC
Shoaib Meenai [Tue, 12 Jun 2018 21:19:33 +0000 (21:19 +0000)]
[COFF] Fix crash when emitting symbol tables with GC

When running with linker GC (`-opt:ref`), defined imported symbols that
are referenced but then dropped by GC end up with their `Location`
member being nullptr, which means `getChunk()` returns nullptr for them
and attempting to call `getChunk()->getOutputSection()` causes a crash
from the nullptr dereference. Check for `getChunk()` being nullptr and
bail out early to avoid the crash.

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

llvm-svn: 334548

3 years agoRemove malloc.h include from Intel JIT events code
Reid Kleckner [Tue, 12 Jun 2018 21:15:27 +0000 (21:15 +0000)]
Remove malloc.h include from Intel JIT events code

llvm-svn: 334547

3 years ago[libFuzzer] [NFC] Do not use hardcoded relative paths in tests.
George Karpenkov [Tue, 12 Jun 2018 21:14:33 +0000 (21:14 +0000)]
[libFuzzer] [NFC] Do not use hardcoded relative paths in tests.

For paths without "%t" inside uniqueness is not guaranteed, and
potential collisions might be present.

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

llvm-svn: 334546

3 years ago[libFuzzer] [NFC] Make compiler command generation more readable.
George Karpenkov [Tue, 12 Jun 2018 21:14:11 +0000 (21:14 +0000)]
[libFuzzer] [NFC] Make compiler command generation more readable.

Use config.clang as a more general option than config.c_compiler.

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

llvm-svn: 334545

3 years agoAdd null check to Intel JIT event listener
Reid Kleckner [Tue, 12 Jun 2018 20:54:11 +0000 (20:54 +0000)]
Add null check to Intel JIT event listener

llvm-svn: 334544

3 years agoFix how LLVMOPTIONALCOMPONENTS is passed to llvm-build
Reid Kleckner [Tue, 12 Jun 2018 20:53:46 +0000 (20:53 +0000)]
Fix how LLVMOPTIONALCOMPONENTS is passed to llvm-build

Patch by Force.Charlie-I

If LLVM_USE_INTEL_JITEVENTS and LLVM_USE_OPROFILE  not set,
"${LLVMOPTIONALCOMPONENTS}" is empty, but
**--enable-optional-components** need arg, Cause
**--write-library-table** to be skipped parsed.

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

llvm-svn: 334543

3 years ago[analyzer] [NFC] Remove "removeInvalidation" from visitor API
George Karpenkov [Tue, 12 Jun 2018 20:51:19 +0000 (20:51 +0000)]
[analyzer] [NFC] Remove "removeInvalidation" from visitor API

removeInvalidation is a very problematic API, as it makes suppression
order-dependent.
Moreover, it was used only once, and could be rewritten in a much
cleaner way.

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

llvm-svn: 334542

3 years ago[analyzer] [NFC] Move ::dump methods from BugReporter.cpp to PathDiagnostics.cpp
George Karpenkov [Tue, 12 Jun 2018 20:51:01 +0000 (20:51 +0000)]
[analyzer] [NFC] Move ::dump methods from BugReporter.cpp to PathDiagnostics.cpp

BugReporter.cpp is already severely overloaded, and those dump methods
are on PathDiagnostics and should belong in the corresponding
implementation file.

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

llvm-svn: 334541

3 years ago[analyzer] [NFC] Remove most usages of getEndPath
George Karpenkov [Tue, 12 Jun 2018 20:50:44 +0000 (20:50 +0000)]
[analyzer] [NFC] Remove most usages of getEndPath

getEndPath is a problematic API, because it's not clear when it's called
(hint: not always at the end of the path), it crashes at runtime with
more than one non-nullptr returning implementation, and diagnostics
internal depend on it being called at some exact place.

However, most visitors don't actually need that: all they want is a
function consistently called after all nodes are traversed, to perform
finalization and to decide whether invalidation is needed.

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

llvm-svn: 334540

3 years agoWork around false -Wmissing-braces warning from old clang which has been fixed in...
Fangrui Song [Tue, 12 Jun 2018 20:44:11 +0000 (20:44 +0000)]
Work around false -Wmissing-braces warning from old clang which has been fixed in r314838

llvm-svn: 334539

3 years ago[ORC] Add a fallback definition generator for VSOs.
Lang Hames [Tue, 12 Jun 2018 20:43:18 +0000 (20:43 +0000)]
[ORC] Add a fallback definition generator for VSOs.

If a VSO has a fallback definition generator attached it will be called during
lookup (and lookupFlags) for any unresolved symbols. The definition generator
can add new definitions to the VSO for any unresolved symbol. This allows VSOs
to generate new definitions on demand.

The immediate use case for this code is supporting VSOs that can import
definitions found via dlsym on demand.

llvm-svn: 334538

3 years ago[ORC] Refactor blocking lookup logic into the blockingLookup function, and
Lang Hames [Tue, 12 Jun 2018 20:43:17 +0000 (20:43 +0000)]
[ORC] Refactor blocking lookup logic into the blockingLookup function, and
implement existing blocking lookups (the lookup function) and
JITSymbolResolverAdapter on top of that.

llvm-svn: 334537

3 years ago[RuntimeDyld] Add an assert to catch misbehaving symbol resolvers.
Lang Hames [Tue, 12 Jun 2018 20:43:17 +0000 (20:43 +0000)]
[RuntimeDyld] Add an assert to catch misbehaving symbol resolvers.

Resolvers are required to find results for all requested symbols or return an
error, but if a resolver fails to adhere to this contract (by returning results
for only a subset of the requested symbols) then this code will infinite loop.
This assertion catches resolvers that fail to adhere to the contract.

llvm-svn: 334536

3 years ago[MCJIT] Call materializeAll on modules before compiling them in MCJIT.
Lang Hames [Tue, 12 Jun 2018 20:43:15 +0000 (20:43 +0000)]
[MCJIT] Call materializeAll on modules before compiling them in MCJIT.

This only affects modules with lazy GVMaterializers attached (usually modules
read off disk using the lazy bitcode reader). For such modules, materializing
before compiling prevents crashes due to missing function bodies /
initializers.

llvm-svn: 334535

3 years agoHandle R_X86_64_GOTOFF64.
Rui Ueyama [Tue, 12 Jun 2018 20:27:16 +0000 (20:27 +0000)]
Handle R_X86_64_GOTOFF64.

R_X86_64_GOTOFF64 is a relocation type to set to a distance betwween
a symbol and the beginning of the .got section. Previously, we always
created a dynamic relocation for the relocation type even though it
can be resolved at link-time.

Creating a dynamic relocation for R_X86_64_GOTOFF64 caused link failure
for some programs that do have a relocation of the type in a .text
section, as text relocations are prohibited in most configurations.

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

llvm-svn: 334534

3 years ago[ELF][PPC64] Support R_PPC64_DTPREL64 which may be emitted in .rela.debug_addr
Fangrui Song [Tue, 12 Jun 2018 20:26:49 +0000 (20:26 +0000)]
[ELF][PPC64] Support R_PPC64_DTPREL64 which may be emitted in .rela.debug_addr

llvm-svn: 334533

3 years ago[ELF] Support R_X86_64_GOTPC{32,64}
Fangrui Song [Tue, 12 Jun 2018 20:18:41 +0000 (20:18 +0000)]
[ELF] Support R_X86_64_GOTPC{32,64}

Reviewers: ruiu, grimar, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 334532

3 years ago[AArch64] Support reserving x20 register
Petr Hosek [Tue, 12 Jun 2018 20:00:50 +0000 (20:00 +0000)]
[AArch64] Support reserving x20 register

Register x20 is a callee-saved register which may be used for other
purposes in certain contexts, for example to hold special variables
within the kernel. This change adds support for reserving this register
both to frontend and backend to make this register usable for these
purposes.

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

llvm-svn: 334531

3 years ago[X86] Remove unnecessary include from one of the tblgen emitters.
Craig Topper [Tue, 12 Jun 2018 19:59:10 +0000 (19:59 +0000)]
[X86] Remove unnecessary include from one of the tblgen emitters.

llvm-svn: 334530

3 years ago[X86] Remove mayLoad flag from AVX512 truncating store instructions.
Craig Topper [Tue, 12 Jun 2018 19:59:08 +0000 (19:59 +0000)]
[X86] Remove mayLoad flag from AVX512 truncating store instructions.

llvm-svn: 334529

3 years agoRevert r334458, r334220, r334212, r334139.
Matt Morehouse [Tue, 12 Jun 2018 19:43:40 +0000 (19:43 +0000)]
Revert r334458, r334220, r334212, r334139.

Reverts changes to AddCompilerRT.cmake due to breakage of
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/.

llvm-svn: 334528

3 years ago[clang-format] Fix crash while reflowing backslash in comments
Krasimir Georgiev [Tue, 12 Jun 2018 19:33:15 +0000 (19:33 +0000)]
[clang-format] Fix crash while reflowing backslash in comments

Summary:
The added test case was currently crashing with an assertion:
```
krasimir@krasimir> cat test.cc                                                                                                                                                              ~
// How to run:
// bbbbb run \
// rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \
// <log_file> -- --output_directory="<output_directory>"
krasimir@krasimir> ~/work/llvm-build/bin/clang-format test.cc                                                                                                                               ~
clang-format: /usr/local/google/home/krasimir/work/llvm/tools/clang/lib/Format/WhitespaceManager.cpp:117: void clang::format::WhitespaceManager::calculateLineBreakInformation(): Assertion `PreviousOriginalWhitespaceEndOffset <= OriginalWhitespaceStartOffset' failed.
```
The root cause was that BreakableToken was not considering the case of a reflow between an unescaped newline in a line comment.

Subscribers: cfe-commits

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

llvm-svn: 334527

3 years ago[analyzer] [NFC] Now let's have only one place for diagnostics generation
George Karpenkov [Tue, 12 Jun 2018 19:08:17 +0000 (19:08 +0000)]
[analyzer] [NFC] Now let's have only one place for diagnostics generation

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

llvm-svn: 334526

3 years ago[analyzer] [NFC] Unify Minimal and Extensive diagnostics.
George Karpenkov [Tue, 12 Jun 2018 19:08:00 +0000 (19:08 +0000)]
[analyzer] [NFC] Unify Minimal and Extensive diagnostics.

Once we removed AlternateExtensive, I've looked closer into the
difference between Minimal and Extensive, and turns out, the difference
was not that large.

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

llvm-svn: 334525

3 years ago[analyzer] [NFC] Remove unused Extensive diagnostic setting,
George Karpenkov [Tue, 12 Jun 2018 19:07:41 +0000 (19:07 +0000)]
[analyzer] [NFC] Remove unused Extensive diagnostic setting,

Rename AlternateExtensive to Extensive.
In 2013, five years ago, we have switched to AlternateExtensive
diagnostics by default, and Extensive was available under unused,
undocumented flag.
This change remove the flag, renames the Alternate
diagnostic to Extensive (as it's no longer Alternate), and ports the
test.

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

llvm-svn: 334524

3 years ago[MS][ARM64] Hoist __ImageBase handling into TargetLoweringObjectFileCOFF
Reid Kleckner [Tue, 12 Jun 2018 18:56:05 +0000 (18:56 +0000)]
[MS][ARM64] Hoist __ImageBase handling into TargetLoweringObjectFileCOFF

All COFF targets should use @IMGREL32 relocations for symbol differences
against __ImageBase. Do the same for getSectionForConstant, so that
immediates lowered to globals get merged across TUs.

Patch by Chris January

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

llvm-svn: 334523

3 years ago[asan, myriad] Support environment variables
Walter Lee [Tue, 12 Jun 2018 18:34:12 +0000 (18:34 +0000)]
[asan, myriad] Support environment variables

Provide a buffer that the test harness can write into to provide
values for the environment variables.  Format is a null-separated list
of VAR=value pairs; this is sufficent for our purpose.

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

llvm-svn: 334522

3 years agoAMDHSA/NFC: Code object v3 updates (additional):
Konstantin Zhuravlyov [Tue, 12 Jun 2018 18:33:51 +0000 (18:33 +0000)]
AMDHSA/NFC: Code object v3 updates (additional):

- Move section selection and alignment to AMDGPUAsmPrinter

llvm-svn: 334521

3 years ago[MIR][MachineCSE] Implementing proper MachineInstr::getNumExplicitDefs()
Roman Tereshin [Tue, 12 Jun 2018 18:30:37 +0000 (18:30 +0000)]
[MIR][MachineCSE] Implementing proper MachineInstr::getNumExplicitDefs()

Apparently, MachineInstr class definition as well as pretty much all of
the machine passes assume that the only kind of MachineInstr's operands
that is variadic for variadic opcodes is explicit non-definitions.

In particular, this assumption is made by MachineInstr::defs(), uses(),
and explicit_uses() methods, as well as by MachineCSE pass.

The assumption is incorrect judging from at least TableGen backend
implementation, that recognizes variable_ops in OutOperandList, and the
very existence of G_UNMERGE_VALUES generic opcode, or ARM load multiple
instructions, all of which have variadic defs.

In particular, MachineCSE pass breaks MIR with CSE'able G_UNMERGE_VALUES
instructions in it.

This commit implements MachineInstr::getNumExplicitDefs() similar to
pre-existing MachineInstr::getNumExplicitOperands(), fixes
MachineInstr::defs(), uses(), and explicit_uses(), and fixes MachineCSE
pass.

As the issue addressed seems to affect only machine passes that could be
ran mid-GlobalISel pipeline at the moment, the other passes aren't fixed
by this commit, like MachineLICM: that could be done on per-pass basis
when (if ever) they get adopted for GlobalISel.

Reviewed By: arsenm

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

llvm-svn: 334520

3 years agoAMDHSA: Code object v3 updates
Konstantin Zhuravlyov [Tue, 12 Jun 2018 18:02:46 +0000 (18:02 +0000)]
AMDHSA: Code object v3 updates

- Do not emit following assembler directives:
  - .hsa_code_object_version
  - .hsa_code_object_isa
  - .amd_amdgpu_isa
  - .amd_amdgpu_hsa_metadata
  - .amd_amdgpu_pal_metadata
- Do not emit .note entries
- Cleanup and bring in sync kernel descriptor header file
- Emit kernel descriptor into .rodata with appropriate relocations and
  alignments

llvm-svn: 334519

3 years agoRefactor ExecuteAndWait to take StringRefs.
Zachary Turner [Tue, 12 Jun 2018 17:43:52 +0000 (17:43 +0000)]
Refactor ExecuteAndWait to take StringRefs.

This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

llvm-svn: 334518

3 years ago[clang-format] Discourage breaks in submessage entries, hard rule
Krasimir Georgiev [Tue, 12 Jun 2018 17:26:31 +0000 (17:26 +0000)]
[clang-format] Discourage breaks in submessage entries, hard rule

Summary:
Currently clang-format allows this for text protos:
```
submessage:
    { key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' }
```
when it is under the column limit and when putting it all on one line exceeds the column limit.

This is not a very intuitive formatting, so I'd prefer having
```
submessage: {
  key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
}
```
instead, even if it takes one line more.

This patch prevents clang-format from inserting a break between `: {` and similar cases.

Reviewers: djasper, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 334517

3 years agoDebugNamesDWARFIndex: Implement DWARFDeclContext variant of GetTypes method
Pavel Labath [Tue, 12 Jun 2018 16:50:01 +0000 (16:50 +0000)]
DebugNamesDWARFIndex: Implement DWARFDeclContext variant of GetTypes method

This method is used to find complete definitions of a type when one
parses a compile unit with only forward declaration available.

Since it is only accessed from DWARFASTParserClang, it was not
possible/easy to trigger this codepath from lldb-test. Therefore, I
adapt add a debug-names variant to an existing dotest test to cover this
scenario.

llvm-svn: 334516

3 years ago[MC] [X86] Teach leaq _GLOBAL_OFFSET_TABLE(%rip), %r15 to use R_X86_64_GOTPC32 instea...
Fangrui Song [Tue, 12 Jun 2018 16:20:44 +0000 (16:20 +0000)]
[MC] [X86] Teach leaq _GLOBAL_OFFSET_TABLE(%rip), %r15 to use R_X86_64_GOTPC32 instead of R_X86_64_PC32

Summary:
This is similar to D46319 (ARM). x86-64 psABI p40 gives an example:

  leaq _GLOBAL_OFFSET_TABLE(%rip), %r15 # GOTPC32 reloc

GNU as creates R_X86_64_GOTPC32. However, MC currently emits R_X86_64_PC32.

Reviewers: javed.absar, echristo

Subscribers: kristof.beyls, llvm-commits, peter.smith, grimar

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

llvm-svn: 334515