platform/upstream/llvm.git
8 years ago[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)
Mehdi Amini [Tue, 23 Aug 2016 18:39:15 +0000 (18:39 +0000)]
[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)

This adds a test for r279532, thanks David Li for noticing :)

Recommit r279545 after committing first a dependent patch.

llvm-svn: 279551

8 years agoStop always creating and running an LTO compilation if there is not a single LTO...
Mehdi Amini [Tue, 23 Aug 2016 18:39:12 +0000 (18:39 +0000)]
Stop always creating and running an LTO compilation if there is not a single LTO object

Summary:
I assume there was a use case, so maybe this strawman patch will help
clarifying if it is legit.
In any case the current situation is not legit: a ThinLTO compilation
should not trigger an unexpected full LTO compilation.
Right now, adding a --save-temps option triggers this and makes the
number of output differs.

Reviewers: tejohnson

Subscribers: pcc, llvm-commits, mehdi_amini

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

llvm-svn: 279550

8 years agoRevert "[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled...
Mehdi Amini [Tue, 23 Aug 2016 18:25:59 +0000 (18:25 +0000)]
Revert "[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)"

This reverts commit r279545, test is failing, my Output dir was dirty and making the test pass.

llvm-svn: 279549

8 years agoGlobalISel: legalize 1-bit load/store and mark 8/16 bit variants legal on AArch64.
Tim Northover [Tue, 23 Aug 2016 18:20:09 +0000 (18:20 +0000)]
GlobalISel: legalize 1-bit load/store and mark 8/16 bit variants legal on AArch64.

llvm-svn: 279548

8 years ago[asan] minor fix in the asan memory profile
Kostya Serebryany [Tue, 23 Aug 2016 18:13:51 +0000 (18:13 +0000)]
[asan] minor fix in the asan memory profile

llvm-svn: 279547

8 years agoARM-Darwin: ignore and diagnose attempts to omit frame pointer.
Tim Northover [Tue, 23 Aug 2016 18:12:58 +0000 (18:12 +0000)]
ARM-Darwin: ignore and diagnose attempts to omit frame pointer.

iOS (and other 32-bit ARM variants) always require a valid frame pointer to
improve backtraces. Previously the -fomit-frame-pointer and
-momit-leaf-frame-pointer options were being silently discarded via hacks in
the backend. It's better if Clang configures itself to emit the correct IR and
warns about (ignored) attempts to override this.

llvm-svn: 279546

8 years ago[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)
Mehdi Amini [Tue, 23 Aug 2016 18:12:55 +0000 (18:12 +0000)]
[ThinLTO] Add a llvm-lto2 test to check that ODR type uniquing is enabled (NFC)

This adds a test for r279532, thanks David Li for noticing :)

llvm-svn: 279545

8 years ago[CMake] [OCaml] Add -DLLVM_ENABLE_OCAMLDOC switch
Peter Zotov [Tue, 23 Aug 2016 18:07:16 +0000 (18:07 +0000)]
[CMake] [OCaml] Add -DLLVM_ENABLE_OCAMLDOC switch

Patch by Michael Gorny.

llvm-svn: 279544

8 years ago[InstSimplify] allow icmp with constant folds for splat vectors, part 2
Sanjay Patel [Tue, 23 Aug 2016 18:00:51 +0000 (18:00 +0000)]
[InstSimplify] allow icmp with constant folds for splat vectors, part 2

Completes the m_APInt changes for simplifyICmpWithConstant().

Other commits in this series:
https://reviews.llvm.org/rL279492
https://reviews.llvm.org/rL279530
https://reviews.llvm.org/rL279534
https://reviews.llvm.org/rL279538

llvm-svn: 279543

8 years agoPossible fix of test failures on win bots
Xinliang David Li [Tue, 23 Aug 2016 18:00:41 +0000 (18:00 +0000)]
Possible fix of test failures on win bots

llvm-svn: 279542

8 years ago[Documentation] Fix style of Clang-tidy readability-non-const-parameter.
Eugene Zelenko [Tue, 23 Aug 2016 17:57:24 +0000 (17:57 +0000)]
[Documentation] Fix style of Clang-tidy readability-non-const-parameter.

llvm-svn: 279541

8 years agoImplementation "step out" plans shouldn't gather the return value.
Jim Ingham [Tue, 23 Aug 2016 17:55:21 +0000 (17:55 +0000)]
Implementation "step out" plans shouldn't gather the return value.

When, for instance, "step-in" steps into a function that it doesn't want
to stop in (e.g. has no debug info) it will push a step-out plan to implement
the step out so it can then continue stepping.  These step out's don't use
the result of the function stepped out of, so they shouldn't spend the time
to compute it.

llvm-svn: 279540

8 years agoDelete remaining compiler-rt makefiles
Chris Bieneman [Tue, 23 Aug 2016 17:32:38 +0000 (17:32 +0000)]
Delete remaining compiler-rt makefiles

Summary:
Since we can now build the builtins without a full toolchain these files should no longer be needed.

This is the last vestige of autoconf!

Reviewers: compnerd, iains, jroelofs

Subscribers: dberris, llvm-commits

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

llvm-svn: 279539

8 years ago[InstSimplify] allow icmp with constant folds for splat vectors, part 1
Sanjay Patel [Tue, 23 Aug 2016 17:30:56 +0000 (17:30 +0000)]
[InstSimplify] allow icmp with constant folds for splat vectors, part 1

llvm-svn: 279538

8 years ago[SelectionDAG] Use a union of bitfield structs for SDNode::SubclassData.
Justin Lebar [Tue, 23 Aug 2016 17:18:11 +0000 (17:18 +0000)]
[SelectionDAG] Use a union of bitfield structs for SDNode::SubclassData.

Summary:
This greatly simplifies our handling of SDNode::SubclassData.

NFC, hopefully.  :)

See discussion in D23035 for discussion about the design API of these
bitfields.

Reviewers: chandlerc

Subscribers: llvm-commits, rnk

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

llvm-svn: 279537

8 years ago[CodeGen] Convert a loop to a for-each loop. NFC
Justin Lebar [Tue, 23 Aug 2016 17:18:07 +0000 (17:18 +0000)]
[CodeGen] Convert a loop to a for-each loop. NFC

llvm-svn: 279536

8 years agoFix some Clang-tidy modernize-use-using and Include What You Use warnings; other...
Eugene Zelenko [Tue, 23 Aug 2016 17:14:32 +0000 (17:14 +0000)]
Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.

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

llvm-svn: 279535

8 years ago[InstSimplify] add tests to show missing vector icmp folds
Sanjay Patel [Tue, 23 Aug 2016 17:13:38 +0000 (17:13 +0000)]
[InstSimplify] add tests to show missing vector icmp folds

llvm-svn: 279534

8 years agoChange the PathMappingList::FindFile to use FileSpec API's
Jim Ingham [Tue, 23 Aug 2016 17:13:33 +0000 (17:13 +0000)]
Change the PathMappingList::FindFile to use FileSpec API's

Also, when appending path components, collapse multiple "/" into one at the join.

llvm-svn: 279533

8 years ago[ThinLTO] Make sure the Context used for the ThinLTO backend has all the appropriate...
Mehdi Amini [Tue, 23 Aug 2016 16:53:34 +0000 (16:53 +0000)]
[ThinLTO] Make sure the Context used for the ThinLTO backend has all the appropriate options

An important performance setting on the LLVMContext for LTO is
enableDebugTypeODRUniquing(), this adds an automatic merging of
debug information in the context based on type ids.

Also, the lto::Config includes a diagnostic handler that needs to
be set on the Context, as well as the setDiscardValueNames() setting.

llvm-svn: 279532

8 years agoclang-cl: Accept MSVC 2015's `/source-charset:utf-8` flag.
Nico Weber [Tue, 23 Aug 2016 16:47:09 +0000 (16:47 +0000)]
clang-cl: Accept MSVC 2015's `/source-charset:utf-8` flag.

clang already treats all inputs as utf-8. Warn if anything but utf-8 is passed.

Do this by mapping source-charset to finput-charset, which already behaves like
this. Slightly tweak finput-charset to accept "utf-8" case-insensitively. This
matches gcc's and cl.exe's behavior, and IANA says that character set names are
case-insensitive.

https://reviews.llvm.org/D23807

llvm-svn: 279531

8 years ago[InstSimplify] move icmp with constant tests to another file; NFC
Sanjay Patel [Tue, 23 Aug 2016 16:46:53 +0000 (16:46 +0000)]
[InstSimplify] move icmp with constant tests to another file; NFC

...because like the corresponding code, this is just too big to keep adding to.
And the next step is to add a vector version of each of these tests to show
missed folds.

Also, auto-generate CHECK lines and add comments for the tests that correspond to
the source code.

llvm-svn: 279530

8 years ago[analyzer] Fix CloneDetector crash on calling methods of class templates.
Artem Dergachev [Tue, 23 Aug 2016 16:42:00 +0000 (16:42 +0000)]
[analyzer] Fix CloneDetector crash on calling methods of class templates.

If a call expression represents a method call of a class template,
and the method itself isn't templated, then the method may be considered
to be a template instantiation without template specialization arguments.

No longer crash when we could not find template specialization arguments.

Patch by Raphael Isemann!

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

llvm-svn: 279529

8 years agoFix some more asserts after r279466.
Pete Cooper [Tue, 23 Aug 2016 16:23:45 +0000 (16:23 +0000)]
Fix some more asserts after r279466.

That commit added a new version of Intrinsic::getName which should only
be called when the intrinsic has no overloaded types.  There are several
debugging paths, such as SDNode::dump which are printing the name of the
intrinsic but don't have the overloaded types.  These paths should be ok
to just print the name instead of crashing.

The fix here is ultimately to just add a 'None' second argument as that
calls the overload capable getName, which is less efficient, but this is a
debugging path anyway, and not perf critical.

Thanks to Björn Pettersson for pointing out that there were more crashes.

llvm-svn: 279528

8 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2dq & (v)cvttpd2dq intrins...
Simon Pilgrim [Tue, 23 Aug 2016 16:11:21 +0000 (16:11 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2dq & (v)cvttpd2dq intrinsics implicitly zeroes the upper half of the xmm

llvm-svn: 279527

8 years ago[Hexagon] Packetize return value setup with the return instruction
Krzysztof Parzyszek [Tue, 23 Aug 2016 16:01:01 +0000 (16:01 +0000)]
[Hexagon] Packetize return value setup with the return instruction

Commit r279241 unintentionally reverted that ability.

llvm-svn: 279526

8 years agoFix windows build failure
Xinliang David Li [Tue, 23 Aug 2016 16:00:54 +0000 (16:00 +0000)]
Fix windows build failure

llvm-svn: 279525

8 years agoRename unittests/ADT/ilistTest.cpp to ilistTestTemp.cpp (temporarily)
Duncan P. N. Exon Smith [Tue, 23 Aug 2016 15:56:50 +0000 (15:56 +0000)]
Rename unittests/ADT/ilistTest.cpp to ilistTestTemp.cpp (temporarily)

I'll rename this to IListTest.cpp after a waiting period (tonight?
tomorrow?), with a full explanation in that commit.

First, I'm moving it aside because Git doesn't play well with case-only
filename changes on case-insensitive file systems (and I suspect the
same is true of SVN).  This two-stage change should help to avoid
spurious failures on bots that don't do clean checkouts.

llvm-svn: 279524

8 years ago[Profile] refactor meta data copying/swapping code
Xinliang David Li [Tue, 23 Aug 2016 15:39:03 +0000 (15:39 +0000)]
[Profile] refactor meta data copying/swapping code

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

llvm-svn: 279523

8 years agoWork around PR29097 to get the module bots going again.
Adrian Prantl [Tue, 23 Aug 2016 15:38:59 +0000 (15:38 +0000)]
Work around PR29097 to get the module bots going again.
This replaces an =default constructor with an explicit definition.

llvm-svn: 279522

8 years ago[X86][AVX] Updated fptosi_2f64_to_4i32 test to show missed opportunity to implicit...
Simon Pilgrim [Tue, 23 Aug 2016 15:10:39 +0000 (15:10 +0000)]
[X86][AVX] Updated fptosi_2f64_to_4i32 test to show missed opportunity to implicit zero the upper elements

llvm-svn: 279521

8 years ago[X86][AVX] Add v2i32 fp to int conversion tests
Simon Pilgrim [Tue, 23 Aug 2016 15:00:52 +0000 (15:00 +0000)]
[X86][AVX] Add v2i32 fp to int conversion tests

llvm-svn: 279520

8 years ago[clang-tidy] Merge ExtraArgs(Before) instead of overriding them.
Alexander Kornienko [Tue, 23 Aug 2016 14:48:29 +0000 (14:48 +0000)]
[clang-tidy] Merge ExtraArgs(Before) instead of overriding them.

Added proper tests.

llvm-svn: 279519

8 years ago[X86][AVX] Add AVX2/AVX512 fp to int conversion tests
Simon Pilgrim [Tue, 23 Aug 2016 14:37:35 +0000 (14:37 +0000)]
[X86][AVX] Add AVX2/AVX512 fp to int conversion tests

llvm-svn: 279518

8 years ago[lanai] Use const instead of constexpr
Jacques Pienaar [Tue, 23 Aug 2016 14:36:53 +0000 (14:36 +0000)]
[lanai] Use const instead of constexpr

The windows build bot did not like constexpr.

llvm-svn: 279517

8 years ago[clang-tidy] Fix the order of ExtraArgsBefore
Alexander Kornienko [Tue, 23 Aug 2016 14:13:31 +0000 (14:13 +0000)]
[clang-tidy] Fix the order of ExtraArgsBefore

Added tests for the relative order of -extra-arg(-before) and ExtraArgs(Before).

llvm-svn: 279516

8 years agoFix SystemZ hang caused by r279105
Elliot Colp [Tue, 23 Aug 2016 14:03:02 +0000 (14:03 +0000)]
Fix SystemZ hang caused by r279105

The change in r279105 causes an infinite loop in some cases, as it sets the upper bits of an AND mask constant, which DAGCombiner::SimplifyDemandedBits then unsets.
This patch reverts that part of the behaviour, instead relying on .td peepholes to perform the transformation to NILL. I reapplied my original fix for the problem addressed by r279105 (unsetting the upper bits, which prevents a compiler abort for a different reason).

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

llvm-svn: 279515

8 years ago[LTOCodeGenerator] Reduce code duplication. NFCI.
Davide Italiano [Tue, 23 Aug 2016 12:32:57 +0000 (12:32 +0000)]
[LTOCodeGenerator] Reduce code duplication. NFCI.

llvm-svn: 279514

8 years agoFix a crash in GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins
Pavel Labath [Tue, 23 Aug 2016 12:10:09 +0000 (12:10 +0000)]
Fix a crash in GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins

The function was attempting to write the reply to the log even if the reply was empty.

llvm-svn: 279513

8 years agoFix API usage in TestMultithreaded.test_sb_api_listener_event_process_state
Pavel Labath [Tue, 23 Aug 2016 12:10:03 +0000 (12:10 +0000)]
Fix API usage in TestMultithreaded.test_sb_api_listener_event_process_state

The test was attempting to backtrace a process after every state change event (including the
"running", and "restarted" ones), which is not a good idea.

llvm-svn: 279512

8 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps intrinsics implicitly...
Simon Pilgrim [Tue, 23 Aug 2016 11:26:28 +0000 (11:26 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps intrinsics implicitly zeroes the upper half of the xmm

llvm-svn: 279511

8 years agoLLVMLanaDesc: Update libdesp.
NAKAMURA Takumi [Tue, 23 Aug 2016 10:47:40 +0000 (10:47 +0000)]
LLVMLanaDesc: Update libdesp.

llvm-svn: 279510

8 years agoChange the target's name, s/LanaiMCTargetDesc/LanaiDesc/g.
NAKAMURA Takumi [Tue, 23 Aug 2016 10:43:01 +0000 (10:43 +0000)]
Change the target's name, s/LanaiMCTargetDesc/LanaiDesc/g.

"AllTargetsDescs" in llvm-mc/CMakeLists.txt expects not ${target}MCTargetDesc, but ${target}Desc.

llvm-svn: 279509

8 years ago[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps implicitly zeroes...
Simon Pilgrim [Tue, 23 Aug 2016 10:35:24 +0000 (10:35 +0000)]
[X86][SSE] Demonstrate inability to recognise that (v)cvtpd2ps implicitly zeroes the upper half of the xmm

llvm-svn: 279508

8 years ago[clang-tidy] readability-non-const-parameter: add new check that warns when function...
Daniel Marjamaki [Tue, 23 Aug 2016 10:09:08 +0000 (10:09 +0000)]
[clang-tidy] readability-non-const-parameter: add new check that warns when function parameters should be const

The check will warn when the constness will make the function interface safer.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 279507

8 years ago[ARM] Generate consistent frame records for Thumb2
Oliver Stannard [Tue, 23 Aug 2016 09:19:22 +0000 (09:19 +0000)]
[ARM] Generate consistent frame records for Thumb2

There is not an official documented ABI for frame pointers in Thumb2,
but we should try to emit something which is useful.

We use r7 as the frame pointer for Thumb code, which currently means
that if a function needs to save a high register (r8-r11), it will get
pushed to the stack between the frame pointer (r7) and link register
(r14). This means that while a stack unwinder can follow the chain of
frame pointers up the stack, it cannot know the offset to lr, so does
not know which functions correspond to the stack frames.

To fix this, we need to push the callee-saved registers in two batches,
with the first push saving the low registers, fp and lr, and the second
push saving the high registers. This is already implemented, but
previously only used for iOS. This patch turns it on for all Thumb2
targets when frame pointers are required by the ABI, and the frame
pointer is r7 (Windows uses r11, so this isn't a problem there). If
frame pointer elimination is enabled we still emit a single push/pop
even if we need a frame pointer for other reasons, to avoid increasing
code size.

We must also ensure that lr is pushed to the stack when using a frame
pointer, so that we end up with a complete frame record. Situations that
could cause this were rare, because we already push lr in most
situations so that we can return using the pop instruction.

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

llvm-svn: 279506

8 years ago[TSan][MIPS] Changes mips memory layout to support pie with address space randomization.
Sagar Thakur [Tue, 23 Aug 2016 08:15:25 +0000 (08:15 +0000)]
[TSan][MIPS] Changes mips memory layout to support pie with address space randomization.

Reviewed by dvyukov
Differential: D23644

llvm-svn: 279505

8 years agoGVNHoist: Use the pass version of MemorySSA and preserve it.
Daniel Berlin [Tue, 23 Aug 2016 05:42:41 +0000 (05:42 +0000)]
GVNHoist: Use the pass version of MemorySSA and preserve it.

Summary: GVNHoist: Use the pass version of MemorySSA and preserve it.

Reviewers: sebpop, george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 279504

8 years agoRevert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove MachineFunctionA...
Matthias Braun [Tue, 23 Aug 2016 05:17:11 +0000 (05:17 +0000)]
Revert "(HEAD -> master, origin/master, origin/HEAD) CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses"

Reverting while tracking down a use after free.

This reverts commit r279502.

llvm-svn: 279503

8 years agoCodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses
Matthias Braun [Tue, 23 Aug 2016 03:20:09 +0000 (03:20 +0000)]
CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses

This patch removes the MachineFunctionAnalysis. Instead we keep a
map from IR Function to MachineFunction in the MachineModuleInfo.

This allows the insertion of ModulePasses into the codegen pipeline
without breaking it because the MachineFunctionAnalysis gets dropped
before a module pass.

Peak memory should stay unchanged without a ModulePass in the codegen
pipeline: Previously the MachineFunction was freed at the end of a codegen
function pipeline because the MachineFunctionAnalysis was dropped; With
this patch the MachineFunction is freed after the AsmPrinter has
finished.

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

llvm-svn: 279502

8 years ago[asan] Fix OOB_char on arm 32bit
Vitaly Buka [Tue, 23 Aug 2016 02:58:12 +0000 (02:58 +0000)]
[asan] Fix OOB_char on arm 32bit

Summary:
This does not actually fixes the test.
AddressSanitizer::OOB_char behavior is inconsistent but it somehow usually
works. On arm it runs more iterations than expected. And adding a new test with AddressSanitizerInterface prefix, even empty, somehow breaks OOB_char test.
So I will rename my test to make the bot green and will continue to investigate the test.

Reviewers: krasin

Subscribers: aemerson, rengolin, kubabrecka, llvm-commits, samparker

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

llvm-svn: 279501

8 years agoRevert r279486 "Fix regression introduced by r279164"
Chandler Carruth [Tue, 23 Aug 2016 02:00:51 +0000 (02:00 +0000)]
Revert r279486 "Fix regression introduced by r279164"

Build bots seem unhappy and as Richard was leaving he asked me to revert
this for him. Doing so.

llvm-svn: 279500

8 years agoBranchRelaxation: Fix handling of blocks with multiple conditional
Matt Arsenault [Tue, 23 Aug 2016 01:30:30 +0000 (01:30 +0000)]
BranchRelaxation: Fix handling of blocks with multiple conditional
branches

Looping over all terminators exposed AArch64 tests hitting
an assert from analyzeBranch failing. I believe these cases
were miscompiled before.

e.g.
  fcmp s0, s1
  b.ne LBB0_1
  b.vc LBB0_2
  b LBB0_2
LBB0_1:
  ; Large block
LBB0_2:
 ; ...

Both of the individual conditional branches need to
be expanded, since neither can reach the final block.

Split the original block into ones which analyzeBranch
will be able to understand.

llvm-svn: 279499

8 years ago[lanai] Make Lanai backend non-experimental
Jacques Pienaar [Tue, 23 Aug 2016 01:06:44 +0000 (01:06 +0000)]
[lanai] Make Lanai backend non-experimental

Summary:
Add Lanai backend to default targets.

Discussion of proposal: http://lists.llvm.org/pipermail/llvm-dev/2016-July/102480.html. ISA added in r279149.

Reviewers: jyknight, rengolin, eliben, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 279498

8 years ago[lanai] Exit early in Mem Alu combiner if sentinel reach.
Jacques Pienaar [Tue, 23 Aug 2016 01:04:41 +0000 (01:04 +0000)]
[lanai] Exit early in Mem Alu combiner if sentinel reach.

LanaiMemAluCombiner could try to query the debug value of a list sentinel. Add check to exit early instead.

llvm-svn: 279497

8 years ago[builtins] Don't always use -ffreestanding when compiling builtins
Francis Ricci [Tue, 23 Aug 2016 00:49:03 +0000 (00:49 +0000)]
[builtins] Don't always use -ffreestanding when compiling builtins

This can break on some sysroots. Let the user define it if necessary.

llvm-svn: 279496

8 years ago[sanitizer] allocator: split the local cache class into two, one for 32-bit allocator...
Kostya Serebryany [Tue, 23 Aug 2016 00:30:43 +0000 (00:30 +0000)]
[sanitizer] allocator: split the local cache class into two, one for 32-bit allocator and one for 64-bit one. NFC. The two imlementations will diverge in the following changes.

llvm-svn: 279495

8 years agoFix style in some Clang-tidy checks documentation.
Eugene Zelenko [Tue, 23 Aug 2016 00:19:43 +0000 (00:19 +0000)]
Fix style in some Clang-tidy checks documentation.

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

llvm-svn: 279494

8 years ago[MemorySSA] Remove unused field. NFC.
George Burgess IV [Mon, 22 Aug 2016 23:40:01 +0000 (23:40 +0000)]
[MemorySSA] Remove unused field. NFC.

Given that we're not currently using blocker info, and whether or not we
will end up using it it is unclear, don't waste 8 (or 4) bytes of memory
per path node.

llvm-svn: 279493

8 years ago[InstSimplify] add helper function for SimplifyICmpInst(); NFCI
Sanjay Patel [Mon, 22 Aug 2016 23:12:02 +0000 (23:12 +0000)]
[InstSimplify] add helper function for SimplifyICmpInst(); NFCI

And add a FIXME because the helper excludes folds for vectors. It's
not clear yet how many of these are actually testable (and therefore
necessary?) because later analysis uses computeKnownBits and other
methods to catch many of these cases.

llvm-svn: 279492

8 years agoTypo.
Adrian Prantl [Mon, 22 Aug 2016 22:38:18 +0000 (22:38 +0000)]
Typo.

llvm-svn: 279491

8 years agoAdd comments. NFC
Adrian Prantl [Mon, 22 Aug 2016 22:38:16 +0000 (22:38 +0000)]
Add comments. NFC

llvm-svn: 279490

8 years agoAdd the second half of the testcase I should have added in 279485.
Adrian Prantl [Mon, 22 Aug 2016 22:30:34 +0000 (22:30 +0000)]
Add the second half of the testcase I should have added in 279485.

llvm-svn: 279489

8 years agoMigrate from NodeType * to NodeRef.
Tim Shen [Mon, 22 Aug 2016 22:30:27 +0000 (22:30 +0000)]
Migrate from NodeType * to NodeRef.

llvm-svn: 279488

8 years agoFix crash from assert in r279466.
Pete Cooper [Mon, 22 Aug 2016 22:27:05 +0000 (22:27 +0000)]
Fix crash from assert in r279466.

The assert in r279466 checks that we call the correct version of
Intrinsic::getName.  The version which accepts only an ID should not
be used for intrinsics with overloaded types.  The global-isel
code was calling the wrong version.  The test CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
will ensure that we call the correct version from now on.

llvm-svn: 279487

8 years agoFix regression introduced by r279164: only pass definitions as the PatternDef
Richard Smith [Mon, 22 Aug 2016 22:25:03 +0000 (22:25 +0000)]
Fix regression introduced by r279164: only pass definitions as the PatternDef
to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly
determine whether a function definition is visible, and mark both the function
and the template as visible when merging function template definitions to
provide hasVisibleDefinition with the relevant information.

The change to always pass the right declaration as the PatternDef to
DiagnoseUninstantiableTemplate also caused those checks to happen before other
diagnostics in InstantiateFunctionDefinition, giving worse diagnostics for the
same situations, so I sunk the relevant diagnostics into
DiagnoseUninstantiableTemplate. Those parts of this patch are based on changes
in reviews.llvm.org/D23492 by Vassil Vassilev.

llvm-svn: 279486

8 years agoModule debug info: Don't assert when encountering an incomplete definition
Adrian Prantl [Mon, 22 Aug 2016 22:23:58 +0000 (22:23 +0000)]
Module debug info: Don't assert when encountering an incomplete definition
in isDefinedInClangModule() and assume that the incomplete definition
is not defined in the module.

This broke the -gmodules self host recently.
rdar://problem/27894367

llvm-svn: 279485

8 years agoADT: Separate some list manipulation API into ilist_base, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 22:21:07 +0000 (22:21 +0000)]
ADT: Separate some list manipulation API into ilist_base, NFC

Separate algorithms in iplist<T> that don't depend on T into ilist_base,
and unit test them.

While I was adding unit tests for these algorithms anyway, I also added
unit tests for ilist_node_base and ilist_sentinel<T>.

To make the algorithms and unit tests easier to write, I also did the
following minor changes as a drive-by:
- encapsulate Prev/Next in ilist_node_base to so that algorithms are
  easier to read, and
- update ilist_node_access API to take nodes by reference.

There should be no real functionality change here.

llvm-svn: 279484

8 years agoFix header comment for unittests/ADT/ilistTest.cpp
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 22:04:16 +0000 (22:04 +0000)]
Fix header comment for unittests/ADT/ilistTest.cpp

llvm-svn: 279483

8 years ago[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.
Tim Shen [Mon, 22 Aug 2016 21:59:26 +0000 (21:59 +0000)]
[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.

Summary: Before the change, *Opt never actually gets updated by the end
of toNext(), so for every next time the loop has to start over from
child_begin(). This bug doesn't affect the correctness, since Visited prevents
it from re-entering the same node again; but it's slow.

Reviewers: dberris, dblaikie, dannyb

Subscribers: llvm-commits

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

llvm-svn: 279482

8 years ago[SemaObjC] Do not RebuildObjCMessageExpr without valid method decl
Bruno Cardoso Lopes [Mon, 22 Aug 2016 21:50:22 +0000 (21:50 +0000)]
[SemaObjC] Do not RebuildObjCMessageExpr without valid method decl

Fix crash-on-invalid in ObjC Sema by avoiding to rebuild a message
expression to a 'super' class in case the method to call does not exist
(i.e. comes from another missing identifier).

In this case, the typo transform is invoked upon the message expression
in an attempt to solve a typo in a 'super' call parameters, but it
crashes since it assumes the method to call has a valid declaration.

rdar://problem/27305403

llvm-svn: 279481

8 years agoAdd support for '|' in expressions.
Rafael Espindola [Mon, 22 Aug 2016 21:33:35 +0000 (21:33 +0000)]
Add support for '|' in expressions.

llvm-svn: 279480

8 years ago[AST] Remove unused function, to silence a GCC7 warning.
Davide Italiano [Mon, 22 Aug 2016 21:33:12 +0000 (21:33 +0000)]
[AST] Remove unused function, to silence a GCC7 warning.

llvm-svn: 279479

8 years ago[InstCombine] change param type from Instruction to BinaryOperator for icmp helpers...
Sanjay Patel [Mon, 22 Aug 2016 21:24:29 +0000 (21:24 +0000)]
[InstCombine] change param type from Instruction to BinaryOperator for icmp helpers; NFCI

This saves some casting in the helper functions and eases some further refactoring.

llvm-svn: 279478

8 years ago[GraphTraits] Replace all NodeType usage with NodeRef
Tim Shen [Mon, 22 Aug 2016 21:09:30 +0000 (21:09 +0000)]
[GraphTraits] Replace all NodeType usage with NodeRef

This should finish the GraphTraits migration.

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

llvm-svn: 279475

8 years agoADT: Remove ilist_*sentinel_traits, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 20:51:00 +0000 (20:51 +0000)]
ADT: Remove ilist_*sentinel_traits, NFC

Remove all the dead code around ilist_*sentinel_traits.  This is a
follow-up to gutting them as part of r279314 (originally r278974),
staged to prevent broken builds in sub-projects.

Uses were removed from clang in r279457 and lld in r279458.

llvm-svn: 279473

8 years ago[InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat constant...
Sanjay Patel [Mon, 22 Aug 2016 20:45:06 +0000 (20:45 +0000)]
[InstCombine] use m_APInt to allow icmp (shr exact X, Y), 0 folds for splat constant vectors

llvm-svn: 279472

8 years agoAdd ADT headers to the cmake headers directory for LLVMSupport. NFC.
Pete Cooper [Mon, 22 Aug 2016 20:38:53 +0000 (20:38 +0000)]
Add ADT headers to the cmake headers directory for LLVMSupport.  NFC.

Xcode and MSVC list the headers and source files for each library.

LLVMSupport lists included the source files for ADT but not the headers.  This
add the ADT headers so that they are browsable by the UI.

llvm-svn: 279470

8 years ago[compiler-rt] Use flags found when configuring builtins during compilation
Francis Ricci [Mon, 22 Aug 2016 20:33:47 +0000 (20:33 +0000)]
[compiler-rt] Use flags found when configuring builtins during compilation

Summary: This fixes the omission of -fPIC when building the builtins.

Reviewers: compnerd, beanz

Subscribers: dberris, llvm-commits

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

llvm-svn: 279469

8 years ago[compiler-rt] Don't build ubsan cxxabi sources when unused
Francis Ricci [Mon, 22 Aug 2016 20:27:21 +0000 (20:27 +0000)]
[compiler-rt] Don't build ubsan cxxabi sources when unused

Summary:
On apple targets, when SANITIZER_CAN_USE_CXXABI is false,
the ubsan cxxabi sources aren't built, since they're unused.
Do this on non-apple targets as well.

This fixes errors when linking sanitizers if c++ abi is
unavailable.

Reviewers: pcc, kubabrecka, beanz

Subscribers: rnk, llvm-commits, kubabrecka, compnerd, dberris

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

llvm-svn: 279467

8 years agoAdd comments and an assert to follow-up on r279113. NFC.
Pete Cooper [Mon, 22 Aug 2016 20:18:28 +0000 (20:18 +0000)]
Add comments and an assert to follow-up on r279113.  NFC.

Philip commented on r279113 to ask for better comments as to
when to use the different versions of getName.  Its also possible
to assert in the simple case that we aren't an overloaded intrinsic
as those have to use the more capable version of getName.

Thanks for the comments Philip.

llvm-svn: 279466

8 years agoIDFCalculator: Remove unused field.
Daniel Berlin [Mon, 22 Aug 2016 19:52:23 +0000 (19:52 +0000)]
IDFCalculator: Remove unused field.

llvm-svn: 279465

8 years agoAMDGPU: Split SILowerControlFlow into two pieces
Matt Arsenault [Mon, 22 Aug 2016 19:33:16 +0000 (19:33 +0000)]
AMDGPU: Split SILowerControlFlow into two pieces

Do most of the lowering in a pre-RA pass. Keep the skip jump
insertion late, plus a few other things that require more
work to move out.

One concern I have is now there may be COPY instructions
which do not have the necessary implicit exec uses
if they will be lowered to v_mov_b32.

This has a positive effect on SGPR usage in shader-db.

llvm-svn: 279464

8 years agoAMDGPU: Handle structs directly in AMDGPUABIInfo
Matt Arsenault [Mon, 22 Aug 2016 19:25:59 +0000 (19:25 +0000)]
AMDGPU: Handle structs directly in AMDGPUABIInfo

Structs are currently handled as pointer + byval, which makes AMDGPU
LLVM backend generate incorrect code when structs are used. This patch
changes struct argument to be handled directly and without flattening,
which Clover (Mesa 3D Gallium OpenCL state tracker) will be able to
handle. Flattening would expand the struct to individual elements and
pass each as a separate argument, which Clover can not
handle. Furthermore, such expansion does not fit the OpenCL
programming model which requires to explicitely specify each argument
index, size and memory location.

Patch by Vedran Miletić

llvm-svn: 279463

8 years agoMSSA: Factor out phi node placement
Daniel Berlin [Mon, 22 Aug 2016 19:14:30 +0000 (19:14 +0000)]
MSSA: Factor out phi node placement

llvm-svn: 279462

8 years agoMSSA: Only rename accesses whose defining access is nullptr
Daniel Berlin [Mon, 22 Aug 2016 19:14:16 +0000 (19:14 +0000)]
MSSA: Only rename accesses whose defining access is nullptr

llvm-svn: 279461

8 years ago[SimplifyCFG] Rewrite SinkThenElseCodeToEnd
James Molloy [Mon, 22 Aug 2016 19:07:15 +0000 (19:07 +0000)]
[SimplifyCFG] Rewrite SinkThenElseCodeToEnd

[Recommitting now an unrelated assertion in SROA is sorted out]

The new version has several advantages:
  1) IMSHO it's more readable and neater
  2) It handles loads and stores properly
  3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.

With this change we can now finally sink load-modify-store idioms such as:

    if (a)
      return *b += 3;
    else
      return *b += 4;

    =>

    %z = load i32, i32* %y
    %.sink = select i1 %a, i32 5, i32 7
    %b = add i32 %z, %.sink
    store i32 %b, i32* %y
    ret i32 %b

When this works for switches it'll be even more powerful.

Round 4. This time we should handle all instructions correctly, and not replace any operands that need to be constant with variables.

This was really hard to determine safely, so the helper function should be put into the Instruction API. I'll do that as a followup.

llvm-svn: 279460

8 years ago[ELF] Only print symbol name when it is available
Petr Hosek [Mon, 22 Aug 2016 19:01:53 +0000 (19:01 +0000)]
[ELF] Only print symbol name when it is available

Not only symbols (like sections) have names, in case where we
fail to create relocation against such symbol, we should not
print out an empty string, instead we should print a generic
message.

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

llvm-svn: 279459

8 years agoADT: Remove uses of ilist_*sentinel_traits, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 18:59:33 +0000 (18:59 +0000)]
ADT: Remove uses of ilist_*sentinel_traits, NFC

llvm-svn: 279458

8 years agoADT: Remove uses of ilist_*sentinel_traits, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 18:57:44 +0000 (18:57 +0000)]
ADT: Remove uses of ilist_*sentinel_traits, NFC

llvm-svn: 279457

8 years ago[ELF] ICF should respect section alignment
Petr Hosek [Mon, 22 Aug 2016 18:53:09 +0000 (18:53 +0000)]
[ELF] ICF should respect section alignment

When performing ICF, we have to respect the alignment requirement
of each section within each group.

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

llvm-svn: 279456

8 years ago[CUDA] Collapsed offload actions should not be top-level jobs.
Artem Belevich [Mon, 22 Aug 2016 18:50:34 +0000 (18:50 +0000)]
[CUDA] Collapsed offload actions should not be top-level jobs.

If they are, we end up with the last intermediary output preserved
in the current directory after compilation.

Added a test case to verify that we're using appropriate filenames
for outputs of different phases.

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

llvm-svn: 279455

8 years ago[SROA] Remove incorrect assertion
James Molloy [Mon, 22 Aug 2016 18:49:42 +0000 (18:49 +0000)]
[SROA] Remove incorrect assertion

Confirmed with aprantl, this assertion is incorrect - code can get here (for example 80-bit FP types) and if it does it's benign. This is exposed by a completely unrelated patch of mine, so stop the compiler falling over.

Original differential: http://reviews.llvm.org/D16187
aprantl's advice to remove assertion: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/382129.html

llvm-svn: 279454

8 years agoAdd missing include that caused a test failure on Windows. Thanks to STL for the...
Marshall Clow [Mon, 22 Aug 2016 18:45:31 +0000 (18:45 +0000)]
Add missing include that caused a test failure on Windows. Thanks to STL for the patch. No functional change.

llvm-svn: 279453

8 years ago[ELF] Define __ehdr_start symbol
Petr Hosek [Mon, 22 Aug 2016 18:44:04 +0000 (18:44 +0000)]
[ELF] Define __ehdr_start symbol

This symbol can be used by the program to examine its own headers.

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

llvm-svn: 279452

8 years ago[compiler-rt] Make cxxabi availability configurable in cmake
Francis Ricci [Mon, 22 Aug 2016 18:31:37 +0000 (18:31 +0000)]
[compiler-rt] Make cxxabi availability configurable in cmake

Summary:
Allow for use of cxxabi to be disabled from cmake.

This will make sanitizers usable when c++ abi is unavailable.

Reviewers: pcc, rnk, samsonov, beanz, compnerd

Subscribers: llvm-commits, compnerd, dberris

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

llvm-svn: 279451

8 years ago[cmake] Fix append_rtti_flag macro and bad var name
Filipe Cabecinhas [Mon, 22 Aug 2016 18:30:37 +0000 (18:30 +0000)]
[cmake] Fix append_rtti_flag macro and bad var name

llvm-svn: 279450

8 years ago[SSP] Do not set __guard_local to hidden for OpenBSD SSP
Tim Shen [Mon, 22 Aug 2016 18:26:27 +0000 (18:26 +0000)]
[SSP] Do not set __guard_local to hidden for OpenBSD SSP

__guard_local is defined as long on OpenBSD. If the source file contains
a definition of __guard_local, it mismatches with the int8 pointer type
used in LLVM. In that case, Module::getOrInsertGlobal() returns a
cast operation instead of a GlobalVariable. Trying to set the
visibility on the cast operation leads to random segfaults (seen when
compiling the OpenBSD kernel, which also runs with stack protection).

In the kernel, the hidden attribute does not matter. For userspace code,
__guard_local is defined as hidden in the startup code. If a program
re-defines __guard_local, the definition from the startup code will
either win or the linker complains about multiple definitions
(depending on whether the re-defined __guard_local is placed in the
common segment or not).

It also matches what gcc on OpenBSD does.

Thanks Stefan Kempf <sisnkemp@gmail.com> for the patch!

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

llvm-svn: 279449

8 years ago[InstCombine] Allow sinking from unique predecessor with multiple edges
Jun Bum Lim [Mon, 22 Aug 2016 18:21:56 +0000 (18:21 +0000)]
[InstCombine] Allow sinking from unique predecessor with multiple edges

Summary: We can allow sinking if the single user block has only one unique predecessor, regardless of the number of edges. Note that a switch statement with multiple cases can have the same destination.

Reviewers: mcrosier, majnemer, spatel, reames

Subscribers: reames, mcrosier, llvm-commits

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

llvm-svn: 279448

8 years agoRevert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"
James Molloy [Mon, 22 Aug 2016 18:13:12 +0000 (18:13 +0000)]
Revert "[SimplifyCFG] Rewrite SinkThenElseCodeToEnd"

This reverts commit r279443. It caused buildbot failures.

llvm-svn: 279447