platform/upstream/llvm.git
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

8 years ago[X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.
Ahmed Bougacha [Tue, 5 Apr 2016 20:02:57 +0000 (20:02 +0000)]
[X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.

We only generate LOCKed versions of add/sub when the result is unused.
It often happens that the result is used, but only by a comparison. We
can optimize those out by reusing EFLAGS, which lets us use the proper
instructions, instead of having to fallback to LXADD.

Instead of doing this as an MI peephole (as we do for the other
non-LOCKed (really, non-MR) forms), do it in ISel. It becomes quite
tricky later.

This also makes it eventually possible to stop expanding and/or/xor
if the only user is an icmp (also see D18141).

This uses the LOCK ISD opcodes added by r262244.

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

llvm-svn: 265450

8 years ago[GlobalISel] Add the RegisterBankInfo class for the handling of register banks.
Quentin Colombet [Tue, 5 Apr 2016 20:02:47 +0000 (20:02 +0000)]
[GlobalISel] Add the RegisterBankInfo class for the handling of register banks.

llvm-svn: 265449

8 years ago[X86] Add tests for ATOMIC_LOAD_OP EFLAGS reuse. NFC.
Ahmed Bougacha [Tue, 5 Apr 2016 20:02:44 +0000 (20:02 +0000)]
[X86] Add tests for ATOMIC_LOAD_OP EFLAGS reuse. NFC.

llvm-svn: 265448

8 years ago[X86] Simplify early-exit check. NFC.
Ahmed Bougacha [Tue, 5 Apr 2016 20:02:22 +0000 (20:02 +0000)]
[X86] Simplify early-exit check. NFC.

llvm-svn: 265447

8 years ago[Support] Add a checked flag to Expected<T>, require checks before access or
Lang Hames [Tue, 5 Apr 2016 19:57:03 +0000 (19:57 +0000)]
[Support] Add a checked flag to Expected<T>, require checks before access or
destruction.

This makes the Expected<T> class behave like Error, even when in success mode.
Expected<T> values must be checked to see whether they contain an error prior
to being dereferenced, assigned to, or destructed.

llvm-svn: 265446

8 years ago[GlobalISel] Add a class, RegisterBank, to represent register banks.
Quentin Colombet [Tue, 5 Apr 2016 19:54:44 +0000 (19:54 +0000)]
[GlobalISel] Add a class, RegisterBank, to represent register banks.

llvm-svn: 265445

8 years agofixed to discard earlier advertising
Sanjay Patel [Tue, 5 Apr 2016 19:50:21 +0000 (19:50 +0000)]
fixed to discard earlier advertising

Also, hardcode (there must be a better way...) the 'utils' dir in the
advertisement, so it's easier to find.

llvm-svn: 265444

8 years agoFix a crasher that could happen if ClangASTSource::CompleteType() found a type whose...
Greg Clayton [Tue, 5 Apr 2016 19:29:05 +0000 (19:29 +0000)]
Fix a crasher that could happen if ClangASTSource::CompleteType() found a type whose name matched, but came from a different language. We need to verify that any types we find are clang types before trying to extra a clang::QualType and then use it.

<rdar://problem/24138711>

llvm-svn: 265443

8 years agofix typo; NFC
Sanjay Patel [Tue, 5 Apr 2016 19:27:39 +0000 (19:27 +0000)]
fix typo; NFC

llvm-svn: 265442

8 years ago[AArch64][Test] Do not override the suffixes for test cases.
Quentin Colombet [Tue, 5 Apr 2016 19:26:42 +0000 (19:26 +0000)]
[AArch64][Test] Do not override the suffixes for test cases.

llvm-svn: 265441

8 years ago[GlobalISel] Add the skeleton of the RegBankSelect pass.
Quentin Colombet [Tue, 5 Apr 2016 19:06:01 +0000 (19:06 +0000)]
[GlobalISel] Add the skeleton of the RegBankSelect pass.
This pass is reponsible for assigning the generic virtual registers to register
banks.

llvm-svn: 265440

8 years agoFix broken tests from no-jump-table commit
Nirav Dave [Tue, 5 Apr 2016 18:59:37 +0000 (18:59 +0000)]
Fix broken tests from no-jump-table commit

Summary: Fix failing tests from no-jump-table flag addition

Reviewers: jyknight

Subscribers: llvm-commits

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

llvm-svn: 265439

8 years ago[Support] clang-format Error.h.
Lang Hames [Tue, 5 Apr 2016 18:50:09 +0000 (18:50 +0000)]
[Support] clang-format Error.h.

This tidies up the ExitOnError class and some other recently added code. NFC.

llvm-svn: 265438

8 years ago[STATS] Remove trailing whitespace in stats source files
Jonathan Peyton [Tue, 5 Apr 2016 18:48:48 +0000 (18:48 +0000)]
[STATS] Remove trailing whitespace in stats source files

llvm-svn: 265437

8 years ago[CUDA] Show --cuda-gpu-arch option in clang --help.
Justin Lebar [Tue, 5 Apr 2016 18:26:25 +0000 (18:26 +0000)]
[CUDA] Show --cuda-gpu-arch option in clang --help.

For some reason it was hidden.

llvm-svn: 265436

8 years ago[CUDA] Add -fcuda-flush-denormals-to-zero.
Justin Lebar [Tue, 5 Apr 2016 18:26:20 +0000 (18:26 +0000)]
[CUDA] Add -fcuda-flush-denormals-to-zero.

Summary:
Setting this flag causes all functions are annotated with the
"nvvm-f32ftz" = "true" attribute.

In addition, we annotate the module with "nvvm-reflect-ftz" set
to 0 or 1, depending on whether -cuda-flush-denormals-to-zero is set.
This is read by the NVVMReflect pass.

Reviewers: tra, rnk

Subscribers: cfe-commits

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

llvm-svn: 265435

8 years agofix documentation comments; NFC
Sanjay Patel [Tue, 5 Apr 2016 18:23:30 +0000 (18:23 +0000)]
fix documentation comments; NFC

llvm-svn: 265434

8 years agoSwift Calling Convention: swifterror target-independent change.
Manman Ren [Tue, 5 Apr 2016 18:13:16 +0000 (18:13 +0000)]
Swift Calling Convention: swifterror target-independent change.

At IR level, the swifterror argument is an input argument with type
ErrorObject**. For targets that support swifterror, we want to optimize it
to behave as an inout value with type ErrorObject*; it will be passed in a
fixed physical register.

The main idea is to track the virtual registers for each swifterror value. We
define swifterror values as AllocaInsts with swifterror attribute or a function
argument with swifterror attribute.

In SelectionDAGISel.cpp, we set up swifterror values (SwiftErrorVals) before
handling the basic blocks.

When iterating over all basic blocks in RPO, before actually visiting the basic
block, we call mergeIncomingSwiftErrors to merge incoming swifterror values when
there are multiple predecessors or to simply propagate them. There, we create a
virtual register for each swifterror value in the entry block. For predecessors
that are not yet visited, we create virtual registers to hold the swifterror
values at the end of the predecessor. The assignments are saved in
SwiftErrorWorklist and will be materialized at the end of visiting the basic
block.

When visiting a load from a swifterror value, we copy from the current virtual
register assignment. When visiting a store to a swifterror value, we create a
virtual register to hold the swifterror value and update SwiftErrorMap to
track the current virtual register assignment.

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

llvm-svn: 265433

8 years agoFix missing period in no-jump-table flag comment. NFC.
Nirav Dave [Tue, 5 Apr 2016 18:11:01 +0000 (18:11 +0000)]
Fix missing period in no-jump-table flag comment. NFC.

llvm-svn: 265432

8 years agoadd tests to show missing optimization from D18230
Sanjay Patel [Tue, 5 Apr 2016 18:09:36 +0000 (18:09 +0000)]
add tests to show missing optimization from D18230

llvm-svn: 265431

8 years agoadd example usage and workflow to --help output
Sanjay Patel [Tue, 5 Apr 2016 18:00:47 +0000 (18:00 +0000)]
add example usage and workflow to --help output

llvm-svn: 265430

8 years agollvm-dwp: Simplify hashing code a bit
David Blaikie [Tue, 5 Apr 2016 17:51:40 +0000 (17:51 +0000)]
llvm-dwp: Simplify hashing code a bit

llvm-svn: 265426

8 years agoAdd -fno-jump-tables and-fjump-tables flags
Nirav Dave [Tue, 5 Apr 2016 17:50:43 +0000 (17:50 +0000)]
Add -fno-jump-tables and-fjump-tables flags

Add no-jump-tables flag to disable use of jump tables when lowering
switch statements

Reviewers: echristo, hans

Subscribers: llvm-commits

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

llvm-svn: 265425

8 years agoFix formatting.
Rui Ueyama [Tue, 5 Apr 2016 17:47:29 +0000 (17:47 +0000)]
Fix formatting.

llvm-svn: 265424

8 years agoAdd test case forgotten in r265379.
Tobias Grosser [Tue, 5 Apr 2016 17:40:07 +0000 (17:40 +0000)]
Add test case forgotten in r265379.

Thanks Johannes for reminding me.

llvm-svn: 265423

8 years agoFix dotest.py '-p' option for multi-process mode
Stephane Sezer [Tue, 5 Apr 2016 17:34:38 +0000 (17:34 +0000)]
Fix dotest.py '-p' option for multi-process mode

Summary:
The '-p' option for dotest.py was ignored in multiprocess mode,
as the -p argument to the inferior would overwrite the -p argument
passed on the command line.

Reviewers: zturner, tfiala

Subscribers: lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 265422

8 years agoUpdate watchpoint help to use new -s flag
Stephane Sezer [Tue, 5 Apr 2016 17:30:31 +0000 (17:30 +0000)]
Update watchpoint help to use new -s flag

Summary: Flag updated in D233237

Reviewers: spyffe, jingham, Eugene.Zelenko

Subscribers: lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 265421

8 years agoPrint environment when dumping arch triple
Stephane Sezer [Tue, 5 Apr 2016 17:29:19 +0000 (17:29 +0000)]
Print environment when dumping arch triple

Summary: Print environment from triple if it exists.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 265420

8 years agoMake sure to update Target arch if environment changed
Stephane Sezer [Tue, 5 Apr 2016 17:27:52 +0000 (17:27 +0000)]
Make sure to update Target arch if environment changed

Summary: Fixes "target list" for non-android linux platforms (ie gnu, gnueabi)

Reviewers: jasonmolenda, tfiala, clayborg, tberghammer

Subscribers: tberghammer, danalbert, lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 265419

8 years agoAllow gdbremote process to read modules from memory
Stephane Sezer [Tue, 5 Apr 2016 17:25:32 +0000 (17:25 +0000)]
Allow gdbremote process to read modules from memory

Summary:
The logic to read modules from memory was added to LoadModuleAtAddress
in the dynamic loader, but not in process gdb remote. This means that when
the remote uses svr4 packets to give library info, libraries only present
on the remote will not be loaded.

This patch therefore involves some code duplication from LoadModuleAtAddress
in the dynamic loader, but removing this would require some amount of code
refactoring.

Reviewers: ADodds, tberghammer, tfiala, deepak2427, ted

Subscribers: tfiala, lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 265418

8 years ago[InstCombine] regenerate checks
Sanjay Patel [Tue, 5 Apr 2016 17:24:54 +0000 (17:24 +0000)]
[InstCombine] regenerate checks

utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to CHECK-NEXT the first line of the IR function. This ensures that nothing bad
has happened before that.

llvm-svn: 265417

8 years ago[x86] regenerate checks
Sanjay Patel [Tue, 5 Apr 2016 17:12:19 +0000 (17:12 +0000)]
[x86] regenerate checks

utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to include the first line of the function (expected to be
a comment line). This ensures that nothing bad has happened
before the first actual line of checked asm. It also matches
the existing behavior of the old script.

llvm-svn: 265416

8 years agoWebAssembly: fix cfg-stackify test
JF Bastien [Tue, 5 Apr 2016 17:01:52 +0000 (17:01 +0000)]
WebAssembly: fix cfg-stackify test

It was broken by reshuffling induced by r265397 'Don't delete empty preheaders in CodeGenPrepare if it would create a critical edge'.

llvm-svn: 265415

8 years agocheck or check-next the first line of the function too
Sanjay Patel [Tue, 5 Apr 2016 16:49:07 +0000 (16:49 +0000)]
check or check-next the first line of the function too

We could make this an option if people don't like it.
But since part of the reason for using a script to generate
checks is to prevent lazy checking that lets bugs crawl
through, let's have the script check the first line too.

For asm tests, it ensures that nothing unexpected has
happened before the first line of asm. This matches the
existing behavior of update_llc_test_checks.py.

More discussion in PR22897:
https://llvm.org/bugs/show_bug.cgi?id=22897

llvm-svn: 265414

8 years agoRemove dead code and comment [NFC]
Johannes Doerfert [Tue, 5 Apr 2016 16:18:53 +0000 (16:18 +0000)]
Remove dead code and comment [NFC]

llvm-svn: 265413

8 years ago[TableGen] AsmMatcherEmitter.cpp: replace a sequence of "if" to "switch" in emitValid...
Valery Pykhtin [Tue, 5 Apr 2016 16:18:16 +0000 (16:18 +0000)]
[TableGen] AsmMatcherEmitter.cpp: replace a sequence of "if" to "switch" in emitValidateOperandClass.

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

llvm-svn: 265412

8 years ago[lanai] LanaiSetflagAluCombiner more conservative
Jacques Pienaar [Tue, 5 Apr 2016 16:18:13 +0000 (16:18 +0000)]
[lanai] LanaiSetflagAluCombiner more conservative

Summary: LanaiSetflagAluCombiner could previously combine instructions across basic building blocks even when not legal. Make the LanaiSetflagAluCombiner more conservative to avoid this.

Reviewers: eliben

Subscribers: joker.eph, llvm-commits

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

llvm-svn: 265411

8 years ago[WWW] Update passes
Johannes Doerfert [Tue, 5 Apr 2016 16:15:44 +0000 (16:15 +0000)]
[WWW] Update passes

llvm-svn: 265410

8 years ago[ARM] Cleanup of smul and smla instruction descriptions
Sam Parker [Tue, 5 Apr 2016 16:01:25 +0000 (16:01 +0000)]
[ARM] Cleanup of smul and smla instruction descriptions

Removed the SDNode argument passed to the AI_smul and AI_smla multiclass
definitions as they are always mul.

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

llvm-svn: 265409

8 years ago[AMDGPU] Emit linkonce and linkonce_odr symbols
Konstantin Zhuravlyov [Tue, 5 Apr 2016 16:00:58 +0000 (16:00 +0000)]
[AMDGPU] Emit linkonce and linkonce_odr symbols

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

llvm-svn: 265408

8 years ago[BlockPlacement] Remove an unnecessary continue
Haicheng Wu [Tue, 5 Apr 2016 15:37:08 +0000 (15:37 +0000)]
[BlockPlacement] Remove an unnecessary continue

NFC.

llvm-svn: 265407

8 years agoReverting r265401 ("Enabling AddressSanitizer tests, they should work now.")
Kuba Brecka [Tue, 5 Apr 2016 15:22:00 +0000 (15:22 +0000)]
Reverting r265401 ("Enabling AddressSanitizer tests, they should work now.")

llvm-svn: 265406

8 years ago[X86] Introduction of -march=lakemont.
Andrey Turetskiy [Tue, 5 Apr 2016 15:04:26 +0000 (15:04 +0000)]
[X86] Introduction of -march=lakemont.

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

llvm-svn: 265405

8 years agoUpdate for llvm change.
Rafael Espindola [Tue, 5 Apr 2016 14:47:28 +0000 (14:47 +0000)]
Update for llvm change.

llvm-svn: 265404

8 years agoUse ArrayRef for contiguous areas in ELF. NFC.
Rafael Espindola [Tue, 5 Apr 2016 14:47:22 +0000 (14:47 +0000)]
Use ArrayRef for contiguous areas in ELF. NFC.

This just simplifies the code a bit. More so in lld.

llvm-svn: 265403

8 years agoAdd missing test for the "Don't delete empty preheaders" added in r265397
Chuang-Yu Cheng [Tue, 5 Apr 2016 14:21:32 +0000 (14:21 +0000)]
Add missing test for the "Don't delete empty preheaders" added in r265397

Author: Tom Jablin (tjablin)
llvm-svn: 265402

8 years agoEnabling AddressSanitizer tests, they should work now.
Kuba Brecka [Tue, 5 Apr 2016 14:14:07 +0000 (14:14 +0000)]
Enabling AddressSanitizer tests, they should work now.

llvm-svn: 265401

8 years agoFixing AddressSanitizer tests (update expectations for current ASan, make it work...
Kuba Brecka [Tue, 5 Apr 2016 14:13:22 +0000 (14:13 +0000)]
Fixing AddressSanitizer tests (update expectations for current ASan, make it work on OS X 10.10 and older).

llvm-svn: 265400

8 years agoCentralize the definition of a few types. NFC.
Rafael Espindola [Tue, 5 Apr 2016 14:10:18 +0000 (14:10 +0000)]
Centralize the definition of a few types. NFC.

llvm-svn: 265399

8 years ago[NFC] Cleanup the code used to run shell commands from tests
Tamas Berghammer [Tue, 5 Apr 2016 14:08:18 +0000 (14:08 +0000)]
[NFC] Cleanup the code used to run shell commands from tests

Previously we had 3 different method to run shell commands on the
target and 4 copy of code waiting until a given file appears on the
target device (used for syncronization). This CL merges these methods
to 1 run_platform_command and 1 wait_for_file_on_target functions
located in some utility classes.

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

llvm-svn: 265398

8 years agoDon't delete empty preheaders in CodeGenPrepare if it would create a critical edge
Chuang-Yu Cheng [Tue, 5 Apr 2016 14:06:20 +0000 (14:06 +0000)]
Don't delete empty preheaders in CodeGenPrepare if it would create a critical edge

Presently, CodeGenPrepare deletes all nearly empty (only phi and branch)
basic blocks. This pass can delete loop preheaders which frequently creates
critical edges. A preheader can be a convenient place to spill registers to
the stack. If the entrance to a loop body is a critical edge, then spills
may occur in the loop body rather than immediately before it. This patch
protects loop preheaders from deletion in CodeGenPrepare even if they are
nearly empty.

Since the patch alters the CFG, it affects a large number of test cases.
In most cases, the changes are merely cosmetic (basic blocks have different
names or instruction orders change slightly). I am somewhat concerned about
the test/CodeGen/Mips/brdelayslot.ll test case. If the loop preheader is not
deleted, then the MIPS backend does not take advantage of a branch delay
slot. Consequently, I would like some close review by a MIPS expert.

The patch also partially subsumes D16893 from George Burgess IV. George
correctly notes that CodeGenPrepare does not actually preserve the dominator
tree. I think the dominator tree was usually not valid when CodeGenPrepare
ran, but I am using LoopInfo to mark preheaders, so the dominator tree is
now always valid before CodeGenPrepare.

Author: Tom Jablin (tjablin)
Reviewers: hfinkel george.burgess.iv vkalintiris dsanders kbarton cycheng

http://reviews.llvm.org/D16984

llvm-svn: 265397

8 years agoEnabling TSan tests, they should work now.
Kuba Brecka [Tue, 5 Apr 2016 13:59:45 +0000 (13:59 +0000)]
Enabling TSan tests, they should work now.

llvm-svn: 265396

8 years agoFix ThreadSanitizer test cases to work on OS X 10.10 and older.
Kuba Brecka [Tue, 5 Apr 2016 13:57:42 +0000 (13:57 +0000)]
Fix ThreadSanitizer test cases to work on OS X 10.10 and older.

llvm-svn: 265395

8 years ago[llvm-c] Expose LLVM{Get,Set}ModuleIdentifier
Peter Zotov [Tue, 5 Apr 2016 13:56:59 +0000 (13:56 +0000)]
[llvm-c] Expose LLVM{Get,Set}ModuleIdentifier

Patch by Nicole Mazzuca <npmazzuca@gmail.com>.

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

llvm-svn: 265394

8 years ago[FIX] Ensure SAI objects for exit PHIs
Johannes Doerfert [Tue, 5 Apr 2016 13:44:21 +0000 (13:44 +0000)]
[FIX] Ensure SAI objects for exit PHIs

  If all exiting blocks of a SCoP are error blocks and therefor not
  represented we will not generate accesses and consequently no SAI
  objects for exit PHIs. However, they are needed in the code generation
  to generate the merge PHIs between the original and optimized region.
  With this patch we enusre that the SAI objects for exit PHIs exist
  even if all exiting blocks turn out to be eror blocks.

  This fixes the crash reported in PR27207.

llvm-svn: 265393

8 years agoFix TestPlatformProcessConnect after rL265357
Tamas Berghammer [Tue, 5 Apr 2016 13:18:08 +0000 (13:18 +0000)]
Fix TestPlatformProcessConnect after rL265357

llvm-svn: 265392

8 years agoFix a bug in linux core file handling
Pavel Labath [Tue, 5 Apr 2016 13:07:16 +0000 (13:07 +0000)]
Fix a bug in linux core file handling

Summary:
There was a bug in linux core file handling, where if there was a running process with the same
process id as the id in the core file, the core file debugging would fail, as we would pull some
pieces of information (ProcessInfo structure) from the running process instead of the core file.
I fix this by routing the ProcessInfo requests through the Process class and overriding it in
ProcessElfCore to return correct data.

A (slightly convoluted) test is included.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 265391

8 years ago[mips] MIPSR6 Compact jump support
Simon Dardis [Tue, 5 Apr 2016 12:50:29 +0000 (12:50 +0000)]
[mips] MIPSR6 Compact jump support

This patch adds support for compact jumps similiar to the previous compact
branch support for MIPSR6. Unlike compact branches, compact jumps do not
have a forbidden slot.

As MipsInstrInfo::getEquivalentCompactForm can determine the correct
expansion for jumps and branches for both microMIPS and MIPSR6, remove the
unnecessary distinction in the delay slot filler.

Reviewers: vkalintiris

Subscribers: llvm-commits, dsanders
llvm-svn: 265390

8 years ago[NVPTX] Handle ldg created from sign-/zero-extended load
Justin Holewinski [Tue, 5 Apr 2016 12:38:01 +0000 (12:38 +0000)]
[NVPTX] Handle ldg created from sign-/zero-extended load

Reviewers: jingyue

Subscribers: jholewinski

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

llvm-svn: 265389

8 years agoAdds the ability to use an epilog remainder loop during loop unrolling and makes
David L Kreitzer [Tue, 5 Apr 2016 12:19:35 +0000 (12:19 +0000)]
Adds the ability to use an epilog remainder loop during loop unrolling and makes
this the default behavior.

Patch by Evgeny Stupachenko (evstupac@gmail.com).

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

llvm-svn: 265388

8 years agoSet the thumb flag for thumb symbols coming from an ELF file
Tamas Berghammer [Tue, 5 Apr 2016 12:11:40 +0000 (12:11 +0000)]
Set the thumb flag for thumb symbols coming from an ELF file

Without setting the flag there is no way to determine if a symbol
points to an arm or to a thumb function as the LSB of the address
masked out in all getter function.

Note: Currently the thumb flag is only used for MachO files so
adding a test to this change is not possible. It will be used
by the upcoming fix for llvm-objdump for disassembling thumb
functions what is easily testable.

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

llvm-svn: 265387

8 years agoRemove redundant argument. NFC.
Rafael Espindola [Tue, 5 Apr 2016 11:47:46 +0000 (11:47 +0000)]
Remove redundant argument. NFC.

llvm-svn: 265386

8 years agoclang-format: Fix cast detection on "this".
Daniel Jasper [Tue, 5 Apr 2016 11:46:06 +0000 (11:46 +0000)]
clang-format: Fix cast detection on "this".

Before:
  auto x = (X) this;

After:
  auto x = (X)this;

This fixes llvm.org/PR27198.

llvm-svn: 265385

8 years ago[clang-tidy] Add a check to detect static definitions in anonymous namespace.
Haojian Wu [Tue, 5 Apr 2016 11:42:08 +0000 (11:42 +0000)]
[clang-tidy] Add a check to detect static definitions in anonymous namespace.

Summary: Fixes PR26595

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265384

8 years agoAdd parentheses around `&&` within `||` to avoid compiler warning message.
Haojian Wu [Tue, 5 Apr 2016 09:07:47 +0000 (09:07 +0000)]
Add parentheses around `&&` within `||` to avoid compiler warning message.

Summary: The assert code is introduced by r265370.

Reviewers: bkramer

Subscribers: tejohnson

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

llvm-svn: 265383

8 years ago[IFUNC] Use GlobalIndirectSymbol when aliases and ifuncs have something similar
Dmitry Polukhin [Tue, 5 Apr 2016 08:47:51 +0000 (08:47 +0000)]
[IFUNC] Use GlobalIndirectSymbol when aliases and ifuncs have something similar

Second part extracted from http://reviews.llvm.org/D15525

Use GlobalIndirectSymbol in all cases when aliases and ifuncs have
something in common.

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

llvm-svn: 265382

8 years agoConsolidate and improve the handling of built-in feature-like macros
Andy Gibbs [Tue, 5 Apr 2016 08:36:47 +0000 (08:36 +0000)]
Consolidate and improve the handling of built-in feature-like macros

Summary:
The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements:

* Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters
* Provide consistent behaviour between all built-in feature-like macros
* Simplify the implementation of macro logic
* Fix __is_identifier to correctly return '0' for non-identifiers

Reviewers: doug.gregor, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 265381

8 years agoScopInfo: Check for possibly nested GEP in fixed-size delin
Tobias Grosser [Tue, 5 Apr 2016 06:23:45 +0000 (06:23 +0000)]
ScopInfo: Check for possibly nested GEP in fixed-size delin

We currently only consider the first GEP when delinearizing access functions,
which makes us loose information about additional index expression offsets,
which results in our SCoP model to be incorrect. With this patch we now
compare the base pointers used to ensure we do not miss any additional offsets.
This fixes llvm.org/PR27195.

We may consider supporting nested GEP in our delinearization heuristics in
the future.

llvm-svn: 265379

8 years ago[tsan] Fix freebsd build.
Yabin Cui [Tue, 5 Apr 2016 05:37:48 +0000 (05:37 +0000)]
[tsan] Fix freebsd build.

Summary:
Freebsd doesn't have <sys/personality.h>, so call personality() only in
SANITIZER_LINUX.

Reviewers: llvm-commits, dvyukov, zatrazz, rengolin, beanz

Subscribers: beanz, emaste

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

llvm-svn: 265378

8 years agoConsolidate the knowledge of what arm cores are always executing
Jason Molenda [Tue, 5 Apr 2016 05:01:30 +0000 (05:01 +0000)]
Consolidate the knowledge of what arm cores are always executing
in thumb mode into one method in ArchSpec, replace checks for
specific cores in the disassembler with calls to this.  Also call
this from the arm instruction emulation code.

The determination of whether a given ArchSpec is thumb-only is still
a bit of a hack, but at least the hack is consolidated into a single
place.  In my original version of this patch http://reviews.llvm.org/D13578
I was calling into llvm's feature arm feature tables to make this
determination, like

#include "llvm/Support/TargetRegistry.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/../../lib/Target/ARM/ARMGenRegisterInfo.inc"
#include "llvm/../../lib/Target/ARM/ARMFeatures.h"

[...]

        std::string triple (GetTriple().getTriple());
        const char *cpu = "";
        const char *features_str = "";
        const llvm::Target *curr_target = llvm::TargetRegistry::lookupTarget(triple.c_str(), Error);
        std::unique_ptr<llvm::MCSubtargetInfo> subtarget_info_up (curr_target->createMCSubtargetInfo(triple.c_str(), cpu, features_str));
        if (subtarget_info_up->getFeatureBits()[llvm::ARM::FeatureNoARM])
        {
            return true;
        }

but those tables are post-llvm-build generated and linking against them
for all of our different build system methods was a big hiccup that I
haven't had time to revisit convincingly.

I'll keep that reviews.llvm.org patch around to remind myself that I
need to take another run at linking against the necessary tables
again in llvm.

<rdar://problem/23022803>

llvm-svn: 265377

8 years ago[Support] Fix an invalid character escaping in string literal (unittest).
Etienne Bergeron [Tue, 5 Apr 2016 01:46:26 +0000 (01:46 +0000)]
[Support] Fix an invalid character escaping in string literal (unittest).

Summary:
A character within a string literal is not escaped correctly.
In this case, there is no semantic change because the invalid character turn out to be NUL anyway.

note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }.

This issue was found by clang-tidy.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 265376

8 years ago[clang-tidy] Fix documentation of misc-suspicious-missing-comma
Etienne Bergeron [Tue, 5 Apr 2016 01:41:02 +0000 (01:41 +0000)]
[clang-tidy] Fix documentation of misc-suspicious-missing-comma

Summary:
The clang-tidy documentation generation was broken since commit : http://reviews.llvm.org/D18457

I ran locally the documentation generation and I fixed errors related to that specific check.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 265375

8 years agoFix another case of propagating IsUsedRegularObj.
Rafael Espindola [Tue, 5 Apr 2016 01:38:43 +0000 (01:38 +0000)]
Fix another case of propagating IsUsedRegularObj.

I have an idea on how to clean this up, but lets get the tests passing
first.

llvm-svn: 265374

8 years agoAdd triple to llvm-mc command line. Should fix Windows bot.
Peter Collingbourne [Tue, 5 Apr 2016 01:05:42 +0000 (01:05 +0000)]
Add triple to llvm-mc command line. Should fix Windows bot.

llvm-svn: 265373

8 years agoELF: Make SymbolBody::compare a non-template function.
Peter Collingbourne [Tue, 5 Apr 2016 00:47:58 +0000 (00:47 +0000)]
ELF: Make SymbolBody::compare a non-template function.

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

llvm-svn: 265372

8 years agoELF: Preserve MustBeInDynSym for bitcode symbols.
Peter Collingbourne [Tue, 5 Apr 2016 00:47:55 +0000 (00:47 +0000)]
ELF: Preserve MustBeInDynSym for bitcode symbols.

Make sure to copy the MustBeInDynSym field when replacing shared symbols with
bitcode symbols, and when replacing bitcode symbols with regular symbols
in addCombinedLtoObject. Fixes interposition of DSO symbols with bitcode
symbols in the main executable.

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

llvm-svn: 265371

8 years ago[ThinLTO] Refactor some common code into getGlobalValueInfo method (NFC)
Teresa Johnson [Tue, 5 Apr 2016 00:40:16 +0000 (00:40 +0000)]
[ThinLTO] Refactor some common code into getGlobalValueInfo method (NFC)

Refactor common code that queries the ModuleSummaryIndex for a value's
GlobalValueInfo struct into getGlobalValueInfo helper methods, which
will also be used by D18763.

llvm-svn: 265370

8 years agoDocs: dampen story time for atomics
JF Bastien [Tue, 5 Apr 2016 00:31:25 +0000 (00:31 +0000)]
Docs: dampen story time for atomics

Story time was nice a few years ago, but by now it's nice to state how things are, rather than explain the diff from ye olden atomic history. These were dark times.

llvm-svn: 265369

8 years agoLanai: fix -Wsign-compare warning
JF Bastien [Tue, 5 Apr 2016 00:20:27 +0000 (00:20 +0000)]
Lanai: fix -Wsign-compare warning

llvm-svn: 265368

8 years agoDon't fold double constant to an integer if dest type not integral
Teresa Johnson [Mon, 4 Apr 2016 23:50:46 +0000 (23:50 +0000)]
Don't fold double constant to an integer if dest type not integral

Summary:
I encountered this issue when constant folding during inlining tried to
fold away a bitcast of a double to an x86_mmx, which is not an integral
type. The test case exposes the same issue with a smaller code snippet
during early CSE.

Subscribers: llvm-commits

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

llvm-svn: 265367

8 years ago[tsan] Disable randomized address space on aarch64 linux.
Yabin Cui [Mon, 4 Apr 2016 23:48:25 +0000 (23:48 +0000)]
[tsan] Disable randomized address space on aarch64 linux.

Summary:
After patch https://lkml.org/lkml/2015/12/21/340 is introduced in
linux kernel, the random gap between stack and heap is increased
from 128M to 36G on 39-bit aarch64. And it is almost impossible
to cover this big range. So we need to disable randomized virtual
space on aarch64 linux.

Reviewers: llvm-commits, zatrazz, dvyukov, rengolin

Subscribers: aemerson, rengolin, tberghammer, danalbert, srhines

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

llvm-svn: 265366

8 years agoLanai: fix -Wpedantic warnings
JF Bastien [Mon, 4 Apr 2016 23:47:30 +0000 (23:47 +0000)]
Lanai: fix -Wpedantic warnings

Extra semicolon.

llvm-svn: 265365

8 years agoMove local helper class into anonymous namespace.
Richard Smith [Mon, 4 Apr 2016 23:29:43 +0000 (23:29 +0000)]
Move local helper class into anonymous namespace.

llvm-svn: 265364