129855 Commits

Author SHA1 Message Date
James Y Knight
0cfb927e93 Put quotes around #error string.
GCC reports "missing terminating ' character", even when it's being
skipped by preprocessing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 19:52:32 +00:00
Nicolai Haehnle
ea7a0c0467 AMDGPU: Add a shader calling convention
This makes it possible to distinguish between mesa shaders
and other kernels even in the presence of compute shaders.

Patch By: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 19:40:20 +00:00
Quentin Colombet
e09831206a Revert "[RegisterBankInfo] Add methods to get the possible mapping of an
instruction on a register bank. This will be used by the register bank select
pass to assign register banks for generic virtual registers." and the follow-on
commits while I find out a way to fix the win7 bot:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19882

This reverts commit r265578, r265581, r265584, and r265585.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 19:04:58 +00:00
Davide Italiano
fd0bc4ee66 [IRVerifier] Don't crash on invalid DIFile inside DISubprogram.
r265515, this time with the correct fix. file inside DISubprogram is not
mandatory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:46:39 +00:00
Quentin Colombet
0fad13dc00 [RegisterBankInfo] Get rid of the assert in the constructor of InstructionMapping.
The default constructor now uses the regular constructor and the assert
is not valid anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:43:46 +00:00
Quentin Colombet
d030a6cdd9 [RegisterBankInfo] Call the other constructor of InstructionMapping from the
default constructor, instead of relying on the default constructor of
unique_ptr.

Second attempt at fixing the windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:37:44 +00:00
Evgeniy Stepanov
d8c5d5c30e [gold] Save bitcode for module partitions (save-temps + split codegen).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:32:13 +00:00
Quentin Colombet
fe58f90a22 [RegisterBankInfo] Provide a default constructor for InstructionMapping
helper class.

The default constructor creates invalid (isValid() == false) instances
and may be used to communicate that a mapping was not found.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:24:34 +00:00
Davide Italiano
eb6436d50f [IRVerifier] Prefer dyn_cast<> over isa<> + cast<>.
Thanks to Rafael for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265579 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:13:44 +00:00
Quentin Colombet
8c06939d54 [RegisterBankInfo] Add an helper function to get the size of a register.
The previous method to get the size was too simple and could fail for
physical registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:04:35 +00:00
Duncan P. N. Exon Smith
a15c0e9ce0 IR: Use DenseSet instead of DenseMap for ConstantUniqueMap; NFC
Use a DenseSet instead of a DenseMap for constants in LLVMContextImpl.
Last time I looked at this was some time before r223588, when
DenseSet<V> had no advantage over DenseMap<V,char>.  After r223588,
there's a 50% memory savings.

This is all mechanical.  There were little bits of missing API from
DenseSet so I added the trivial implementations:

  - iterator::operator++(int)
  - template <class LookupKeyT> insert_as(ValueTy, LookupKeyT)

There should be no functionality change, just reduced memory consumption
(this wasn't on a profile or anything; just a cleanup I stumbled on).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265577 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:56:08 +00:00
Duncan P. N. Exon Smith
9148a0a560 IR: Stop explicitly clearing the MDStringCache
The MDStringCache doesn't need to be explicitly cleared before
destruction.  The destructor handles it at least as efficiently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:56:05 +00:00
Quentin Colombet
b5dd9acfff [RegisterBankInfo] Add a method to get the mapping RegClass -> RegBank.
This should be TableGen'ed at some point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265574 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:51:41 +00:00
Quentin Colombet
4bbf81ac57 [RegisterBankInfo] Add methods to get the possible mapping of an instruction on a register bank.
This will be used by the register bank select pass to assign register banks
for generic virtual registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:45:40 +00:00
Saleem Abdulrasool
1ebdc6b129 vim: add missing keyword
`source_filename` was introduced as a keyword in SVN r264884, but the syntax
file was not updated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265572 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:42:16 +00:00
Quentin Colombet
acad7beb8a [AArch64] Change the CMake to avoid to build GlobalISel related APIs
when GISel is not built.
The positive side effects are:
- We do not have to define dummy implementation
- We do not have to do weird gymnastic to avoid like issues (like
  missing constructor or vtable for the base classes)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265570 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:38:12 +00:00
Quentin Colombet
65e2c25a7e [AArch64] Teach the subtarget how to get to the RegisterBankInfo.
Rework the access to GlobalISel APIs to contain how much of
the APIs we need to access for the final executable to build when
GlobalISel is not built.

This prevents massive usage of ifdefs in various places. Now, all the
GlobalISel ifdefs will be happing only in AArch64TargetMachine.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265567 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:26:03 +00:00
Quentin Colombet
12ea314247 [RegisterBankInfo] Make the destructor public... that may be useful!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:09:34 +00:00
Quentin Colombet
e33ae0279e [RegisterBankInfo] Implement the verify method of the InstructionMapping helper class.
This checks that all the register operands get a proper mapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:01:43 +00:00
Fiona Glaser
a4b0d0e4db Loop Unroll: add options and tweak to make Partial unrolling more useful
1. Add FullUnrollMaxCount option that works like MaxCount, but also limits
   the unroll count for fully unrolled loops. So if a loop has an iteration
   count over this, it won't fully unroll.
2. Add CLI options for MaxCount and the new option, so they can be tested
   (plus a test).
3. Make partial unrolling obey MaxCount.

An example use-case (the out of tree one this is originally designed for) is
a target’s TTI can analyze a loop and decide on a max unroll count separate
from the size threshold, e.g. based on register pressure, then constrain
LoopUnroll to not exceed that, regardless of the size of the unrolled loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:57:25 +00:00
Quentin Colombet
a80c06540f [MachineRegisterInfo] Document what is the expected metric for the size of generic registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:51:04 +00:00
Hans Wennborg
327ecef67c Revert r265450 "[X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC."
It caused ASan 32-bit tests to hang (PR27245).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:44:38 +00:00
Fiona Glaser
93b72547c0 LoopUnroll: only allow non-modulo Partial unrolling when Runtime=true
Patch by Evgeny Stupachenko <evstupac@gmail.com>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:43:45 +00:00
Quentin Colombet
560a956259 [RegisterBankInfo] Implement the verify method for the ValueMapping helper class.
The method checks that the value is fully defined accross the different partial
mappings and that the partial mappings are compatible between each other.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:40:23 +00:00
Quentin Colombet
6f5e1e215f [RegisterBankInfo] Add a verify method for the PartialMapping helper class.
This verifies that the PartialMapping can be accomadated into the related
register bank.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265555 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:33:26 +00:00
Valery Pykhtin
8950a8d2f9 Revert "[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support."
This reverts commit r265550. There're problems with endianness on dumping instruction bytes. Need to find out how to use support::ulittle32_t type properly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:30:21 +00:00
Quentin Colombet
67f02253c9 [RegisterBankInfo] Add a couple of helper classes for the future cost model.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:27:01 +00:00
Hans Wennborg
374df657de Revert "Re-commit r265039 "[X86] Merge adjacent stack adjustments in eliminateCallFramePseudoInstr (PR27140)""
It seems to be causing ASan tests to crash, probably due to
miscompiling the run-time somehow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:10:20 +00:00
Valery Pykhtin
496db86011 [AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Differential revision: http://reviews.llvm.org/D16998

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 15:55:10 +00:00
Quentin Colombet
505761b9d2 [AArch64] Use the default constructor of RegisterBankInfo when GlobalISel is not built.
This will avoid link-time error as the defautl constructor of RegisterBankInfo is
the only one available when GlobalISel is not built.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 15:53:13 +00:00
Quentin Colombet
bc6e9634c0 [RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel is not built.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 15:47:17 +00:00
Wei Mi
1145b58255 Recommit r265309 after fixed an invalid memory reference bug happened
when DenseMap growed and moved memory. I verified it fixed the bootstrap
problem on x86_64-linux-gnu but I cannot verify whether it fixes
the bootstrap error on clang-ppc64be-linux. I will watch the build-bot
result closely.

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

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

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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 15:41:07 +00:00
Silviu Baranga
89e8236bfb Revert r265535 until we know how we can fix the bots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265541 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 14:06:32 +00:00
Sam Kolton
d348963f69 [AMDGPU] AsmParser: disable DPP for unsupported instructions. New dpp tests. Fix v_nop_dpp.
Summary:
1. Disable DPP encoding for instructions that do not support it:
    - VOP1:
        - v_readfirstlane_b32
        - v_clrexcp
        - v_movreld_b32
        - v_movrels_b32
        - v_movrelsd_b32
    - VOP2:
        - v_madmk_f16/32
        - v_madak_f16/32
    - VOPC, VINTRP, VOP3
2. Fix DPP for v_nop
3. New DPP tests for VOP1 and VOP2 instructions

Reviewers: nhaustov, tstellarAMD, vpykhtin

Subscribers: tstellarAMD, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 13:29:59 +00:00
Chad Rosier
b0bab88f96 Simplify logic. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 13:27:13 +00:00
Silviu Baranga
39fbde60e1 [SCEV] Introduce a guarded backedge taken count and use it in LAA and LV
Summary:
When the backedge taken codition is computed from an icmp, SCEV can
deduce the backedge taken count only if one of the sides of the icmp
is an AddRecExpr. However, due to sign/zero extensions, we sometimes
end up with something that is not an AddRecExpr.

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

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

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

Reviewers: anemet, mzolotukhin, hfinkel, sanjoy

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 13:18:26 +00:00
Evgeny Astigeevich
864fed9d22 [AArch64][CodeGen] NFC refactor AArch64InstrInfo::optimizeCompareInstr to prepare it for fixing a bug in it
AArch64InstrInfo::optimizeCompareInstr has a bug which causes generation of incorrect code (PR#27158).
The patch refactors the function to simplify reviewing the fix of the bug.

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265531 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 11:39:00 +00:00
Chuang-Yu Cheng
6b74529a35 [ppc64] Temporary disable sibling call optimization on ppc64 due to breaking test case
r265506 breaks print-stack-trace.cc test case of compiler-rt in bootstrap
test.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265528 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 10:48:36 +00:00
David Majnemer
8b680c27be [SLPVectorizer] Vectorizing the libm sqrt to llvm's sqrt intrinsic requires nnan
To quote the langref "Unlike sqrt in libm, however, llvm.sqrt has
undefined behavior for negative numbers other than -0.0 (which allows
for better optimization, because there is no need to worry about errno
being set). llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sqrt."

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

Thanks to Hal Finkel for pointing this out!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 07:04:53 +00:00
Duncan P. N. Exon Smith
adb72b91cb IR: Move MDStrings to a BumpPtrAllocator
We never delete any MDString until the context is destroyed.  Might as
well throw them onto a BumpPtrAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 06:41:54 +00:00
Duncan P. N. Exon Smith
e49dfa7e9a IRMover: Steal arguments when moving functions, NFC
Instead of copying arguments from the source function to the
destination, steal them.  This has a few advantages.

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

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

  - Argument names don't need to be copied.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 06:38:15 +00:00
Davide Italiano
f504f6f4f7 Revert "[IRVerifier] Don't crash on invalid DIFile inside DISubprogram."
This reverts commit r265515 as lots of tests need to be fixed before
this actually can go in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 04:34:38 +00:00
Richard Trieu
100a00cda0 Add parentheses to silence warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 04:22:00 +00:00
Davide Italiano
ce42332d64 [IRVerifier] Don't crash on invalid DIFile inside DISubprogram.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 03:57:47 +00:00
Davide Italiano
d7975248c1 [IRVerifier] Avoid crashing on an invalid compile unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 03:07:58 +00:00
Matthias Braun
525c4ba52f AArch64: Fix compile error
Fixed to adapt a use of enterBasicBlock() in my last commit (because I
had follow on patches in my repository that change the code).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 02:59:44 +00:00
Matthias Braun
dc2f859a3f RegisterScavenger: Take a reference as enterBasicBlock() argument.
Make it obvious that the argument cannot be nullptr.
Remove an unnecessary nullptr check in initRegState.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 02:47:09 +00:00
Matthias Braun
72b4fa0d1c LivePhysRegs: removeReg() must remove aliased registers
We must remove all aliased registers which may be more than the all sub
and super registers combined.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 02:46:35 +00:00
Matthias Braun
1685c6f7ca LivePhysRegs: Remove redundant check
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 02:46:04 +00:00
Duncan P. N. Exon Smith
15709846d4 ValueMapper: Fix delayed blockaddress handling after r265273
r265273 added Mapper::mapBlockAddress, which delays mapping a
blockaddress value until the function has a body.  The condition was
backwards, and should be checking Function::empty instead of
GlobalValue::isDeclaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 02:25:12 +00:00