platform/upstream/llvm.git
8 years agoRevert "Re-commit r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFra...
Hans Wennborg [Wed, 6 Apr 2016 16:10:20 +0000 (16:10 +0000)]
Revert "Re-commit r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudoInstr (PR27140)""

It seems to be causing ASan tests to crash, probably due to
miscompiling the run-time somehow.

llvm-svn: 265551

8 years ago[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Valery Pykhtin [Wed, 6 Apr 2016 15:55:10 +0000 (15:55 +0000)]
[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.

Differential revision: http://reviews.llvm.org/D16998

llvm-svn: 265550

8 years ago[AArch64] Use the default constructor of RegisterBankInfo when GlobalISel is not...
Quentin Colombet [Wed, 6 Apr 2016 15:53:13 +0000 (15:53 +0000)]
[AArch64] Use the default constructor of RegisterBankInfo when GlobalISel is not built.
This will avoid link-time error as the defautl constructor of RegisterBankInfo is
the only one available when GlobalISel is not built.

llvm-svn: 265549

8 years ago[RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel...
Quentin Colombet [Wed, 6 Apr 2016 15:47:17 +0000 (15:47 +0000)]
[RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel is not built.

llvm-svn: 265548

8 years agoRecommit r265309 after fixed an invalid memory reference bug happened
Wei Mi [Wed, 6 Apr 2016 15:41:07 +0000 (15:41 +0000)]
Recommit r265309 after fixed an invalid memory reference bug happened
when DenseMap growed and moved memory. I verified it fixed the bootstrap
problem on x86_64-linux-gnu but I cannot verify whether it fixes
the bootstrap error on clang-ppc64be-linux. I will watch the build-bot
result closely.

Replace analyzeSiblingValues with new algorithm to fix its compile
time issue. The patch is to solve PR17409 and its duplicates.

analyzeSiblingValues is a N x N complexity algorithm where N is
the number of siblings generated by reg splitting. Although it
causes siginificant compile time issue when N is large, it is also
important for performance since it removes redundent spills and
enables rematerialization.

To solve the compile time issue, the patch removes analyzeSiblingValues
and replaces it with lower cost alternatives containing two parts. The
first part creates a new spill hoisting method in postOptimization of
register allocation. It does spill hoisting at once after all the spills
are generated instead of inside every instance of selectOrSplit. The
second part queries the define expr of the original register for
rematerializaiton and keep it always available during register allocation
even if it is already dead. It deletes those dead instructions only in
postOptimization. With the two parts in the patch, it can remove
analyzeSiblingValues without sacrificing performance.

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

llvm-svn: 265547

8 years agoEnable PIE for CloudABI.
Ed Schouten [Wed, 6 Apr 2016 15:37:06 +0000 (15:37 +0000)]
Enable PIE for CloudABI.

As we're currently working on making CloudABI executables easier to
emulate in userspace (e.g., on OS X and Windows), it makes a whole lot
of sense to build these using PIE. By using PIE, they can simply be
loaded into the existing process address space without clashes.

PIE support got added to CloudABI's C library and seems to work pretty
well. CloudABI does not make use of an ld.so, so the binary's _start()
has all the logic in it to do the relocations.

Now that all but one bug in LLD relating to PIE support have been
squashed (and a patch for that is already in code review), I'd like to
go ahead and force the use of PIE for Clang 3.9. When released, we'll
also switch over to using LLD exclusively.

llvm-svn: 265546

8 years agoclang-format: Support labels in brace-less ifs.
Daniel Jasper [Wed, 6 Apr 2016 15:02:46 +0000 (15:02 +0000)]
clang-format: Support labels in brace-less ifs.

While I am not personally convinced about the usefulness of this
construct, we should break it.

Before:
  if (a) label:
  f();

After:
  if (a)
  label:
    f();

llvm-svn: 265545

8 years ago[clang-tidy] Assertion fix in misc-misplaced-widening-cast check.
Gabor Horvath [Wed, 6 Apr 2016 14:49:15 +0000 (14:49 +0000)]
[clang-tidy] Assertion fix in misc-misplaced-widening-cast check.

llvm-svn: 265544

8 years agoUse a bit in SymbolBody to store CanKeepUndefined.
Rafael Espindola [Wed, 6 Apr 2016 14:31:03 +0000 (14:31 +0000)]
Use a bit in SymbolBody to store CanKeepUndefined.

UndefinedElf for 64 bits goes from 72 to 64 bytes.

llvm-svn: 265543

8 years ago[clang-tidy] filter plugins and plugin arguments of the command-line
Etienne Bergeron [Wed, 6 Apr 2016 14:07:51 +0000 (14:07 +0000)]
[clang-tidy] filter plugins and plugin arguments of the command-line

Summary:
This patch remove the plugin argument from the command-line.

Loading plugins was making clang-tidy to fail when running over chromium (linux).

Example of a command-line executed when running clang-tidy over chromium (from the compilation database).

```
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/WebKit/Source/core/fetch/webcore_shared.Resource.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=264915-1 -DCOMPONENT_BUILD -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_NOTIFICATIONS -DENABLE_TOPCHROME_MD=1 -DUSE_UDEV -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DBLINK_CORE_IMPLEMENTATION=1 -DBLINK_IMPLEMENTATION=1 -DINSIDE_BLINK -DGL_GLEXT_PROTOTYPES -DMOJO_USE_SYSTEM_IMPL -DCHROME_PNG_WRITE_SUPPORT -DPNG_USER_CONFIG -DENABLE_LAYOUT_UNIT_IN_INLINE_BOXES=0 -DENABLE_OILPAN=1 -DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1 -DENABLE_INPUT_MULTIPLE_FIELDS_UI=1 -DWTF_USE_ICCJPEG=1 -DWTF_USE_QCMSLIB=1 -DWTF_USE_WEBAUDIO_FFMPEG=1 -DWTF_USE_DEFAULT_RENDER_THEME=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_NOEXCEPT= -DSKIA_DLL -DGR_GL_IGNORE_ES3_MSAA=0 -DSK_SUPPORT_GPU=1 -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DLIBXML_STATIC -DLIBXSLT_STATIC -DV8_SHARED -DUSING_V8_SHARED -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_NSS_VERIFIER=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -D_GLIBCXX_DEBUG=1 -Igen -I../../third_party/WebKit/Source -Igen/blink -I../../third_party/WebKit -I../../third_party/WebKit/Source/core/testing -I../../third_party/WebKit/Source/core/testing/v8 -I../.. -I../../skia/config -I../../third_party/khronos -I../../gpu -Igen/angle -I../../third_party/angle/include -I../../third_party/ffmpeg -Igen/third_party/WebKit -I../../third_party/iccjpeg -I../../third_party/libpng -I../../third_party/libwebp -I../../third_party/ots/include -I../../third_party/zlib -I../../third_party/libjpeg_turbo -I../../third_party/icu/source/i18n -I../../third_party/icu/source/common -I../../skia/ext -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/pdf -I../../third_party/skia/include/gpu -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../third_party/libxml/linux/include -I../../third_party/libxml/src/include -I../../third_party/libxslt -I../../third_party/npapi -I../../third_party/npapi/bindings -I../../third_party/qcms/src -I../../third_party/snappy/linux -I../../third_party/snappy/src -I../../v8/include -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang follow-macro-expansion -fcolor-diagnostics -B/home/etienneb/chromium/src/third_party/binutils/Linux_x64/Release/bin -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wglobal-constructors -Wexit-time-destructors -fno-strict-aliasing -Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libBlinkGCPlugin.so -Xclang -add-plugin -Xclang blink-gc-plugin -Xclang -plugin-arg-blink-gc-plugin -Xclang enable-oilpan -Xclang -plugin-arg-blink-gc-plugin -Xclang warn-raw-ptr -pthread -I/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot/usr/include/glib-2.0 -I/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -m64 -march=x86-64 --sysroot=/home/etienneb/chromium/src/build/linux/debian_wheezy_amd64-sysroot -O0 -g -funwind-tables -gsplit-dwarf -g0 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11  -c ../../third_party/WebKit/Source/core/fetch/Resource.cpp -o obj/third_party/WebKit/Source/core/fetch/webcore_shared.Resource.o
```

The plugins are added with the following arguments:
```
-Xclang -load -Xclang /home/etienneb/chromium/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -Xclang -plugin-arg-find-bad-constructs -Xclang follow-macro-expansion
```

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265542

8 years agoRevert r265535 until we know how we can fix the bots
Silviu Baranga [Wed, 6 Apr 2016 14:06:32 +0000 (14:06 +0000)]
Revert r265535 until we know how we can fix the bots

llvm-svn: 265541

8 years agoclang-format: Fix incorrect function annotation detection.
Daniel Jasper [Wed, 6 Apr 2016 13:58:09 +0000 (13:58 +0000)]
clang-format: Fix incorrect function annotation detection.

Before:
  MACRO(
      abc).function() // wrap
      << abc;

After:
  MACRO(abc).function() // wrap
      << abc;

llvm-svn: 265540

8 years ago[clang-tidy] fix building clang-tidy documentation.
Etienne Bergeron [Wed, 6 Apr 2016 13:57:22 +0000 (13:57 +0000)]
[clang-tidy] fix building clang-tidy documentation.

Summary:
The clang-tidy documentation can't be generated because of broken links.

```
Warning, treated as error:
/home/etienneb/llvm/llvm/tools/clang/tools/extra/docs/clang-tidy/checks/google-readability-function-size.rst:: WARNING: document isn't included in any toctree
```

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265539

8 years ago[AMDGPU] AsmParser: disable DPP for unsupported instructions. New dpp tests. Fix...
Sam Kolton [Wed, 6 Apr 2016 13:29:59 +0000 (13:29 +0000)]
[AMDGPU] AsmParser: disable DPP for unsupported instructions. New dpp tests. Fix v_nop_dpp.

Summary:
1. Disable DPP encoding for instructions that do not support it:
    - VOP1:
        - v_readfirstlane_b32
        - v_clrexcp
        - v_movreld_b32
        - v_movrels_b32
        - v_movrelsd_b32
    - VOP2:
        - v_madmk_f16/32
        - v_madak_f16/32
    - VOPC, VINTRP, VOP3
2. Fix DPP for v_nop
3. New DPP tests for VOP1 and VOP2 instructions

Reviewers: nhaustov, tstellarAMD, vpykhtin

Subscribers: tstellarAMD, arsenm

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

llvm-svn: 265538

8 years agoSimplify logic. NFC.
Chad Rosier [Wed, 6 Apr 2016 13:27:13 +0000 (13:27 +0000)]
Simplify logic. NFC.

llvm-svn: 265537

8 years agoChange the type hierarchy for undefined symbols.
Rafael Espindola [Wed, 6 Apr 2016 13:22:41 +0000 (13:22 +0000)]
Change the type hierarchy for undefined symbols.

We have to differentiate undefined symbols from bitcode and undefined
symbols from other sources.

Undefined symbols from bitcode should not inhibit the symbol being
internalized. Undefined symbols from other sources should.

llvm-svn: 265536

8 years ago[SCEV] Introduce a guarded backedge taken count and use it in LAA and LV
Silviu Baranga [Wed, 6 Apr 2016 13:18:26 +0000 (13:18 +0000)]
[SCEV] Introduce a guarded backedge taken count and use it in LAA and LV

Summary:
When the backedge taken codition is computed from an icmp, SCEV can
deduce the backedge taken count only if one of the sides of the icmp
is an AddRecExpr. However, due to sign/zero extensions, we sometimes
end up with something that is not an AddRecExpr.

However, we can use SCEV predicates to produce a 'guarded' expression.
This change adds a method to SCEV to get this expression, and the
SCEV predicate associated with it.

In HowManyGreaterThans and HowManyLessThans we will now add a SCEV
predicate associated with the guarded backedge taken count when the
analyzed SCEV expression is not an AddRecExpr. Note that we only do
this as an alternative to returning a 'CouldNotCompute'.

We use new feature in Loop Access Analysis and LoopVectorize to analyze
and transform more loops.

Reviewers: anemet, mzolotukhin, hfinkel, sanjoy

Subscribers: flyingforyou, mcrosier, atrick, mssimpso, sanjoy, mzolotukhin, llvm-commits

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

llvm-svn: 265535

8 years agoFix use of uninitialized.
Rafael Espindola [Wed, 6 Apr 2016 12:19:25 +0000 (12:19 +0000)]
Fix use of uninitialized.

The names of undefined locals are not used, so I don't think it is
possible to actually test this.

llvm-svn: 265534

8 years agoRename a few Visibility arguments to StOther.
Rafael Espindola [Wed, 6 Apr 2016 12:14:31 +0000 (12:14 +0000)]
Rename a few Visibility arguments to StOther.

llvm-svn: 265533

8 years ago[clang-tidy] Extension of checker misc-misplaced-widening-cast
Gabor Horvath [Wed, 6 Apr 2016 12:04:51 +0000 (12:04 +0000)]
[clang-tidy] Extension of checker misc-misplaced-widening-cast

Summary:
Existing checker misc-misplaced-widening-cast was extended:
- New use cases: casted expression as lhs or rhs of a logical comparison or function argument
- New types: beside int, long and long long various char types, short and int128 added
- New option to check implicit casts: forgetting a cast is at least as common and as dangerous as misplacing it. This option can be disabled.

This patch depends on AST Matcher patches D17986 and D18243 and also contains fix for checker misc-bool-pointer-implicit-conversion needed because of the fix in the AST Matcher patch.

Reviewers: hokein, alexfh

Subscribers: o.gyorgy, xazax.hun, cfe-commits

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

llvm-svn: 265532

8 years ago[AArch64][CodeGen] NFC refactor AArch64InstrInfo::optimizeCompareInstr to prepare...
Evgeny Astigeevich [Wed, 6 Apr 2016 11:39:00 +0000 (11:39 +0000)]
[AArch64][CodeGen] NFC refactor AArch64InstrInfo::optimizeCompareInstr to prepare it for fixing a bug in it

AArch64InstrInfo::optimizeCompareInstr has a bug which causes generation of incorrect code (PR#27158).
The patch refactors the function to simplify reviewing the fix of the bug.

1. Function name ‘modifiesConditionCode’ is changed to ‘areCFlagsAccessedBetweenInstrs’
   to reflect that the function can check modifying accesses, reading accesses or both.
2. Function ‘AArch64InstrInfo::optimizeCompareInstr’
   - Documented the function
   - Cmp_NZCV is DeadNZCVIdx to reflect that it is an operand index of dead NZCV
   - The code for the case of substituting CmpInstr is put into separate
     functions the main of them is ‘substituteCmpInstr’.

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

llvm-svn: 265531

8 years ago[OPENMP] Parsing and Sema support for 'omp declare target' directive
Dmitry Polukhin [Wed, 6 Apr 2016 11:38:59 +0000 (11:38 +0000)]
[OPENMP] Parsing and Sema support for 'omp declare target' directive

Add parsing, sema analysis for 'declare target' construct for OpenMP 4.0
(4.5 support will be added in separate patch).

The declare target directive specifies that variables, functions (C, C++
and Fortran), and subroutines (Fortran) are mapped to a device. The declare
target directive is a declarative directive. In Clang declare target is
implemented as implicit attribute for the declaration.

The syntax of the declare target directive is as follows:

 #pragma omp declare target
 declarations-definition-seq
 #pragma omp end declare target

Based on patch from Michael Wong http://reviews.llvm.org/D15321

llvm-svn: 265530

8 years agoFixup TestLinuxCore on windows
Pavel Labath [Wed, 6 Apr 2016 11:05:30 +0000 (11:05 +0000)]
Fixup TestLinuxCore on windows

test_same_pid_running couldn't delete the temporary files, while we had them open. Deleting the
target should make things work.

llvm-svn: 265529

8 years ago[ppc64] Temporary disable sibling call optimization on ppc64 due to breaking test...
Chuang-Yu Cheng [Wed, 6 Apr 2016 10:48:36 +0000 (10:48 +0000)]
[ppc64] Temporary disable sibling call optimization on ppc64 due to breaking test case

r265506 breaks print-stack-trace.cc test case of compiler-rt in bootstrap
test.

http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/1708

llvm-svn: 265528

8 years agoFix and xfail TestRegisterVariables after rL265498
Tamas Berghammer [Wed, 6 Apr 2016 10:34:29 +0000 (10:34 +0000)]
Fix and xfail TestRegisterVariables after rL265498

llvm-svn: 265527

8 years agoRevert "[modules] Continue factoring encoding of AST records out of ASTWriter."
Dmitry Polukhin [Wed, 6 Apr 2016 10:01:46 +0000 (10:01 +0000)]
Revert "[modules] Continue factoring encoding of AST records out of ASTWriter."

This reverts commit r265518.

llvm-svn: 265526

8 years agoFix a cornercase in breakpoint reporting
Pavel Labath [Wed, 6 Apr 2016 09:10:29 +0000 (09:10 +0000)]
Fix a cornercase in breakpoint reporting

Summary:
This resolves a similar problem as D16720 (which handled the case when we single-step onto a
breakpoint), but this one deals with involutary stops: when we stop a thread (e.g. because
another thread has hit a breakpont and we are doing a full stop), we can end up stopping it right
before it executes a breakpoint instruction. In this case, the stop reason will be empty, but we
will still step over the breakpoint when do the next resume, thereby missing a breakpoint hit.

I have observed this happening in TestConcurrentEvents, but I have no idea how to reproduce this
behavior more reliably.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 265525

8 years agoFixup r265398
Pavel Labath [Wed, 6 Apr 2016 08:55:31 +0000 (08:55 +0000)]
Fixup r265398

llvm-svn: 265524

8 years ago[ELF] - Teach linkerscript error handler to show full script line and column marker...
George Rimar [Wed, 6 Apr 2016 08:08:40 +0000 (08:08 +0000)]
[ELF] - Teach linkerscript error handler to show full script line and column marker on error.

When error, this adds the text line of script to the output
and a marks exact incorrect token under it:

line 1: <error text here>
UNKNOWN_TAG {
      ^

Differential revision: http://reviews.llvm.org/D18699

llvm-svn: 265523

8 years ago[ELF] - Do not handle ELF and program header as dummy sections.
George Rimar [Wed, 6 Apr 2016 07:20:45 +0000 (07:20 +0000)]
[ELF] - Do not handle ELF and program header as dummy sections.

ELF and program header are not part of OutputSections list anymore.
That helps to avoid having and working with functions like dummySectionsNum().
Still keeping them as sections helps to simplify the code.

Differential revision: http://reviews.llvm.org/D18743

llvm-svn: 265522

8 years ago[SLPVectorizer] Vectorizing the libm sqrt to llvm's sqrt intrinsic requires nnan
David Majnemer [Wed, 6 Apr 2016 07:04:53 +0000 (07:04 +0000)]
[SLPVectorizer] Vectorizing the libm sqrt to llvm's sqrt intrinsic requires nnan

To quote the langref "Unlike sqrt in libm, however, llvm.sqrt has
undefined behavior for negative numbers other than -0.0 (which allows
for better optimization, because there is no need to worry about errno
being set). llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sqrt."

This means that it's unsafe to replace sqrt with llvm.sqrt unless the
call is annotated with nnan.

Thanks to Hal Finkel for pointing this out!

llvm-svn: 265521

8 years agoIR: Move MDStrings to a BumpPtrAllocator
Duncan P. N. Exon Smith [Wed, 6 Apr 2016 06:41:54 +0000 (06:41 +0000)]
IR: Move MDStrings to a BumpPtrAllocator

We never delete any MDString until the context is destroyed.  Might as
well throw them onto a BumpPtrAllocator.

llvm-svn: 265520

8 years agoIRMover: Steal arguments when moving functions, NFC
Duncan P. N. Exon Smith [Wed, 6 Apr 2016 06:38:15 +0000 (06:38 +0000)]
IRMover: Steal arguments when moving functions, NFC

Instead of copying arguments from the source function to the
destination, steal them.  This has a few advantages.

  - The ValueMap doesn't need to be seeded with (or cleared of)
    Arguments.

  - Often the destination function won't have created any arguments yet,
    so this avoids malloc traffic.

  - Argument names don't need to be copied.

Because argument lists are lazy, this required a new
Function::stealArgumentListFrom helper.

llvm-svn: 265519

8 years ago[modules] Continue factoring encoding of AST records out of ASTWriter.
Richard Smith [Wed, 6 Apr 2016 06:26:08 +0000 (06:26 +0000)]
[modules] Continue factoring encoding of AST records out of ASTWriter.

llvm-svn: 265518

8 years agoRevert "[IRVerifier] Don't crash on invalid DIFile inside DISubprogram."
Davide Italiano [Wed, 6 Apr 2016 04:34:38 +0000 (04:34 +0000)]
Revert "[IRVerifier] Don't crash on invalid DIFile inside DISubprogram."

This reverts commit r265515 as lots of tests need to be fixed before
this actually can go in.

llvm-svn: 265517

8 years agoAdd parentheses to silence warning.
Richard Trieu [Wed, 6 Apr 2016 04:22:00 +0000 (04:22 +0000)]
Add parentheses to silence warning.

llvm-svn: 265516

8 years ago[IRVerifier] Don't crash on invalid DIFile inside DISubprogram.
Davide Italiano [Wed, 6 Apr 2016 03:57:47 +0000 (03:57 +0000)]
[IRVerifier] Don't crash on invalid DIFile inside DISubprogram.

llvm-svn: 265515

8 years ago[IRVerifier] Avoid crashing on an invalid compile unit.
Davide Italiano [Wed, 6 Apr 2016 03:07:58 +0000 (03:07 +0000)]
[IRVerifier] Avoid crashing on an invalid compile unit.

llvm-svn: 265514

8 years agoAArch64: Fix compile error
Matthias Braun [Wed, 6 Apr 2016 02:59:44 +0000 (02:59 +0000)]
AArch64: Fix compile error

Fixed to adapt a use of enterBasicBlock() in my last commit (because I
had follow on patches in my repository that change the code).

llvm-svn: 265513

8 years agoDo not allocate MipsReginfo using BumpPtrAllocator.
Rui Ueyama [Wed, 6 Apr 2016 02:52:47 +0000 (02:52 +0000)]
Do not allocate MipsReginfo using BumpPtrAllocator.

So that MipsReginfo's destructor will be called.

llvm-svn: 265512

8 years agoRegisterScavenger: Take a reference as enterBasicBlock() argument.
Matthias Braun [Wed, 6 Apr 2016 02:47:09 +0000 (02:47 +0000)]
RegisterScavenger: Take a reference as enterBasicBlock() argument.

Make it obvious that the argument cannot be nullptr.
Remove an unnecessary nullptr check in initRegState.

llvm-svn: 265511

8 years agoLivePhysRegs: removeReg() must remove aliased registers
Matthias Braun [Wed, 6 Apr 2016 02:46:35 +0000 (02:46 +0000)]
LivePhysRegs: removeReg() must remove aliased registers

We must remove all aliased registers which may be more than the all sub
and super registers combined.

Bug found while reading the code. The bug does not affect any existing
target as the only use of register aliases I could found were control
registers on ARM and Hexagon which are all reserved.

llvm-svn: 265510

8 years agoLivePhysRegs: Remove redundant check
Matthias Braun [Wed, 6 Apr 2016 02:46:04 +0000 (02:46 +0000)]
LivePhysRegs: Remove redundant check

llvm-svn: 265509

8 years agoValueMapper: Fix delayed blockaddress handling after r265273
Duncan P. N. Exon Smith [Wed, 6 Apr 2016 02:25:12 +0000 (02:25 +0000)]
ValueMapper: Fix delayed blockaddress handling after r265273

r265273 added Mapper::mapBlockAddress, which delays mapping a
blockaddress value until the function has a body.  The condition was
backwards, and should be checking Function::empty instead of
GlobalValue::isDeclaration.

llvm-svn: 265508

8 years agoAsmParser: Don't crash on unresolved !tbaa
Duncan P. N. Exon Smith [Wed, 6 Apr 2016 02:06:40 +0000 (02:06 +0000)]
AsmParser: Don't crash on unresolved !tbaa

Instead of crashing, give a nice error.  As a drive-by, fix the location
associated with the errors for unresolved metadata (the location was off
by one token).

llvm-svn: 265507

8 years ago[ppc64] Enable sibling call optimization on ppc64 ELFv1/ELFv2 abi
Chuang-Yu Cheng [Wed, 6 Apr 2016 02:04:38 +0000 (02:04 +0000)]
[ppc64] Enable sibling call optimization on ppc64 ELFv1/ELFv2 abi

This patch enable sibling call optimization on ppc64 ELFv1/ELFv2 abi, and
add a couple of test cases. This patch also passed llvm/clang bootstrap
test, and spec2006 build/run/result validation.

Original issue: https://llvm.org/bugs/show_bug.cgi?id=25617

Great thanks to Tom's (tjablin) help, he contributed a lot to this patch.
Thanks Hal and Kit's invaluable opinions!

Reviewers: hfinkel kbarton

http://reviews.llvm.org/D16315

llvm-svn: 265506

8 years ago[Power9] Implement add-pc, multiply-add, modulo, extend-sign-shift, random number...
Chuang-Yu Cheng [Wed, 6 Apr 2016 01:47:02 +0000 (01:47 +0000)]
[Power9] Implement add-pc, multiply-add, modulo, extend-sign-shift, random number, set bool, and dfp test significance

This patch implement the following instructions:
- addpcis subpcis
- maddhd maddhdu maddld
- modsw moduw modsd modud
- darn
- extswsli extswsli.
- setb
- dtstsfi dtstsfiq

Total 15 instructions

Reviewers: nemanjai hfinkel tjablin amehsan kbarton

http://reviews.llvm.org/D17885

llvm-svn: 265505

8 years ago[Power9] Implement copy-paste, msgsync, slb, and stop instructions
Chuang-Yu Cheng [Wed, 6 Apr 2016 01:46:45 +0000 (01:46 +0000)]
[Power9] Implement copy-paste, msgsync, slb, and stop instructions

This patch implements the following BookII and Book III instructions:
- copy copy_first cp_abort paste paste. paste_last
- msgsync
- slbieg slbsync
- stop

Total 10 instructions

Reviewers: nemanjai hfinkel tjablin amehsan kbarton
llvm-svn: 265504

8 years ago[RS4GC] Add a comment
Sanjoy Das [Wed, 6 Apr 2016 01:33:54 +0000 (01:33 +0000)]
[RS4GC] Add a comment

llvm-svn: 265503

8 years agoLower @llvm.experimental.deoptimize as a noreturn call
Sanjoy Das [Wed, 6 Apr 2016 01:33:49 +0000 (01:33 +0000)]
Lower @llvm.experimental.deoptimize as a noreturn call

While preserving the return value for @llvm.experimental.deoptimize at
the IR level is useful during mid-level optimization, doing so at the
machine instruction level requires generating some extra code and a
return that is non-ideal.  This change has LLVM lower

```
  %val = call @llvm.experimental.deoptimize
  ret %val
```

to effectively

```
  call @__llvm_deoptimize()
  unreachable
```

instead.

llvm-svn: 265502

8 years agoMake helper function static. NFC.
Rafael Espindola [Wed, 6 Apr 2016 01:30:49 +0000 (01:30 +0000)]
Make helper function static. NFC.

llvm-svn: 265501

8 years agoAMDGPU: Document address space mapping
Tom Stellard [Wed, 6 Apr 2016 01:29:19 +0000 (01:29 +0000)]
AMDGPU: Document address space mapping

Summary:
Address space mapping is described in lib/Target/AMDGPU/AMDGPU.h in
Doxygen comments. This patch adds the description to user guide for
AMDGPU back-end.

Patch By: Vedran Miletić

Reviewers: tstellarAMD, arsenm

Subscribers: llvm-commits

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

llvm-svn: 265500

8 years agoAArch64CodeGen: Make AArch64RegisterBankInfo.cpp optional along LLVM_BUILD_GLOBAL_ISEL.
NAKAMURA Takumi [Wed, 6 Apr 2016 01:18:08 +0000 (01:18 +0000)]
AArch64CodeGen: Make AArch64RegisterBankInfo.cpp optional along LLVM_BUILD_GLOBAL_ISEL.

llvm-svn: 265499

8 years agomake TestRegisterVariables slightly more resilient
Todd Fiala [Wed, 6 Apr 2016 01:14:37 +0000 (01:14 +0000)]
make TestRegisterVariables slightly more resilient

This test sets the compiler optimization level to -O1 and
makes some assumptions about how local frame vars will be
stored (i.e. in registers).  These assumptions are not always
true.

I did a first-pass set of improvements that:
(1) no longer assumes that every one of the target locations has
    every variable in a register.  Sometimes the compiler
    is even smarter and skips the register entirely.
(2) simply expects one of the 5 or so variables it checks
    to be in a register.

This test probably passes on a whole lot more systems than it
used to now.  This is certainly true on OS X.

llvm-svn: 265498

8 years agoFix a memory leak found by check-lld asan tests.
Ivan Krasin [Wed, 6 Apr 2016 01:11:10 +0000 (01:11 +0000)]
Fix a memory leak found by check-lld asan tests.

Summary:
This bug was introduced by http://reviews.llvm.org/rL265059,
where InputSectionBase got Thunks field, which can do memory allocations.
Since InputSectionBase destructors were never called (I count it as another bug),
that caused a memory leak when 2 or more thunks are added to a section.

The fix to is properly call InputSectionBase destructors from ~ObjectFile.

Reviewers: atanasyan, ruiu, rafael

Subscribers: rafael, krasin, pcc

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

llvm-svn: 265497

8 years agoThe FixItList typedef should have been inside "class ClangDiagnostic".
Jim Ingham [Wed, 6 Apr 2016 00:25:44 +0000 (00:25 +0000)]
The FixItList typedef should have been inside "class ClangDiagnostic".

llvm-svn: 265496

8 years agoIf the fixed expression doesn't parse, don't tell the user about it.
Jim Ingham [Wed, 6 Apr 2016 00:25:04 +0000 (00:25 +0000)]
If the fixed expression doesn't parse, don't tell the user about it.

llvm-svn: 265495

8 years agoDon't write "using $_lldb_local_vars" statements for variables with
Jim Ingham [Wed, 6 Apr 2016 00:24:17 +0000 (00:24 +0000)]
Don't write "using $_lldb_local_vars" statements for variables with
no name.  These were showing up with a recent clang, I haven't tracked
down why yet, but adding them is clearly wrong.

llvm-svn: 265494

8 years ago[SLPVectorizer] Vectorize libcalls of sqrt
David Majnemer [Wed, 6 Apr 2016 00:14:59 +0000 (00:14 +0000)]
[SLPVectorizer] Vectorize libcalls of sqrt

We didn't realize that we could transform the libcall into a vectorized
intrinsic.

llvm-svn: 265493

8 years ago[RegisterBankInfo] Include RegisterBank.h.
Quentin Colombet [Tue, 5 Apr 2016 23:57:25 +0000 (23:57 +0000)]
[RegisterBankInfo] Include RegisterBank.h.
We actually need the definition of a RegisterBank to be able to inline
the implementation of the subscript operator.

llvm-svn: 265492

8 years ago[RegisterBankInfo] Add missing include for assert.
Quentin Colombet [Tue, 5 Apr 2016 23:43:58 +0000 (23:43 +0000)]
[RegisterBankInfo] Add missing include for assert.

This should appease the linux bot.

llvm-svn: 265491

8 years ago[DebugInfo] Fix tests so that each subprogram belongs to a CU.
Davide Italiano [Tue, 5 Apr 2016 23:37:08 +0000 (23:37 +0000)]
[DebugInfo] Fix tests so that each subprogram belongs to a CU.

llvm-svn: 265490

8 years ago[AArch64] Initial implementation of the targeting of the register bank information.
Quentin Colombet [Tue, 5 Apr 2016 23:34:59 +0000 (23:34 +0000)]
[AArch64] Initial implementation of the targeting of the register bank information.

llvm-svn: 265489

8 years agoUpdate testing cases after backend changes.
Manman Ren [Tue, 5 Apr 2016 23:27:51 +0000 (23:27 +0000)]
Update testing cases after backend changes.

llvm-svn: 265488

8 years ago[RegisterBankInfo] Simplify the API for build a register bank.
Quentin Colombet [Tue, 5 Apr 2016 23:26:39 +0000 (23:26 +0000)]
[RegisterBankInfo] Simplify the API for build a register bank.
As part of the TRI argument of addRegBankCoverage we already have access to
the TargetRegisterClass through the ID of that register class.
Therefore, there is no point in needing a TargetRegisterClass instance,
the ID is enough to get to it.

llvm-svn: 265487

8 years ago[RS4GC] NFC cleanup of the DeferredReplacement class
Sanjoy Das [Tue, 5 Apr 2016 23:18:53 +0000 (23:18 +0000)]
[RS4GC] NFC cleanup of the DeferredReplacement class

Instead of constructors use clearly named factory methods.

llvm-svn: 265486

8 years ago[RS4GC] Better codegen for deoptimize calls
Sanjoy Das [Tue, 5 Apr 2016 23:18:35 +0000 (23:18 +0000)]
[RS4GC] Better codegen for deoptimize calls

Don't emit a gc.result for a statepoint lowered from
@llvm.experimental.deoptimize since the call into __llvm_deoptimize is
effectively noreturn.  Instead follow the corresponding gc.statepoint
with an "unreachable".

llvm-svn: 265485

8 years ago[Target] Remove a deprecated comment.
Quentin Colombet [Tue, 5 Apr 2016 23:04:54 +0000 (23:04 +0000)]
[Target] Remove a deprecated comment.

llvm-svn: 265484

8 years ago[Target] Add an accessor to the register bank information.
Quentin Colombet [Tue, 5 Apr 2016 22:50:40 +0000 (22:50 +0000)]
[Target] Add an accessor to the register bank information.

llvm-svn: 265483

8 years agoSwift Calling Convention: swiftcc for ARM.
Manman Ren [Tue, 5 Apr 2016 22:44:44 +0000 (22:44 +0000)]
Swift Calling Convention: swiftcc for ARM.

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

llvm-svn: 265482

8 years agoFaster stack-protector for Android/AArch64.
Evgeniy Stepanov [Tue, 5 Apr 2016 22:41:50 +0000 (22:41 +0000)]
Faster stack-protector for Android/AArch64.

Bionic has a defined thread-local location for the stack protector
cookie. Emit a direct load instead of going through __stack_chk_guard.

llvm-svn: 265481

8 years agoSwift Calling Convention: add swiftcc.
Manman Ren [Tue, 5 Apr 2016 22:41:47 +0000 (22:41 +0000)]
Swift Calling Convention: add swiftcc.

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

llvm-svn: 265480

8 years ago[RegisterBank] Implement the verify method to check for the obvious mistakes.
Quentin Colombet [Tue, 5 Apr 2016 22:34:01 +0000 (22:34 +0000)]
[RegisterBank] Implement the verify method to check for the obvious mistakes.

llvm-svn: 265479

8 years agoDelete broken code.
Rafael Espindola [Tue, 5 Apr 2016 22:08:39 +0000 (22:08 +0000)]
Delete broken code.

A synthetic symbol can be global or local, and with the current
infrastructure we don't need any special code for it.

Fixes PR27228.

llvm-svn: 265478

8 years ago[lld][MachO] Check Expected<T> for error prior to destruction.
Lang Hames [Tue, 5 Apr 2016 22:06:48 +0000 (22:06 +0000)]
[lld][MachO] Check Expected<T> for error prior to destruction.

This should fix the failures on the LLD bots caused by r265446.

llvm-svn: 265477

8 years agoRevert "XFail TestImport.py on Windows because Python 3 import rules don't work that...
Adrian McCarthy [Tue, 5 Apr 2016 21:49:41 +0000 (21:49 +0000)]
Revert "XFail TestImport.py on Windows because Python 3 import rules don't work that way."

This reverts commit e5f0ba4fcf977ad6baaaca700d3646675cdac19b.

llvm-svn: 265476

8 years ago[RegisterBankInfo] Add debug print to check how the initialization is going.
Quentin Colombet [Tue, 5 Apr 2016 21:47:56 +0000 (21:47 +0000)]
[RegisterBankInfo] Add debug print to check how the initialization is going.

llvm-svn: 265475

8 years ago[CFLAA] Fix PR27213; incorrect tagging of args/globals
George Burgess IV [Tue, 5 Apr 2016 21:40:45 +0000 (21:40 +0000)]
[CFLAA] Fix PR27213; incorrect tagging of args/globals

Prior to this patch, CFLAA wouldn't tag arguments/globals properly if
it didn't find any "interesting" edges on them. This means that, if all
you do is store constants to a global or argument, we would never
actually treat it as a global/argument.

Test case:

define void @foo(i32* %A, i32* %B) #0 {
entry:
  store i32 0, i32* %A, align 4
  store i32 0, i32* %B, align 4
  ret void
}

CFLAA would say that %A can't alias %B, because neither pointer was
used in an interesting way. This patch makes us note whether something
is an argument, global, ... regardless of how interesting CFLAA thinks
its uses are.

(For the record, using a value in an interesting way means loading
from it, using it in a GEP, ...)

llvm-svn: 265474

8 years ago[RegisterBank] Add printable capabilities for future debugging.
Quentin Colombet [Tue, 5 Apr 2016 21:40:43 +0000 (21:40 +0000)]
[RegisterBank] Add printable capabilities for future debugging.

llvm-svn: 265473

8 years agoAdd a test for relocations in non alloc sections.
Rafael Espindola [Tue, 5 Apr 2016 21:27:30 +0000 (21:27 +0000)]
Add a test for relocations in non alloc sections.

We already got this right, but we were not testing it.

llvm-svn: 265471

8 years agoTry harder to appease MSVC after r265456
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 21:25:33 +0000 (21:25 +0000)]
Try harder to appease MSVC after r265456

r265465 wasn't good enough.  I need to spell out all the moves.

llvm-svn: 265470

8 years ago[RegisterBankInfo] Make addRegBankCoverage more capable to ease
Quentin Colombet [Tue, 5 Apr 2016 21:20:12 +0000 (21:20 +0000)]
[RegisterBankInfo] Make addRegBankCoverage more capable to ease
targeting jobs.
Now, addRegBankCoverage also adds the subreg-classes not just the
sub-classes of the given register class.

llvm-svn: 265469

8 years agoMinor code cleanups. NFC.
Junmo Park [Tue, 5 Apr 2016 21:14:31 +0000 (21:14 +0000)]
Minor code cleanups. NFC.

llvm-svn: 265468

8 years agoFix a crash on invalid with template handling
Richard Trieu [Tue, 5 Apr 2016 21:13:54 +0000 (21:13 +0000)]
Fix a crash on invalid with template handling

This is a fix for https://llvm.org/bugs/show_bug.cgi?id=25561 which was a
crash on invalid.  Change the handling of invalid decls to have a catch-all
case to prevent unexpecting decls from triggering an assertion.

llvm-svn: 265467

8 years agoIR: Introduce ConstantAggregate, NFC
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 21:10:45 +0000 (21:10 +0000)]
IR: Introduce ConstantAggregate, NFC

Add a common parent class for ConstantArray, ConstantVector, and
ConstantStruct called ConstantAggregate.  These are the aggregate
subclasses of Constant that take operands.

This is mainly a cleanup, adding common `isa` target and removing
duplicated code.  However, it also simplifies caching which constants
point transitively at `GlobalValue` (a possible future direction).

llvm-svn: 265466

8 years agoTry to appease MSVC after r265456
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 21:07:01 +0000 (21:07 +0000)]
Try to appease MSVC after r265456

I can't remember if adding `= default` will make MSVC happy, or if I
have to spell this out.  Let's try the cleaner version first.

llvm-svn: 265465

8 years ago[RegisterBankInfo] Implement the methods to create register banks.
Quentin Colombet [Tue, 5 Apr 2016 21:06:15 +0000 (21:06 +0000)]
[RegisterBankInfo] Implement the methods to create register banks.

llvm-svn: 265464

8 years agoIR: Add missing assertion for ConstantVector::ConstantVector
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 20:53:47 +0000 (20:53 +0000)]
IR: Add missing assertion for ConstantVector::ConstantVector

Use the same assertion as ConstantArray.  Vectors should have the right
number of elements.

llvm-svn: 265463

8 years agoMake TLS work for PIE executables on x86-64.
Ed Schouten [Tue, 5 Apr 2016 20:51:50 +0000 (20:51 +0000)]
Make TLS work for PIE executables on x86-64.

While trying to get PIE work on CloudABI for x86-64, I noticed that even
though GNU ld would generate functional binaries, LLD would not. It
turns out that we generate relocations for referencing TLS objects
inside of the text segment, which shouldn't happen.

This change extends the isRelRelative() function to list some additional
relocation types that should be treated as relative. This makes my C
library unit testing binary work on x86-64.

Approved by: ruiu
Differential Revision: http://reviews.llvm.org/D18688
Fixes bug: https://llvm.org/bugs/show_bug.cgi?id=27174

llvm-svn: 265462

8 years agoXFail TestImport.py on Windows because Python 3 import rules don't work that way.
Adrian McCarthy [Tue, 5 Apr 2016 20:49:09 +0000 (20:49 +0000)]
XFail TestImport.py on Windows because Python 3 import rules don't work that way.

llvm-svn: 265461

8 years ago[RegisterBank] Provide a way to check if a register bank is valid.
Quentin Colombet [Tue, 5 Apr 2016 20:48:32 +0000 (20:48 +0000)]
[RegisterBank] Provide a way to check if a register bank is valid.
Change the default constructor to create invalid object.
The target will have to properly initialize the register banks before
using them.

llvm-svn: 265460

8 years agoRevert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files;...
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 20:45:04 +0000 (20:45 +0000)]
Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."

This reverts commit r265454 since it broke the build.  E.g.:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/

llvm-svn: 265459

8 years agoMake constructors for final subclasses of Constant private, NFC
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 20:31:23 +0000 (20:31 +0000)]
Make constructors for final subclasses of Constant private, NFC

These were `protected` before, but might as well be `private`.  Also
marked the classes themselves `final`.

llvm-svn: 265458

8 years agollvm-dwp: Handle GCC's use of multiple debug_types.dwo sections in a single .dwo...
David Blaikie [Tue, 5 Apr 2016 20:26:50 +0000 (20:26 +0000)]
llvm-dwp: Handle GCC's use of multiple debug_types.dwo sections in a single .dwo file

(also includes the .test file missing from my previous commit, r265452)

llvm-svn: 265457

8 years agoValueMapper: Rewrite Mapper::mapMetadata without recursion
Duncan P. N. Exon Smith [Tue, 5 Apr 2016 20:23:21 +0000 (20:23 +0000)]
ValueMapper: Rewrite Mapper::mapMetadata without recursion

This commit completely rewrites Mapper::mapMetadata (the implementation
of llvm::MapMetadata) using an iterative algorithm.  The guts of the new
algorithm are in MDNodeMapper::map, the entry function in a new class.

Previously, Mapper::mapMetadata performed a recursive exploration of the
graph with eager "just in case there's a reason" malloc traffic.

The new algorithm has these benefits:

  - New nodes and temporaries are not created eagerly.
  - Uniquing cycles are not duplicated (see new unit test).
  - No recursion.

Given a node to map, it does this:

 1. Use a worklist to perform a post-order traversal of the transitively
    referenced unmapped nodes.

 2. Track which nodes will change operands, and which will have new
    addresses in the mapped scheme.  Propagate the changes through the
    POT until fixed point, to pick up uniquing cycles that need to
    change.

 3. Map all the distinct nodes without touching their operands.  If
    RF_MoveDistinctMetadata, they get mapped to themselves; otherwise,
    they get mapped to clones.

 4. Map the uniqued nodes (bottom-up), lazily creating temporaries for
    forward references as needed.

 5. Remap the operands of the distinct nodes.

Mehdi helped me out by profiling this with -flto=thin.  On his workload
(importing/etc. for opt.cpp), MapMetadata sped up by 15%, contributed
about 50% less to persistent memory, and made about 100x fewer calls to
malloc.  The speedup is less than I'd hoped.  The profile mainly blames
DenseMap lookups; perhaps there's a way to reduce them (e.g., by
disallowing remapping of MDString).

It would be nice to break the strange remaining recursion on the Value
side: MapValue => materializeInitFor => RemapInstruction => MapValue.  I
think we could do this by having materializeInitFor return a worklist of
things to be remapped.

llvm-svn: 265456

8 years ago[TargetRegisterClass] Improve the comment for how to use getSubClassMask.
Quentin Colombet [Tue, 5 Apr 2016 20:21:53 +0000 (20:21 +0000)]
[TargetRegisterClass] Improve the comment for how to use getSubClassMask.

llvm-svn: 265455

8 years agoFix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor...
Eugene Zelenko [Tue, 5 Apr 2016 20:19:49 +0000 (20:19 +0000)]
Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.

Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

Differential revision: http://reviews.llvm.org/D18778

llvm-svn: 265454

8 years agoDon't omit dynamic relocations for the GOT.
Ed Schouten [Tue, 5 Apr 2016 20:17:33 +0000 (20:17 +0000)]
Don't omit dynamic relocations for the GOT.

Where Clang's AArch64 backend seems to differ from the X86 backend is
that it tends to use the GOT more aggressively.

After getting CloudABI PIEs working on x86-64, I noticed that accessing
global variables would still crash on aarch64. Tracing it down, it turns
out that the GOT was filled with entries assuming the base address was
zero.

It turns out that we skip generating relocations for GOT entries in case
the relocation pointing towards the GOT is relative. Whether the thing
pointing to the GOT is absolute or relative shouldn't make any
difference; the GOT entry itself should contain the absolute address,
thus needs a relocation regardless.

Approved by: rafael
Differential Revision: http://reviews.llvm.org/D18739

llvm-svn: 265453

8 years agollvm-dwp: Handle dwo files produced by GCC
David Blaikie [Tue, 5 Apr 2016 20:16:38 +0000 (20:16 +0000)]
llvm-dwp: Handle dwo files produced by GCC

To start with, handle DW_FORM_string names. Follow up commit will handle
the interesting quirk with type units I was originally aiming for here.

llvm-svn: 265452

8 years ago[llvm-rtdyld] Fix the return type on ErrorAndExit.
Lang Hames [Tue, 5 Apr 2016 20:11:24 +0000 (20:11 +0000)]
[llvm-rtdyld] Fix the return type on ErrorAndExit.

As suggested by Rafael - this function no longer returns a value as of r264425.

llvm-svn: 265451