130949 Commits

Author SHA1 Message Date
Quentin Colombet
7ec26d4fef [MachineInstrBundle] Actually set the PartialDeadDef flag only when the register
is defined!

The users were checking the proper thing (Defined + PartialDeadDef), but the
information may have been wrong for other use cases, so fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:16:29 +00:00
Quentin Colombet
820df98fdc [MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.
I missed read the comment when I commited r267621 and thought the
comment did not need update. Matthias kindly proved me wrong.
Fixing that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:55:41 +00:00
Andrew Kaylor
5225ed2081 Add optimization bisect opt-in calls for SystemZ passes
Differential Revision: http://reviews.llvm.org/D19562



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267636 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:49:41 +00:00
Andrew Kaylor
347552aa8a Add optimization bisect opt-in calls for NVPTX passes
Differential Revision: http://reviews.llvm.org/D19518



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267635 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:44:31 +00:00
Quentin Colombet
ba357d2f7b [X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue.

Do not use basic blocks that have EFLAGS live-in as prologue if we need
to realign the stack. Realigning the stack uses AND instruction and this
clobbers EFLAGS.

An other alternative would have been to save and restore EFLAGS around
the stack realignment code, but this is likely inefficient.

Fixes PR27531.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:44:14 +00:00
Justin Bogner
c943cfacc2 PM: Port Reassociate to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267631 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:39:29 +00:00
Mitch Bodart
573cbb5e7b [X86] Replace -mcpu with -mattr in several tests
Differential Revision: http://reviews.llvm.org/D19568


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267629 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:36:38 +00:00
Justin Bogner
b7e074989d Reassociate: Convert another functor into a lambda. NFC
Also move the explanatory comment with it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:32:00 +00:00
Philip Reames
aa06cc178a [LVI] Cut short search if we know we can't return a useful result
Previously we were recursing on our operands for unary and binary operators regardless of whether we knew how to reason about the operator in question.  This has the effect of doing a potentially large amount of work, only to throw it away.  By checking whether the operation is one LVI can handle, we can cut short the search and return the (overdefined) answer more quickly.  The quality of the results produced should not change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:27:33 +00:00
Sanjay Patel
b4a90e614d [SimplifyCFG] propagate branch metadata when creating select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:15:48 +00:00
Quentin Colombet
316e8d944d [X86] Teach the expansion of copy instructions how to do proper liveness.
When the simple analysis provided by MachineBasicBlock::computeRegisterLiveness
fails, fall back on the LivePhysReg utility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267623 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:32 +00:00
Quentin Colombet
1b369e43d3 [MachineBasicBlock] Take advantage of the partially dead information.
Thanks to that information we wouldn't lie on a register being live whereas it
is not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:29 +00:00
Quentin Colombet
b62e24784c [MachineInstrBundle] Improvement the recognition of dead definitions.
Now, it is possible to know that partial definitions are dead definitions and
recognize that clobbered registers are also dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:24 +00:00
Philip Reames
5fcdfef145 [LVI] Apply transfer rule for overdefine inputs for binary operators
As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules.  Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined.  This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch builds on 267609 which did the same thing for unary casts.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:10:35 +00:00
Jingyue Wu
ab87c34c6a [NVPTX] Fix some usages of CodeGenOpt::None.
NVPTXLowerKernelArgs is required for correctness, so it should not be guarded
by CodeGenOpt::None.

NVPTXPeephole is optimization only, so it should be skipped when
CodeGenOpt::None.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:59:25 +00:00
Philip Reames
171bf70598 [LVI] A better fix for the assertion error introduced by 267609
Essentially, I was using the wrong size function.  For types which were sized, but not primitive, I wasn't getting a useful size for the operand and failed an assert.  I fixed this, and also added a guard that the input is a sized type.  Test case is for the original mistake.  I'm not sure how to actually exercise the sized type check.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267618 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:52:30 +00:00
Philip Reames
1f6f783d9c [LVI] Speculative fix for assertion seen in clang bots
I'll clean this up and add a test case shortly.  I want to make sure this does actually fix the bots; if not, I'll revert.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267617 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:31:53 +00:00
Sanjay Patel
d926422b16 [LowerExpectIntrinsic] make default likely/unlikely ratio bigger
We need the default ratio to be sufficiently large that it triggers transforms 
based on block frequency info (BFI) and plays well with the recently introduced
BranchProbability used by CGP.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267615 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:23:38 +00:00
Justin Bogner
7fd37fa92d Reassociate: Simplify using lambdas. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267614 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:22:18 +00:00
Philip Reames
7f3fd5dcbd [LVI] Infer local facts from unary expressions
As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules. Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined. This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch implements only the unary operation case. Once this is in, I'll implement the same for the binary operations.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:48:16 +00:00
Andrew Kaylor
a5c0577492 Optimization bisect support in X86-specific passes
Differential Revision: http://reviews.llvm.org/D19439



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:44:24 +00:00
Ahmed Bougacha
fb52dfa04d [CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.
Differential Revision: http://reviews.llvm.org/D17176

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:15:30 +00:00
David Majnemer
de19e3a88c Revert "[SimplifyLibCalls] sprintf doesn't copy null bytes"
The destination buffer that sprintf uses is restrict qualified, we do
not need to worry about derived pointers referenced via format
specifiers.

This reverts commit r267580.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:04:47 +00:00
Nico Weber
45ba8e9827 Try to get ResponseFile.ll passing on Windows after r267556.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:32:51 +00:00
Zachary Turner
460e256b9c Remove more unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:32:35 +00:00
Elena Demikhovsky
b7f92d0916 Masked Store in Loop Vectorizer - bugfix
Fixed a bug in loop vectorization with conditional store.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:18:04 +00:00
Justin Bogner
c3ce5d9c39 PM: Port Internalize to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267596 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:15:52 +00:00
Zachary Turner
1330a1c343 [llvm-pdbdump] Fix version reading on big endian systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:48:18 +00:00
Andrew Kaylor
650fa7d863 Add optimization bisect opt-in calls for Hexagon passes
Differential Revision: http://reviews.llvm.org/D19509



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:46:28 +00:00
Zachary Turner
cff4949683 Fix warnings and -Werror build on clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:24:10 +00:00
Zachary Turner
3784bf85f3 Parse and dump PDB DBI Stream Header Information
The DBI stream contains a lot of bookkeeping information for other
streams. In particular it contains information about section contributions
and linked modules. This patch is a first attempt at parsing some of the
information out of the DBI stream. It currently only parses and dumps the
headers of the DBI stream, so none of the module data or section
contribution data is pulled out.

This is just a proof of concept that we understand the basic properties of
the DBI stream's metadata, and followup patches will try to extract more
detailed information out.

Differential Revision: http://reviews.llvm.org/D19500
Reviewed By: majnemer, ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:42:34 +00:00
Krzysztof Parzyszek
87d4b8c4a1 [Tail duplication] Handle source registers with subregisters
When a block is tail-duplicated, the PHI nodes from that block are
replaced with appropriate COPY instructions. When those PHI nodes
contained use operands with subregisters, the subregisters were
dropped from the COPY instructions, resulting in incorrect code.

Keep track of the subregister information and use this information
when remapping instructions from the duplicated block.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:36:34 +00:00
Tim Northover
3005d0caa4 Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""
A latent bug in llvm-objdump used the wrong format specifier on 32-bit
targets, causing the test to fail. This fixes the issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:29:16 +00:00
Justin Bogner
a536c7fedf Internalize: More consistent file header and include guards. NFC
Match the style here to the other headers in Transforms/IPO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:25:30 +00:00
David Majnemer
783db05d7b [SimplifyLibCalls] sprintf doesn't copy null bytes
sprintf doesn't read or copy the terminating null byte from it's string
operands.  sprintf will append it's own after processing all of the
format specifiers.

This fixes PR27526.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:16:49 +00:00
Manman Ren
a80d09e041 Swift Calling Convention: use %RAX for sret.
We don't need to copy the sret argument into %rax upon return.
rdar://25671494


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267579 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:08:06 +00:00
Saleem Abdulrasool
d632f4772e tests: tweak MIR for ARM tests to correct MI issues
The Machine Instruction Verifier flagged some issues in the serialized MIR.
Adjust the input to correct them.

Fixes the remaining portion of PR27480.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 17:54:21 +00:00
Saleem Abdulrasool
6568fd1d99 test: remove some bleeding whitespace
Kill bleeding whitespace.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267577 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 17:54:16 +00:00
Konstantin Zhuravlyov
5027779819 [AMDGPU] Move reserved vgpr count for trap handler usage to SIMachineFunctionInfo + minor commenting changes
Differential Revision: http://reviews.llvm.org/D19537


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 17:24:40 +00:00
Sanjay Patel
6f5aa79cda [CodeGenPrepare] use branch weight metadata to decide if a select should be turned into a branch
This is part of solving PR27344:
https://llvm.org/bugs/show_bug.cgi?id=27344

CGP should undo the SimplifyCFG transform for the same reason that earlier patches have used this
same mechanism: it's possible that passes between SimplifyCFG and CGP may be able to optimize the
IR further with a select in place.

For the TLI hook default, >99% taken or not taken is chosen as the default threshold for a highly
predictable branch. Even the most limited HW branch predictors will be correct on this branch almost
all the time, so even a massive mispredict penalty perf loss would be overcome by the win from all
the times the branch was predicted correctly.

As a follow-up, we could make the default target hook less conservative by using the SchedMachineModel's
MispredictPenalty. Or we could just let targets override the default by implementing the hook with that
and other target-specific options. Note that trying to statically determine mispredict rates for 
close-to-balanced profile weight data is generally impossible if the HW is sufficiently advanced. Ie, 
50/50 taken/not-taken might still be 100% predictable.

Finally, note that this patch as-is will not solve PR27344 because the current __builtin_unpredictable()
branch weight default values are 4 and 64. A proposal to change that is in D19435.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267572 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 17:11:17 +00:00
Zachary Turner
c81ec9b2de Fix build broken due to order of initialization problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 16:57:53 +00:00
Zachary Turner
5571fd88f1 Refactor some more PDB reading code into DebugInfoPDB.
Differential Revision: http://reviews.llvm.org/D19445
Reviewed By: David Majnemer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 16:20:00 +00:00
Konstantin Zhuravlyov
d714ad3a0f [AMDGPU] Reserve VGPRs for trap handler usage if instructed
Differential Revision: http://reviews.llvm.org/D19235


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 15:43:14 +00:00
Nico Weber
87b2f2af11 Use gcc's rules for parsing gcc-style response files
In gcc, \ escapes every character in response files. It is true that this makes
it harder to mention Windows files in rsp files, but not doing this means clang
disagrees with gcc, and also disagrees with the shell (on non-Windows) which
rsp file quoting is supposed to match. clang isn't free to choose what to do
here.

In general, the idea for response files is to take bits of your command line
and write them to a file unchanged, and have things work the same way. Since
the command line would've been interpreted by the shell, things in the rsp file
need to be subject to the same shell quoting rules.

People who want to put Windows-style paths in their response files either need
to do any of:
* escape their backslashes
* or use clang-cl which uses cl.exe/cmd.exe quoting rules
* pass --rsp-quoting=windows to clang to tell it to use
  cl.exe/cmd.exe quoting rules for response files.

Fixes PR27464.
http://reviews.llvm.org/D19417


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 13:53:56 +00:00
Sam Kolton
3ca62aa938 [AMDGPU] Assembler: basic support for SDWA instructions
Support for SDWA instructions for VOP1 and VOP2 encoding.
Not done yet:
  - converters for support optional operands and modifiers
  - VOPC
  - sext() modifier
  - intrinsics
  - VOP2b (see vop_dpp.s)
  - V_MAC_F32 (see vop_dpp.s)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 13:33:56 +00:00
Andrey Turetskiy
8ddb8b4b8d [X86] PR27502: Fix the LEA optimization pass.
Handle MachineBasicBlock as a memory displacement operand in the LEA optimization pass.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 12:18:12 +00:00
Marcin Koscielnicki
314a1b6403 [Sparc] Fix build error introduced by rL267545.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 10:43:47 +00:00
Marcin Koscielnicki
adc800c659 [PowerPC] Add support for llvm.thread.pointer
Differential Revision: http://reviews.llvm.org/D19304

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267546 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 10:37:22 +00:00
Marcin Koscielnicki
eb83c9c595 [SPARC] [SSP] Add support for LOAD_STACK_GUARD.
This fixes PR22248 on sparc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 10:37:14 +00:00
Marcin Koscielnicki
79b1c77d12 [SPARC] Add support for llvm.thread.pointer.
Differential Revision: http://reviews.llvm.org/D19387

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267544 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 10:37:01 +00:00