Andrea Di Biagio [Wed, 19 Nov 2014 19:34:29 +0000 (19:34 +0000)]
[X86] Improved lowering of v4x32 build_vector dag nodes.
This patch improves the lowering of v4f32 and v4i32 build_vector dag nodes
that are known to have at least two non-zero elements.
With this patch, a build_vector that performs a blend with zero is
converted into a shuffle. This is done to let the shuffle legalizer expand
the dag node in a optimal way. For example, if we know that a build_vector
performs a blend with zero, we can try to lower it as a movq/blend instead of
always selecting an insertps.
This patch also improves the logic that lowers a build_vector into a insertps
with zero masking. See for example the extra test cases added to test sse41.ll.
Differential Revision: http://reviews.llvm.org/D6311
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222375
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Wed, 19 Nov 2014 19:15:41 +0000 (19:15 +0000)]
[ADT] Fix PR20728 - Incorrect APFloat::fusedMultiplyAdd results for x86_fp80.
As detailed at http://llvm.org/PR20728, due to an internal overflow in
APFloat::multiplySignificand the APFloat::fusedMultiplyAdd method can return
incorrect results for x87DoubleExtended (x86_fp80) values. This commonly
manifests as incorrect constant folding of libm fmal calls on x86. E.g.
fmal(1.0L, 1.0L, 3.0L) == 0.0L (should be 4.0L)
This patch fixes PR20728 by adding an extra bit to the significand for
intermediate results of APFloat::multiplySignificand, avoiding the overflow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222374
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Wed, 19 Nov 2014 17:10:39 +0000 (17:10 +0000)]
[llvm-readobj][NFC]
Appeasing mingw without C++11 std::to_string
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222369
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 19 Nov 2014 16:58:49 +0000 (16:58 +0000)]
R600/SI: Make SIInstrInfo::isOperandLegal() more strict
A register operand that has a common sub-class with its instruction's
defined register class is not always legal. For example,
SReg_32 and M0Reg both have a common sub-class, but we can't
use an SReg_32 in instructions that expect a M0Reg.
This prevents the llvm.SI.sendmsg.ll test from failing when the fold
operand pass is added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222368
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Wed, 19 Nov 2014 16:44:02 +0000 (16:44 +0000)]
[mips][micromips] Implement SWM32 and LWM32 instructions
Differential Revision: http://reviews.llvm.org/D5519
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222367
91177308-0d34-0410-b5e6-
96231b3b80d8
Suyog Sarda [Wed, 19 Nov 2014 16:07:38 +0000 (16:07 +0000)]
Vectorize a reduction chain feeding into a 'return' statement.
e.x
return (a[0]+b[0]) + (a[1]+b[1])
Differential Revision: http://reviews.llvm.org/D6227
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222364
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 13:37:51 +0000 (13:37 +0000)]
[mips][microMIPS] Fix opcodes of MFHC1 and MTHC1 instructions.
Differential Revision: http://reviews.llvm.org/D6169
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222355
91177308-0d34-0410-b5e6-
96231b3b80d8
Arnaud A. de Grandmaison [Wed, 19 Nov 2014 13:32:51 +0000 (13:32 +0000)]
Fix tail recursion elimination
When the BasicBlock containing the return instrution has a PHI with 2
incoming values, FoldReturnIntoUncondBranch will remove the no longer
used incoming value and remove the no longer needed phi as well. This
leaves us with a BB that no longer has a PHI, but the subsequent call
to FoldReturnIntoUncondBranch from FoldReturnAndProcessPred will not
remove the return instruction (which still uses the result of the call
instruction). This prevents EliminateRecursiveTailCall to remove
the value, as it is still being used in a basicblock which has no
predecessors.
The basicblock can not be erased on the spot, because its iterator is
still being used in runTRE.
This issue was exposed when removing the threshold on size for lifetime
marker insertion for named temporaries in clang. The testcase is a much
reduced version of peelOffOuterExpr(const Expr*, const ExplodedNode *)
from clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222354
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 13:23:58 +0000 (13:23 +0000)]
[mips][microMIPS] Implement CodeGen support for 16-bit instruction ADDIUR2.
Differential Revision: http://reviews.llvm.org/D5800
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222352
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 13:11:09 +0000 (13:11 +0000)]
[mips][microMIPS] Implement CodeGen support for ADDIUS5 instruction.
Differential Revision: http://reviews.llvm.org/D5799
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222351
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 11:49:57 +0000 (11:49 +0000)]
[mips][microMIPS] Add disassembler tests for new microMIPS 32-bit
instructions: LWXS, BGEZALS, BLTZALS, BEQZC, BNEZC, JALS and JALRS.
http://reviews.llvm.org/D5413
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222349
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 11:39:12 +0000 (11:39 +0000)]
[mips][microMIPS] Implement LWXS instruction.
Differential Revision: http://reviews.llvm.org/D5407
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222348
91177308-0d34-0410-b5e6-
96231b3b80d8
Jozef Kolek [Wed, 19 Nov 2014 11:25:50 +0000 (11:25 +0000)]
[mips][microMIPS] Implement SDBBP and RDHWR instructions.
Differential Revision: http://reviews.llvm.org/D5240
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222347
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Wed, 19 Nov 2014 10:30:02 +0000 (10:30 +0000)]
Use ninja pools to limit the number of concurrent compile/link jobs.
This change makes use of the new "job pool" capability in cmake 3.0
with ninja generator to allow limiting the number of concurrent jobs
of a certain type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222341
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Wed, 19 Nov 2014 10:06:49 +0000 (10:06 +0000)]
[X86][SSE] pslldq/psrldq byte shifts/rotation for SSE2
This patch builds on http://reviews.llvm.org/D5598 to perform byte rotation shuffles (lowerVectorShuffleAsByteRotate) on pre-SSSE3 (palignr) targets - pre-SSSE3 is only enabled on i8 and i16 vector targets where it is a more definite performance gain.
I've also added a separate byte shift shuffle (lowerVectorShuffleAsByteShift) that makes use of the ability of the SLLDQ/SRLDQ instructions to implicitly shift in zero bytes to avoid the need to create a zero register if we had used palignr.
Differential Revision: http://reviews.llvm.org/D5699
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222340
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 19 Nov 2014 09:41:05 +0000 (09:41 +0000)]
AliasSetTracker: UnknownInsts should contribute to the refcount
AliasSetTracker::addUnknown may create an AliasSet devoid of pointers
just to contain an instruction if no suitable AliasSet already exists.
It will then AliasSet::addUnknownInst and we will be done.
However, it's possible for addUnknown to choose an existing AliasSet to
addUnknownInst.
If this were to occur, we are in a bit of a pickle: removing pointers
from the AliasSet can cause the entire AliasSet to become destroyed,
taking our unknown instructions out with them.
Instead, keep track whether or not our AliasSet has any unknown
instructions.
This fixes PR21582.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222338
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 19 Nov 2014 08:12:55 +0000 (08:12 +0000)]
Add missing header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222337
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 19 Nov 2014 07:49:26 +0000 (07:49 +0000)]
Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool>
This is to be consistent with StringSet and ultimately with the standard
library's associative container insert function.
This lead to updating SmallSet::insert to return pair<iterator, bool>,
and then to update SmallPtrSet::insert to return pair<iterator, bool>,
and then to update all the existing users of those functions...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222334
91177308-0d34-0410-b5e6-
96231b3b80d8
Hao Liu [Wed, 19 Nov 2014 06:48:56 +0000 (06:48 +0000)]
[AArch64] Disable useAA for Cortex-A57.
Using AA during CodeGen is very useful for in-order cores. It is less useful for ooo cores. Also I find
enabling useAA for Cortex-A57 may generate worse code for some test cases. If useAA in codegen is improved
and benefical for ooo cores, we can enable it again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222333
91177308-0d34-0410-b5e6-
96231b3b80d8
Hao Liu [Wed, 19 Nov 2014 06:39:53 +0000 (06:39 +0000)]
[AArch64] Enable SeparateConstOffsetFromGEP, EarlyCSE and LICM passes on AArch64 backend.
SeparateConstOffsetFromGEP can gives more optimizaiton opportunities related to GEPs, which benefits EarlyCSE
and LICM. By enabling these passes we can have better address calculations and generate a better addressing
mode. Some SPEC 2006 benchmarks (astar, gobmk, namd) have obvious improvements on Cortex-A57.
Reviewed in http://reviews.llvm.org/D5864.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222331
91177308-0d34-0410-b5e6-
96231b3b80d8
Hao Liu [Wed, 19 Nov 2014 06:24:44 +0000 (06:24 +0000)]
[SeparateConstOffsetFromGEP] Allow SeparateConstOffsetFromGEP pass to lower GEPs.
If LowerGEP is enabled, it can lower a GEP with multiple indices into GEPs with a single index
or arithmetic operations. Lowering GEPs can always extract structure indices. Lowering GEPs can
also give use more optimization opportunities. It can benefit passes like CSE, LICM and CGP.
Reviewed in http://reviews.llvm.org/D5864
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222328
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 19 Nov 2014 05:49:42 +0000 (05:49 +0000)]
Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)
Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222319
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Wed, 19 Nov 2014 03:34:20 +0000 (03:34 +0000)]
Teach llvm-build to avoid touching LibraryDependencies.inc unless the contents
change. This saves us from rebuilding llvm-config each time we reconfigure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222308
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Wed, 19 Nov 2014 03:34:17 +0000 (03:34 +0000)]
Expose LLVM version string via macro in llvm-config.h, and modify Go bindings
to make use of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222307
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 19 Nov 2014 02:56:00 +0000 (02:56 +0000)]
Make StringSet::insert return pair<iterator, bool> like other self-associative containers
StringSet is still a bit dodgy in that it exposes the raw iterator of
the StringMap parent, which exposes the weird detail that StringSet
actually has a 'value'... but anyway, this is useful for a handful of
clients that want to reference the newly inserted/persistent string data
in the StringSet/Map/Entry/thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222302
91177308-0d34-0410-b5e6-
96231b3b80d8
Rui Ueyama [Wed, 19 Nov 2014 02:07:10 +0000 (02:07 +0000)]
llvm-readobj: fix off-by-one error in COFFDumper
It printed out base relocation table header as table entry.
This patch also makes llvm-readobj to not skip ABSOLUTE entries
becuase it was confusing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222299
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 19 Nov 2014 01:02:22 +0000 (01:02 +0000)]
Use a memcpy so that type based alias analysis sees the change.
The other option would be to do something like
if (that.isSingleWord())
VAL = that.VAL;
else
pVal = that.pVal
This bug was causing 86TTI::getIntImmCost to be miscompiled in a LTO
bootstrap in stage2, causing the build of stage3 to fail.
LLVM is getting quiet good at exploiting this. Not sure if there is anything
a sanitizer could do to help
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222294
91177308-0d34-0410-b5e6-
96231b3b80d8
Weiming Zhao [Wed, 19 Nov 2014 00:29:14 +0000 (00:29 +0000)]
[Aarch64] Customer lowering of CTPOP to SIMD should check for NEON availability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222292
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Wed, 19 Nov 2014 00:22:58 +0000 (00:22 +0000)]
[asan] add experimental basic-block tracing to asan-coverage; also fix -fsanitize-coverage=3 which was broken by r221718
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222290
91177308-0d34-0410-b5e6-
96231b3b80d8
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