Rui Ueyama [Wed, 19 Nov 2014 00:18:07 +0000 (00:18 +0000)]
llvm-readobj: teach it how to dump COFF base relocation table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222289
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Wed, 19 Nov 2014 00:17:31 +0000 (00:17 +0000)]
Introduce llvm::SplitAllCriticalEdges
Summary:
move the code from BreakCriticalEdges::runOnFunction()
into a separate utility function llvm::SplitAllCriticalEdges()
so that it can be used independently.
No functionality change intended.
Test Plan: check-llvm
Reviewers: nlewycky
Reviewed By: nlewycky
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6313
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222288
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Wed, 19 Nov 2014 00:13:26 +0000 (00:13 +0000)]
Revert r222039 because of bot failure.
http://lab.llvm.org:8080/green/job/clang-Rlto_master/298/
Hopefully, bot will be green. If not, we will re-submit the commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222287
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 19 Nov 2014 00:01:31 +0000 (00:01 +0000)]
R600/SI: Implement areMemAccessesTriviallyDisjoint
This partially makes up for not having address spaces
used for alias analysis in some simple cases.
This is not yet enabled by default so shouldn't change anything yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222286
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Tue, 18 Nov 2014 23:57:33 +0000 (23:57 +0000)]
R600/SI: Set hasSideEffects = 0 on load and store instructions.
Assuming unmodeled side effects interferes with some scheduling
opportunities.
Don't put it in the base class of DS instructions since there
are a few weird effecting, non load/store instructions there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222285
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Tue, 18 Nov 2014 23:38:19 +0000 (23:38 +0000)]
[X86][AVX] 256-bit vector stack unaligned load/stores identification
Under many circumstances the stack is not 32-byte aligned, resulting in the use of the vmovups/vmovupd/vmovdqu instructions when inserting ymm reloads/spills.
This minor patch adds these instructions to the isFrameLoadOpcode/isFrameStoreOpcode helpers so that they can be correctly identified and not be treated as folded reloads/spills.
This has also been noticed by http://llvm.org/bugs/show_bug.cgi?id=18846 where it was causing redundant spills - I've added a reduced test case at test/CodeGen/X86/pr18846.ll
Differential Revision: http://reviews.llvm.org/D6252
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222281
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Tue, 18 Nov 2014 22:45:47 +0000 (22:45 +0000)]
[Hexagon] Adding A2_and instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222274
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 18 Nov 2014 22:41:49 +0000 (22:41 +0000)]
[FastISel][AArch64] Also allow folding of sign-/zero-extend and arithmetic
shift-right for booleans (i1).
Arithmetic shift-right immediate with sign-/zero-extensions also works for
boolean values. Update the assert and the test cases to reflect that fact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222272
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 18 Nov 2014 22:38:42 +0000 (22:38 +0000)]
[FastISel][AArch64] Also allow folding of sign-/zero-extend and logical
shift-right for booleans (i1).
Logical shift-right immediate with sign-/zero-extensions also works for boolean
values. Update the assert and the test cases to reflect that fact.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222270
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 18 Nov 2014 22:17:30 +0000 (22:17 +0000)]
Fix an inaccurate comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222267
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 22:06:45 +0000 (22:06 +0000)]
InstCombine: Fix another infinite loop caused by visitFPTrunc
We would attempt to replace an frem's operand with the same operand.
This would cause InstCombine to think real work was done, causing
InstCombine to enter an infinite loop.
This fixes the second part of PR21576.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222265
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Tue, 18 Nov 2014 21:51:51 +0000 (21:51 +0000)]
[Hexagon] Adding A2_sub instruction
Renaming test files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222263
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 21:30:02 +0000 (21:30 +0000)]
Revert "Revert r222040 because of bot failure."
This reverts commit r222203, reverting r222040 didn't end up turning the
bot green.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222261
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Tue, 18 Nov 2014 21:23:38 +0000 (21:23 +0000)]
Add support for LLVM_USE_SANITIZER=Thread
Summary: This will help in testing libc++ and libc++abi with tsan.
Reviewers: samsonov
Reviewed By: samsonov
Subscribers: samsonov, llvm-commits
Differential Revision: http://reviews.llvm.org/D6283
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222258
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Tue, 18 Nov 2014 21:20:17 +0000 (21:20 +0000)]
[FastISel][AArch64] Follow-up fix for "Fix shift-immediate emission for "zero" shifts."
Shifts also perform sign-/zero-extends to larger types, which requires us to emit
an integer extend instead of a simple COPY.
Related to PR21594.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222257
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Tue, 18 Nov 2014 21:06:58 +0000 (21:06 +0000)]
R600/SI: Move SIFixSGPRCopies to inst selector passes
This should expose more of the actually used VALU
instructions to the machine optimization passes.
This also should help getting i1 handling into a better state.
For not entirly understood reasons, this fixes the split-scalar-i64-add.ll
test where a 64-bit add would only partially be moved to the VALU
resulting in use of undefined VCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222256
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Tue, 18 Nov 2014 21:02:40 +0000 (21:02 +0000)]
[AArch64] Don't optimize all compare instructions.
"optimizeCompareInstr" converts compares (cmp/cmn) into plain sub/add
instructions when the flags are not used anymore. This conversion is valid for
most instructions, but not all. Some instructions that don't set the flags
(e.g. sub with immediate) can set the SP, whereas the flag setting version uses
the same encoding for the "zero" register.
Update the code to also check for the return register before performing the
optimization to make sure that a cmp doesn't suddenly turn into a sub that sets
the stack pointer.
I don't have a test case for this, because it isn't easy to trigger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222255
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Tue, 18 Nov 2014 20:50:19 +0000 (20:50 +0000)]
Fix an incorrect chain operand when expanding INSERT_VECTOR operations through the stack.
Patch by Daniil Troshkov!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222254
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Tue, 18 Nov 2014 20:39:39 +0000 (20:39 +0000)]
R600/SI: Make sure resource descriptors are always stored in SGPRs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222253
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 18 Nov 2014 20:34:01 +0000 (20:34 +0000)]
[Reassociate] Use test cases that can actually be optimized to verify optional
flags are cleared. The reassociation pass was just reordering the leaf nodes
in the previous test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222250
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Tue, 18 Nov 2014 20:28:11 +0000 (20:28 +0000)]
[Hexagon] Converting from ADD_rr to A2_add which has encoding bits.
Adding test to show correct instruction selection and encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222249
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 18 Nov 2014 20:21:54 +0000 (20:21 +0000)]
[Reassociate] Rename local variable to not use same name as a member
variable. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222248
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Tue, 18 Nov 2014 19:58:59 +0000 (19:58 +0000)]
[FastISel][AArch64] Fix shift-immediate emission for "zero" shifts.
This change emits a COPY for a shift-immediate with a "zero" shift value.
This fixes PR21594 where we emitted a shift instruction with an incorrect
immediate operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222247
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Tue, 18 Nov 2014 19:20:34 +0000 (19:20 +0000)]
Test commit to verify that commit access works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222244
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Tue, 18 Nov 2014 17:46:32 +0000 (17:46 +0000)]
Tweak EarlyCSE to recognize series of dead stores
EarlyCSE is giving up on the current instruction immediately when it recognizes that the current instruction makes a previous store trivially dead. There's no reason to do this. Once the previous store has been deleted, it's perfectly legal to remember the value of the current store (for value forwarding) and the fact the store occurred (it could be dead too!).
Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D6301
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222241
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 18 Nov 2014 16:45:34 +0000 (16:45 +0000)]
Remove triple in testing case to recover an arm bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222239
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 18 Nov 2014 12:23:19 +0000 (12:23 +0000)]
CallGraphTest.cpp: Remove invalid tests. ++S might step over F if S == F.
MSVC Runtime detects "Assertion failed: vector iterator not incrementable"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222233
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 09:31:41 +0000 (09:31 +0000)]
InstCombine: Fold away tautological masked compares
It is impossible for (x & INT_MAX) == 0 && x == INT_MAX to ever be true.
While this sort of reasoning should normally live in InstSimplify,
the machinery that derives this result is not trivial to split out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222230
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 09:31:36 +0000 (09:31 +0000)]
InstCombine: Clean up foldLogOpOfMaskedICmps
No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222229
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 18 Nov 2014 05:22:39 +0000 (05:22 +0000)]
docs: Modernize some examples in WritingAnLLVMPass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222223
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 18 Nov 2014 05:00:52 +0000 (05:00 +0000)]
docs: Fix a couple of typo-ish errors in WritingAnLLVMPass
- Make CallGraphSCCPass's paragraph about doFinalization refer to
runOnSCC instead of runOnFunction, since that's what it's about.
- Fix a reference in the FunctionPass paragraph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222222
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Tue, 18 Nov 2014 02:46:11 +0000 (02:46 +0000)]
Allow DwarfCompileUnit::constructImportedEntityDIE to instanciate a GlobalVariable DIE.
Usually global variables are in a retain list and instanciated before
any call to constructImportedEntityDIE is made. This isn't true for
forward declarations though.
The testcase for this change is generated by a clang patched to emit
such forward declarations (patch at http://reviews.llvm.org/D6173
which will land soon). The updated testcase tests more than just
global variables, it now tests every type of 'using' clause we
support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222217
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 02:45:28 +0000 (02:45 +0000)]
llvm-readobj: Don't print the Characteristics field as the Subsystem
We claimed that we were printing the Subystem field when we were
actually printing the Characteristics field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222216
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Tue, 18 Nov 2014 02:37:11 +0000 (02:37 +0000)]
SimplifyCFG: Range'ify some for-loops. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222215
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Tue, 18 Nov 2014 02:20:58 +0000 (02:20 +0000)]
IndVarSimplify: Allow LFTR to fire more often
I added a pessimization in r217102 to prevent miscompiles when the
incremented induction variable was used in a comparison; it would be
poison.
Try to use the incremented induction variable more often when we can be
sure that the increment won't end in poison.
Differential Revision: http://reviews.llvm.org/D6222
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222213
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Tue, 18 Nov 2014 02:20:29 +0000 (02:20 +0000)]
IR: Sink MDNode::Hash down to GenericMDNode::Hash
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222212
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Tue, 18 Nov 2014 01:56:14 +0000 (01:56 +0000)]
IR: Move MDNode operands from the back to the front
Having the operands at the back prevents subclasses from safely adding
fields. Move them to the front.
Instead of replicating the custom `malloc()`, `free()` and `DestroyFlag`
logic that was there before, overload `new` and `delete`.
I added calls to a new `GenericMDNode::dropAllReferences()` in
`LLVMContextImpl::~LLVMContextImpl()`. There's a maze of callbacks
happening during teardown, and this resolves them before we enter
the destructors.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222211
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 18 Nov 2014 01:49:06 +0000 (01:49 +0000)]
Update testing case that was accidently duplicated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222210
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Tue, 18 Nov 2014 01:26:46 +0000 (01:26 +0000)]
Fix covered switch warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222209
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Tue, 18 Nov 2014 01:14:25 +0000 (01:14 +0000)]
Support ELF files of unknown type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222208
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Tue, 18 Nov 2014 00:37:17 +0000 (00:37 +0000)]
IR: Split MDNode into GenericMDNode and MDNodeFwdDecl
Split `MDNode` into two classes:
- `GenericMDNode`, which is uniquable (and for now, always starts
uniqued). Once `Metadata` is split from the `Value` hierarchy, this
class will lose the ability to RAUW itself.
- `MDNodeFwdDecl`, which is used for the "temporary" interface, is
never uniqued, and isn't managed by `LLVMContext` at all.
I've left most of the guts in `MDNode` for now, but I'll incrementally
move things to the right places (or delete the functionality, as
appropriate).
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222205
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 18 Nov 2014 00:33:22 +0000 (00:33 +0000)]
Revert r222040 because of bot failure.
http://lab.llvm.org:8080/green/job/clang-Rlto_master/298/
Hopefully, bot will be green.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222203
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 18 Nov 2014 00:29:08 +0000 (00:29 +0000)]
Debug Info: In DIBuilder, the context field of a global variable is updated to
use DIScopeRef.
A paired commit at clang will follow to show cases where we will use an
identifer for the context of a global variable.
rdar://
18958417
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222195
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Mon, 17 Nov 2014 23:28:21 +0000 (23:28 +0000)]
IR: Simplify uniquing for MDNode
Change uniquing from a `FoldingSet` to a `DenseSet` with custom
`DenseMapInfo`. Unfortunately, this doesn't save any memory, since
`DenseSet<T>` is a simple wrapper for `DenseMap<T, char>`, but I'll come
back to fix that later.
I used the name `GenericDenseMapInfo` to the custom `DenseMapInfo` since
I'll be splitting `MDNode` into two classes soon: `MDNodeFwdDecl` for
temporaries, and `GenericMDNode` for everything else.
I also added a non-debug-info reduced version of a type-uniquing test
that started failing on an earlier draft of this patch.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222191
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Mon, 17 Nov 2014 22:55:59 +0000 (22:55 +0000)]
Revert "ADT: correctly report isMSVCEnvironment for windows itanium"
This reverts commit r222180.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222188
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Mon, 17 Nov 2014 22:55:41 +0000 (22:55 +0000)]
Revert "Improve memory ownership/management in TableGen by unique_ptrifying TreePattern's Tree member."
This reverts commit r222183.
Broke on the MSVC buildbots due to MSVC not producing default move
operations - I'd fix it immediately but just broke my build system a
bit, so backing out until I have a chance to get everything going again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222187
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Mon, 17 Nov 2014 22:16:55 +0000 (22:16 +0000)]
Improve memory ownership/management in TableGen by unique_ptrifying TreePattern's Tree member.
The next step is to actually use unique_ptr in TreePatternNode's
Children vector. That will be more intrusive, and may not work,
depending on exactly how these things are handled (I have a bad
suspicion things are shared more than they should be, making this more
DAG than tree - but if it's really a tree, unique_ptr should suffice)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222183
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Mon, 17 Nov 2014 22:16:15 +0000 (22:16 +0000)]
CMake: Use the new USES_TERMINAL option for test suite targets when available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222181
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Mon, 17 Nov 2014 22:13:26 +0000 (22:13 +0000)]
ADT: correctly report isMSVCEnvironment for windows itanium
The itanium environment on Windows uses MSVC and is a MSVC environment. Report
this correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222180
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Mon, 17 Nov 2014 21:11:37 +0000 (21:11 +0000)]
R600/SI: Don't copy flags when extracting subreg
This was resulting in use of a register after a kill.
For some reason this showed up as a problem in many tests
when moving the SIFixSGPRCopies pass closer to instruction
selection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222175
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Mon, 17 Nov 2014 21:11:34 +0000 (21:11 +0000)]
R600/SI: Assume SIFixSGPRCopies makes changes
I'm not sure if this was breaking anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222174
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 21:06:38 +0000 (21:06 +0000)]
Fix the autoconf build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222173
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 20:51:01 +0000 (20:51 +0000)]
Factor common code it Linker::init.
The TypeFinder was not being used in one of the constructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222172
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 20:06:27 +0000 (20:06 +0000)]
Pass a reference to ValueEnumerator.
NFC. This will just make it easier to use std::unique_ptr in a caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222170
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Mon, 17 Nov 2014 19:39:56 +0000 (19:39 +0000)]
[SimplifyCFG] Make the value type of the hole check bitmask a power-of-2.
When converting a switch to a lookup table we might have to generate a bitmaks
to encode and check for holes in the original switch statement.
The type of this mask depends on the number of switch statements, which can
result in illegal types for pretty much all architectures.
To avoid unnecessary type legalization and help FastISel this commit increases
the size of the bitmask to next power-of-2 value when necessary.
This fixes rdar://problem/
18984639.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222168
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 19:26:40 +0000 (19:26 +0000)]
Revert commits r222146 and r222137.
They were producing the wrong result if NumBits == BitsInWord. The old mask
produced -1, the new mask 0.
This should fix the 32 bit bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222166
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 17:51:45 +0000 (17:51 +0000)]
Fix GraphTraits for "const CallGraphNode *" and "const CallGraph *"
The specializations were broken. For example,
void foo(const CallGraph *G) {
auto I = GraphTraits<const CallGraph *>::nodes_begin(G);
auto K = I++;
...
}
or
void bar(const CallGraphNode *N) {
auto I = GraphTraits<const CallGraphNode *>::nodes_begin(G);
auto K = I++;
....
}
would not compile.
Patch by Speziale Ettore!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222149
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 17:43:27 +0000 (17:43 +0000)]
Avoid undefined behavior by masking the shift amount.
Should hopefully fix the mips bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222146
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 17 Nov 2014 16:33:50 +0000 (16:33 +0000)]
[Reassociate] As the expression tree is rewritten make sure the operands are
emitted in canonical form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222142
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Volkov [Mon, 17 Nov 2014 16:17:51 +0000 (16:17 +0000)]
[X86] Use ADD/SUB instead of INC/DEC for Haswell and Broadwell CPUs
Differential Revision: http://reviews.llvm.org/D5934
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222141
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 17 Nov 2014 15:52:51 +0000 (15:52 +0000)]
[Reassociate] Canonicalize constants to RHS operand.
Fix a thinko where the RHS was already a constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222139
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 15:46:21 +0000 (15:46 +0000)]
Use a more canonical way of computing a mask with N trailing 1s. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222137
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Mon, 17 Nov 2014 14:08:57 +0000 (14:08 +0000)]
Fix ARM triple parsing
The triple parser should only accept existing architecture names
when the triple starts with armv, armebv, thumbv or thumbebv.
Patch by Gabor Ballabas.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222129
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 17 Nov 2014 11:27:45 +0000 (11:27 +0000)]
ScalarEvolution: Construct SCEVDivision's Derived type instead of itself
SCEVDivision::divide constructed an object of SCEVDivision<Derived>
instead of Derived. divide would call visit which would cast the
SCEVDivision<Derived> to type Derived. As it happens,
SCEVDivision<Derived> and Derived currently have the same layout but
this is fragile and grounds for UB.
Instead, just construct Derived. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222126
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Mon, 17 Nov 2014 11:18:10 +0000 (11:18 +0000)]
[Thumb1] Re-write emitThumbRegPlusImmediate
This was motivated by a bug which caused code like this to be
miscompiled:
declare void @take_ptr(i8*)
define void @test() {
%addr1.32 = alloca i8
%addr2.32 = alloca i32, i32 1028
call void @take_ptr(i8* %addr1)
ret void
}
This was emitting the following assembly to get the value of %addr1:
add r0, sp, #1020
add r0, r0, #8
However, "add r0, r0, #8" is not a valid Thumb1 instruction, and this
could not be assembled. The generated object file contained this,
resulting in r0 holding SP+8 rather tha SP+1028:
add r0, sp, #1020
add r0, sp, #8
This function looked like it could have caused miscompilations for
other combinations of registers and offsets (though I don't think it is
currently called with these), and the heuristic it used did not match
the emitted code in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222125
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 17 Nov 2014 11:17:17 +0000 (11:17 +0000)]
Object, COFF: Tighten the object file parser
We were a little lax in a few areas:
- We pretended that import libraries were like any old COFF file, they
are not. In fact, they aren't really COFF files at all, we should
probably grow some specialized functionality to handle them smarter.
- Our symbol iterators were more than happy to attempt to go past the
end of the symbol table if you had a symbol with a bad list of
auxiliary symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222124
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Mon, 17 Nov 2014 10:49:31 +0000 (10:49 +0000)]
Fix optimisations of SELECT_CC which assumed result is boolean
Some optimisations in DAGCombiner cause miscompilations for targets that use
TargetLowering::UndefinedBooleanContent, because they assume that the results
of a SELECT_CC node are boolean values, and can be safely ANDed, ORed and
XORed. These optimisations are only valid for targets that use
ZeroOrOneBooleanContent or ZeroOrNegativeOneBooleanContent.
This is a follow-up to D6210/r221693.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222123
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Mon, 17 Nov 2014 09:29:33 +0000 (09:29 +0000)]
silence gcc 4.9.1 warning in /llvm/lib/Support/Windows/Path.inc:564:39:
warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (ec = widenPath(path, path_utf16))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222122
91177308-0d34-0410-b5e6-
96231b3b80d8
Erik Eckstein [Mon, 17 Nov 2014 09:13:57 +0000 (09:13 +0000)]
Optimize switch lookup tables with linear mapping.
This is a simple optimization for switch table lookup:
It computes the output value directly with an (optional) mul and add if there is a linear mapping between index and output.
Example:
int f1(int x) {
switch (x) {
case 0: return 10;
case 1: return 11;
case 2: return 12;
case 3: return 13;
}
return 0;
}
generates:
define i32 @f1(i32 %x) #0 {
entry:
%0 = icmp ult i32 %x, 4
br i1 %0, label %switch.lookup, label %return
switch.lookup:
%switch.offset = add i32 %x, 10
ret i32 %switch.offset
return:
ret i32 0
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222121
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Mon, 17 Nov 2014 08:00:45 +0000 (08:00 +0000)]
Fix CR/LF line endings in test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222120
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 05:58:26 +0000 (05:58 +0000)]
Add missing semicolon from r222118.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222119
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 05:50:14 +0000 (05:50 +0000)]
Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222118
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 17 Nov 2014 02:28:27 +0000 (02:28 +0000)]
Add back r222061 with a fix.
This adds back r222061, but now calls initializePAEvalPass from the correct
library to avoid link problems.
Original message:
Don't make assumptions about the name of private global variables.
Private variables are can be renamed, so it is not reliable to make
decisions on the name.
The name is also dropped by the assembler before getting to the
linker, so using the name causes a disconnect between how llvm makes a
decision (var name) and how the linker makes a decision (section it is
in).
This patch changes one case where we were looking at the variable name to use
the section instead.
Test tuning by Michael Gottesman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222117
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Mon, 17 Nov 2014 01:34:15 +0000 (01:34 +0000)]
Implement MachODumper::printFileHeaders
Patch by Chilledheart.
Differential Revision: http://reviews.llvm.org/D6163
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222115
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 17 Nov 2014 00:26:50 +0000 (00:26 +0000)]
Replace a couple asserts with static_asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222114
91177308-0d34-0410-b5e6-
96231b3b80d8
Tobias Grosser [Sun, 16 Nov 2014 21:19:35 +0000 (21:19 +0000)]
Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222110
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 16 Nov 2014 21:17:18 +0000 (21:17 +0000)]
Convert some EVTs to MVTs where only a SimpleValueType is needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222109
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 20:35:19 +0000 (20:35 +0000)]
ScalarEvolution: Introduce SCEVSDivision and SCEVUDivision
It turns out that not all users of SCEVDivision want the same
signedness. Let the users determine which operation they'd like by
explicitly choosing SCEVUDivision or SCEVSDivision.
findArrayDimensions and computeAccessFunctions will use SCEVSDivision
while HowFarToZero will use SCEVUDivision.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222104
91177308-0d34-0410-b5e6-
96231b3b80d8
Jingyue Wu [Sun, 16 Nov 2014 16:52:44 +0000 (16:52 +0000)]
[DependenceAnalysis] Allow subscripts of different types
Summary:
Several places in DependenceAnalysis assumes both SCEVs in a subscript pair
share the same integer type. For instance, isKnownPredicate calls
SE->getMinusSCEV(X, Y) which asserts X and Y share the same type. However,
DependenceAnalysis fails to ensure this assumption when producing a subscript
pair, causing tests such as NonCanonicalizedSubscript to crash. With this
patch, DependenceAnalysis runs unifySubscriptType before producing any
subscript pair, ensuring the assumption.
Test Plan:
Added NonCanonicalizedSubscript.ll on which DependenceAnalysis before the fix
crashed because subscripts have different types.
Reviewers: spop, sebpop, jingyue
Reviewed By: jingyue
Subscribers: eliben, meheff, llvm-commits
Differential Revision: http://reviews.llvm.org/D6289
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222100
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 16 Nov 2014 09:24:16 +0000 (09:24 +0000)]
[x86] Remove two redundant isel patterns. They equivalent already exists in the instruction pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222094
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 07:30:35 +0000 (07:30 +0000)]
ScalarEvolution: HowFarToZero was wrongly using signed division
HowFarToZero was supposed to use unsigned division in order to calculate
the backedge taken count. However, SCEVDivision::divide performs signed
division. Unless I am mistaken, no users of SCEVDivision actually want
signed arithmetic: switch to udiv and urem.
This fixes PR21578.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222093
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 16 Nov 2014 02:20:08 +0000 (02:20 +0000)]
InstSimplify: Optimize ICmpInst xform that uses computeKnownBits
A few things:
- computeKnownBits is relatively expensive, let's delay its use as long
as we can.
- Don't create two APInt values just to run computeKnownBits on a
ConstantInt, we already know the exact value!
- Avoid creating a temporary APInt value in order to calculate unary
negation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222092
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Sat, 15 Nov 2014 22:56:25 +0000 (22:56 +0000)]
[DAG] Improved target independent vector shuffle folding logic.
This patch teaches the DAGCombiner how to combine shuffles according to rules:
shuffle(shuffle(A, Undef, M0), B, M1) -> shuffle(B, A, M2)
shuffle(shuffle(A, B, M0), B, M1) -> shuffle(B, A, M2)
shuffle(shuffle(A, B, M0), A, M1) -> shuffle(B, A, M2)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222090
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 15 Nov 2014 21:13:05 +0000 (21:13 +0000)]
[X86][SSE] Improve legal SHUFP and PSHUFD shuffle matching
Updated X86TargetLowering::isShuffleMaskLegal to match SHUFP masks with commuted inputs and PSHUFD masks that reference the second input.
As part of this I've refactored isPSHUFDMask to work in a more general manner and allow it to match against either the first or second input vector.
Differential Revision: http://reviews.llvm.org/D6287
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222087
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 15 Nov 2014 10:53:12 +0000 (10:53 +0000)]
Dispose disassembler after use in unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222083
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Sat, 15 Nov 2014 07:45:31 +0000 (07:45 +0000)]
Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222082
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Sat, 15 Nov 2014 05:02:57 +0000 (05:02 +0000)]
R600: Permute operands when selecting legacy min/max
This gets the correct NaN behavior based on the compare type
the hardware uses. This now passes the new piglit test I have
for this on SI.
Add stricter tests for the operand order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222079
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sat, 15 Nov 2014 02:03:59 +0000 (02:03 +0000)]
yaml2obj, COFF: Consider the DOS stub when laying out section headers
While this program worked correctly with small example programs, larger
ones tickled this bug. I'm working on a reduction because my program is
quite large.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222078
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Sat, 15 Nov 2014 02:03:53 +0000 (02:03 +0000)]
Revert "Don't make assumptions about the name of private global variables."
This reverts commit r222061.
It's causing linker errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222077
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Sat, 15 Nov 2014 01:07:57 +0000 (01:07 +0000)]
R600: Fix 64-bit integer division
This fixes a failure in one of the oclconform tests.
Patch by: Jan Vesely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222073
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Sat, 15 Nov 2014 01:07:53 +0000 (01:07 +0000)]
R600: Factor i64 UDIVREM lowering into its own fuction
This is so it could potentially be used by SI. However, the current
implementation does not always produce correct results, so the
IntegerDivisionPass is being used instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222072
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:23:49 +0000 (00:23 +0000)]
DIBuilder: Use Constant instead of Value
Make explicit the requirement that most IR values in `DIBuilder` are
`Constant`. This requires a follow-up change in clang.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222070
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:05:04 +0000 (00:05 +0000)]
DIBuilder: Change private helper function to static, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222068
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:58:20 +0000 (23:58 +0000)]
IR: Remove MDString logic for Value::hasName()
This isn't necessary after r221960.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222067
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:52 +0000 (23:55 +0000)]
DIBuilder: Cleanup access control style, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222066
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:03 +0000 (23:55 +0000)]
DI: Use Metadata for DITypeRef and DIScopeRef
Now that `MDString` and `MDNode` have a common base class, use it. Note
that it's not useful to assume subclasses of `Metadata` must be one or
the other since we'll be adding more subclasses soon enough.
Part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222064
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 14 Nov 2014 23:31:07 +0000 (23:31 +0000)]
Rename EH related stuff to be more precise
Summary:
The current "WinEH" exception handling type is more about Itanium-style
LSDA tables layered on top of the Windows native unwind info format
instead of .eh_frame tables or EHABI unwind info. Use the name
"ItaniumWinEH" to better reflect the hybrid nature of the design.
Also rename isExceptionHandlingDWARF to usesItaniumLSDAForExceptions,
since the LSDA is part of the Itanium C++ ABI document, and not the
DWARF standard.
Reviewers: echristo
Subscribers: llvm-commits, compnerd
Differential Revision: http://reviews.llvm.org/D6279
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222062
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 14 Nov 2014 23:17:47 +0000 (23:17 +0000)]
Don't make assumptions about the name of private global variables.
Private variables are can be renamed, so it is not reliable to make
decisions on the name.
The name is also dropped by the assembler before getting to the
linker, so using the name causes a disconnect between how llvm makes a
decision (var name) and how the linker makes a decision (section it is
in).
This patch changes one case where we were looking at the variable name to use
the section instead.
Test tuning by Michael Gottesman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222061
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 22:45:33 +0000 (22:45 +0000)]
ARM: refactor .cfi_def_cfa_offset emission.
We use to track quite a few "adjusted" offsets through the FrameLowering code
to account for changes in the prologue instructions as we went and allow the
emission of correct CFA annotations. However, we were missing a couple of cases
and the code was almost impenetrable.
It's easier to just add any stack-adjusting instruction to a list and emit them
together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222057
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 14 Nov 2014 22:45:31 +0000 (22:45 +0000)]
ARM: correctly calculate the offset of FP in its push.
When we folded the DPR alignment gap into a push, we weren't noting the extra
distance from the beginning of the push to the FP, and so FP ended up pointing
at an incorrect offset.
The .cfi_def_cfa_offset directives are still wrong in this case, but I think
that can be improved by refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222056
91177308-0d34-0410-b5e6-
96231b3b80d8