oota-llvm.git
9 years agoMerge empty landing pads in SimplifyCFG
Philip Reames [Tue, 24 Mar 2015 22:28:45 +0000 (22:28 +0000)]
Merge empty landing pads in SimplifyCFG

This patch tries to merge duplicate landing pads when they branch to a common shared target.

Given IR that looks like this:
lpad1:
  %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
         cleanup
  br label %shared_resume
lpad2:
  %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
          cleanup
  br label %shared_resume
shared_resume:
  call void @fn()
  ret void
}

We can rewrite the users of both landing pad blocks to use one of them. This will generally allow the shared_resume block to be merged with the common landing pad as well.

Without this change, tail duplication would likely kick in - creating N (2 in this case) copies of the shared_resume basic block.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233125 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd -m -m elf_x86_64 to gold invocations.
Rafael Espindola [Tue, 24 Mar 2015 22:20:19 +0000 (22:20 +0000)]
Add -m -m elf_x86_64 to gold invocations.

Otherwise the tests would fail if the default was not elf_x86_64.

This fixes PR22966.

Patch by H.J. Lu!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233124 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Remove an InstCombine that seems to have become redundant."
David Blaikie [Tue, 24 Mar 2015 21:50:35 +0000 (21:50 +0000)]
Revert "Remove an InstCombine that seems to have become redundant."

Assertion fires in compiler-rt. Guess it does fire..

This reverts commit r233116.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233121 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReset the CFA offset at the start of every FDE.
Rafael Espindola [Tue, 24 Mar 2015 21:47:31 +0000 (21:47 +0000)]
Reset the CFA offset at the start of every FDE.

This fixes PR21515.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233120 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAArch64: use a different means to determine whether to byte swap relocations.
Peter Collingbourne [Tue, 24 Mar 2015 21:47:03 +0000 (21:47 +0000)]
AArch64: use a different means to determine whether to byte swap relocations.

This code depended on a bug in the FindAssociatedSection function that would
cause it to return the wrong result for certain absolute expressions. Instead,
use EvaluateAsRelocatable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233119 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMC: Add more stringent symbol checking to test.
Peter Collingbourne [Tue, 24 Mar 2015 21:47:00 +0000 (21:47 +0000)]
MC: Add more stringent symbol checking to test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233118 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove an InstCombine that seems to have become redundant.
David Blaikie [Tue, 24 Mar 2015 21:31:31 +0000 (21:31 +0000)]
Remove an InstCombine that seems to have become redundant.

Assert that this doesn't fire - I'll remove all of this later, but just
leaving it in for a while in case this is firing & we just don't have
test coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233116 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, AVX] instcombine vperm2 intrinsics with zero inputs into shuffles
Sanjay Patel [Tue, 24 Mar 2015 20:36:42 +0000 (20:36 +0000)]
[X86, AVX] instcombine vperm2 intrinsics with zero inputs into shuffles

This is the IR optimizer follow-on patch for D8563: the x86 backend patch
that converts this kind of shuffle back into a vperm2.

This is also a continuation of the transform that started in D8486.
In that patch, Andrea suggested that we could convert vperm2 intrinsics that
use zero masks into a single shuffle.

This is an implementation of that suggestion.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233110 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[llvm-readobj] add support for macho universal binary.
Rafael Espindola [Tue, 24 Mar 2015 20:26:55 +0000 (20:26 +0000)]
[llvm-readobj] add support for macho universal binary.

Patch by Keyue Hu (Chilledheart)!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233107 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r233062 ""float2int": Add a new pass to demote from float to int where possible."
Hans Wennborg [Tue, 24 Mar 2015 20:07:08 +0000 (20:07 +0000)]
Revert r233062 ""float2int": Add a new pass to demote from float to int where possible."

This caused PR23008, compiles failing with: "Use still stuck around after Def is
destroyed: %.sroa.speculated"

Also reverting follow-up r233064.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233105 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[IRCE] Fix how IRCE checks for no-sign-overflow.
Sanjoy Das [Tue, 24 Mar 2015 19:29:22 +0000 (19:29 +0000)]
[IRCE] Fix how IRCE checks for no-sign-overflow.

IRCE requires the induction variables it handles to not sign-overflow.
The current scheme of checking if sext({X,+,S}) == {sext(X),+,sext(S)}
fails when SCEV simplifies sext(X) too.  After this change we //also//
check no-signed-wrap by looking at the flags set on the SCEVAddRecExpr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233102 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[IRCE] Fix a regression introduced in r232444.
Sanjoy Das [Tue, 24 Mar 2015 19:29:18 +0000 (19:29 +0000)]
[IRCE] Fix a regression introduced in r232444.

IRCE should not try to eliminate range checks that check an induction
variable against a loop-varying length.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233101 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, AVX] recognize shufflevector with zero input as a vperm2 (PR22984)
Sanjay Patel [Tue, 24 Mar 2015 19:19:07 +0000 (19:19 +0000)]
[X86, AVX] recognize shufflevector with zero input as a vperm2 (PR22984)

vperm2x128 instructions have the special ability (aka free hardware capability)
to shuffle zero values into a vector.

This patch recognizes that type of shuffle and generates the appropriate
control byte.

https://llvm.org/bugs/show_bug.cgi?id=22984

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233100 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Reorder definitions of MDLocation and MDFile, NFC
Duncan P. N. Exon Smith [Tue, 24 Mar 2015 17:34:33 +0000 (17:34 +0000)]
DebugInfo: Reorder definitions of MDLocation and MDFile, NFC

Move definition of `MDLocation` after `MDLocalScope` so that the latter
is available for casts in the former.  Similarly, move the definition of
`MDFile` as early as possible so that other classes can cast to it in
their definitions.  (Follow-up commits will take advantage of this.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233096 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoVerifier: Start recursing into !dbg attachments
Duncan P. N. Exon Smith [Tue, 24 Mar 2015 17:32:19 +0000 (17:32 +0000)]
Verifier: Start recursing into !dbg attachments

The main verifier already recurses through the other entry points, so we
might as well descend here too.

This temporarily duplicates some work already done in
`verifyDebugInfo()`, but eventually I'll be removing the other side.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233095 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoVerifier: !llvm.dbg.cu must point at compile units
Duncan P. N. Exon Smith [Tue, 24 Mar 2015 17:18:03 +0000 (17:18 +0000)]
Verifier: !llvm.dbg.cu must point at compile units

Duplicate this check from `verifyDebugInfo()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233094 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Add MDLocalScope, a legal scope for locals
Duncan P. N. Exon Smith [Tue, 24 Mar 2015 16:44:29 +0000 (16:44 +0000)]
DebugInfo: Add MDLocalScope, a legal scope for locals

Add a subclass of `MDScope` to explicitly categorize the legal scopes
for locals -- in particular, scopes that are legal for `MDLocation`,
`MDLexicalBlockBase`, and `MDLocalVariable`.  This provides a convenient
`isa<>` target for the verifier, and eventually I'll be changing the
above classes' `getScope()` to specifically return it.  Currently, its
subclasses are `MDSubprogram`, `MDLexicalBlock`, and
`MDLexicalBlockFile`.

I've gone with `MDLocalScope` for now -- a little ambiguous since it's a
scope *for* locals, not a scope that's local -- but I'm open to more
descriptive names if someone can think of something better.  Regardless,
the code docs should make it clear enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233092 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in lib/Analysis
David Blaikie [Tue, 24 Mar 2015 16:33:19 +0000 (16:33 +0000)]
Refactor: Simplify boolean expressions in lib/Analysis

Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

Reviewed By: nlewycky

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233091 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in AArch64 target
David Blaikie [Tue, 24 Mar 2015 16:24:01 +0000 (16:24 +0000)]
Refactor: Simplify boolean expressions in AArch64 target

Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

Reviewed By: rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233089 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Support 16-bit offsets for 'm' inline assembly memory constraint.
Daniel Sanders [Tue, 24 Mar 2015 15:19:14 +0000 (15:19 +0000)]
[mips] Support 16-bit offsets for 'm' inline assembly memory constraint.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233086 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Insert more NOPs after READLANE on VI, don't use NOPs on CI
Marek Olsak [Tue, 24 Mar 2015 13:40:38 +0000 (13:40 +0000)]
R600/SI: Insert more NOPs after READLANE on VI, don't use NOPs on CI

This is a candidate for stable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233080 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Select V_BFE_U32 for and+shift with a non-literal offset
Marek Olsak [Tue, 24 Mar 2015 13:40:34 +0000 (13:40 +0000)]
R600/SI: Select V_BFE_U32 for and+shift with a non-literal offset

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233079 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Custom-select 32-bit S_BFE from bitwise opcodes
Marek Olsak [Tue, 24 Mar 2015 13:40:27 +0000 (13:40 +0000)]
R600/SI: Custom-select 32-bit S_BFE from bitwise opcodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233078 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Improve BFM support
Marek Olsak [Tue, 24 Mar 2015 13:40:21 +0000 (13:40 +0000)]
R600/SI: Improve BFM support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233077 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Use V_FRACT_F64 for faster 64-bit floor on SI
Marek Olsak [Tue, 24 Mar 2015 13:40:15 +0000 (13:40 +0000)]
R600/SI: Use V_FRACT_F64 for faster 64-bit floor on SI

Other f64 opcodes not supported on SI can be lowered in a similar way.

v2: use complex VOP3 patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233076 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Expand fract to floor, then only select V_FRACT on CI
Marek Olsak [Tue, 24 Mar 2015 13:40:08 +0000 (13:40 +0000)]
R600/SI: Expand fract to floor, then only select V_FRACT on CI

V_FRACT is buggy on SI.

R600-specific code is left intact.

v2: drop the multiclass, use complex VOP3 patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233075 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInternalize the StackMapLiveness pass.
Benjamin Kramer [Tue, 24 Mar 2015 13:20:54 +0000 (13:20 +0000)]
Internalize the StackMapLiveness pass.

No need to have its own header when it's not used anywhere. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233072 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Use std::bitset for SubtargetFeatures"
Michael Kuperstein [Tue, 24 Mar 2015 12:56:59 +0000 (12:56 +0000)]
Revert "Use std::bitset for SubtargetFeatures"

This reverts commit r233055.

It still causes buildbot failures (gcc running out of memory on several platforms, and a self-host failure on arm), although less than the previous time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233068 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilencing some MSVC warnings "C4805: '^' : unsafe mix of type 'bool' and type 'unsign...
Aaron Ballman [Tue, 24 Mar 2015 12:47:51 +0000 (12:47 +0000)]
Silencing some MSVC warnings "C4805: '^' : unsafe mix of type 'bool' and type 'unsigned int' in operation"; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233067 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Simplify boolean expressions in Mips target with `clang-tidy`
Simon Atanasyan [Tue, 24 Mar 2015 12:24:56 +0000 (12:24 +0000)]
[mips] Simplify boolean expressions in Mips target with `clang-tidy`

No functional changes.

Patch by Richard Thomson.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233065 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[float2int] Sort includes and add missing raw_ostream include.
Benjamin Kramer [Tue, 24 Mar 2015 11:28:47 +0000 (11:28 +0000)]
[float2int] Sort includes and add missing raw_ostream include.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233064 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint.
Daniel Sanders [Tue, 24 Mar 2015 11:26:34 +0000 (11:26 +0000)]
[mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint.

Summary:
Previous behaviour of 'R' and 'm' has been preserved for now. They will be
improved in subsequent commits.

The offset permitted by ZC varies according to the subtarget since it is
intended to match the restrictions of the pref, ll, and sc instructions.

The restrictions on these instructions are:
* For microMIPS: 12-bit signed offset.
* For Mips32r6/Mips64r6: 9-bit signed offset.
* Otherwise: 16-bit signed offset.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233063 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago"float2int": Add a new pass to demote from float to int where possible.
James Molloy [Tue, 24 Mar 2015 11:15:23 +0000 (11:15 +0000)]
"float2int": Add a new pass to demote from float to int where possible.

It is possible to have code that converts from integer to float, performs operations then converts back, and the result is provably the same as if integers were used.

This can come from different sources, but the most obvious is a helper function that uses floats but the arguments given at an inlined callsites are integers.

This pass considers all integers requiring a bitwidth less than or equal to the bitwidth of the mantissa of a floating point type (23 for floats, 52 for doubles) as exactly representable in floating point.

To reduce the risk of harming efficient code, the pass only attempts to perform complete removal of inttofp/fptoint operations, not just move them around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233062 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse std::bitset for SubtargetFeatures
Michael Kuperstein [Tue, 24 Mar 2015 09:17:25 +0000 (09:17 +0000)]
Use std::bitset for SubtargetFeatures

Previously, subtarget features were a bitfield with the underlying type being uint64_t.
Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset.
No functional change.

The first time this was committed (r229831), it caused several buildbot failures.
At least some of the ARM ones were due to gcc/binutils issues, and should now be fixed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233055 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Orc] Move delta-handling for trampoline sizes into the resolver block.
Lang Hames [Tue, 24 Mar 2015 04:27:02 +0000 (04:27 +0000)]
[Orc] Move delta-handling for trampoline sizes into the resolver block.

This is the first step towards adding a target-independent callback
handler API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233049 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Orc] Whitespace fix. NFC.
Lang Hames [Tue, 24 Mar 2015 04:07:28 +0000 (04:07 +0000)]
[Orc] Whitespace fix. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233048 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Orc] Use std::string to capture name by value.
Lang Hames [Tue, 24 Mar 2015 04:07:01 +0000 (04:07 +0000)]
[Orc] Use std::string to capture name by value.

This just updates the code to reflect the comment, but this bug actually hit the
out-of-tree lazy demo. I'm working on a patch to add the lazy-demo's
functionality to lli so that we can test this in-tree soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233047 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SelectionDAG] Fixed issue with uitofp vector constant folding being treated as sitofp
Simon Pilgrim [Mon, 23 Mar 2015 22:44:55 +0000 (22:44 +0000)]
[SelectionDAG] Fixed issue with uitofp vector constant folding being treated as sitofp

While the uitofp scalar constant folding treats an integer as an unsigned value (from lang ref):

%X = sitofp i8 -1 to double ; yields double:-1.0
%Y = uitofp i8 -1 to double ; yields double:255.0

The vector constant folding was always using sitofp:

%X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>
%Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>

This patch fixes this so that the correct opcode is used for sitofp and uitofp.

%X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0>
%Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double 255.0, double 255.0>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233033 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove dead prototype DebugInfoFinder::processExpression(), NFC
Duncan P. N. Exon Smith [Mon, 23 Mar 2015 22:10:27 +0000 (22:10 +0000)]
Remove dead prototype DebugInfoFinder::processExpression(), NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233031 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Overload get() in DIDescriptor subclasses
Duncan P. N. Exon Smith [Mon, 23 Mar 2015 21:54:07 +0000 (21:54 +0000)]
DebugInfo: Overload get() in DIDescriptor subclasses

Continue to simplify the `DIDescriptor` subclasses, so that they behave
more like raw pointers.  Remove `getRaw()`, replace it with an
overloaded `get()`, and overload the arrow and cast operators.  Two
testcases started to crash on the arrow operators with this change
because of `scope:` references that weren't real scopes.  I fixed them.
Soon I'll add verifier checks for them too.

This also adds explicit dereference operators.  Previously, the builtin
dereference against `operator MDNode *()` would have worked, but now the
builtins are ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233030 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor how passes get a symbol at the end of a section.
Rafael Espindola [Mon, 23 Mar 2015 21:22:04 +0000 (21:22 +0000)]
Refactor how passes get a symbol at the end of a section.

There is now a canonical symbol at the end of a section that different
passes can request.

This also allows us to assert that we don't switch back to a section whose
end symbol has already been printed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233026 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCleanup else-after-return and add an early-return to llvm-nm
David Blaikie [Mon, 23 Mar 2015 21:17:43 +0000 (21:17 +0000)]
Cleanup else-after-return and add an early-return to llvm-nm

The loop and error handling in checkMachOAndArchFlags didn't make sense
to me (a loop that only ever executes once? An error path that uses the
element the loop stopped at (which must always be a buffer overrun if
I'm reading that right?)... I'm confused) but I've made a guess at what
was intended.

Based on a patch by Richard Thomson to simplify boolean expressions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233025 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64, ARM] Enable GlobalMerge with -O3 rather than -O1.
Ahmed Bougacha [Mon, 23 Mar 2015 21:17:36 +0000 (21:17 +0000)]
[AArch64, ARM] Enable GlobalMerge with -O3 rather than -O1.

The pass used to be enabled by default with CodeGenOpt::Less (-O1).
This is too aggressive, considering the pass indiscriminately merges
all globals together.

Currently, performance doesn't always improve, and, on code that uses
few globals (e.g., the odd file- or function- static), more often than
not is degraded by the optimization.  Lengthy discussion can be found
on llvmdev (AArch64-focused;  ARM has similar problems):
  http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-February/082800.html
Also, it makes tooling and debuggers less useful when dealing with
globals and data sections.

GlobalMerge needs to better identify those cases that benefit, and this
will be done separately.  In the meantime, move the pass to run with
-O3 rather than -O1, on both ARM and AArch64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233024 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in R600 target
David Blaikie [Mon, 23 Mar 2015 20:56:44 +0000 (20:56 +0000)]
Refactor: Simplify boolean expressions in R600 target

Simplify boolean expressions with `true` and `false` using `clang-tidy`

Patch by Richard Thomson.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233020 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate variable name and reuse existing variable. NFC.
Rafael Espindola [Mon, 23 Mar 2015 20:25:31 +0000 (20:25 +0000)]
Update variable name and reuse existing variable. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233014 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] Add FileCheck that was missing from test in r232967.
Chad Rosier [Mon, 23 Mar 2015 20:25:15 +0000 (20:25 +0000)]
[AArch64] Add FileCheck that was missing from test in r232967.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233013 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-land: Generate targets for each lit suite.
Chris Bieneman [Mon, 23 Mar 2015 20:04:00 +0000 (20:04 +0000)]
Re-land: Generate targets for each lit suite.

Summary:
This change makes CMake scan for lit suites and generate a target for each lit test suite. The targets follow the format check-<project>-<suite path>.

For example:
check-llvm-unit - Runs the LLVM unit tests
check-llvm-codegen-arm - Runs the ARM codeine tests

Note: These targets are not generated during multi-configuration generators (i.e. Xcode and Visual Studio) because target clutter impacts UI usability.

* Also fixed a minor issue that Duncan pointed out to me I was passing the suite to lit twice

Reviewers: chandlerc

Subscribers: aemerson, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233009 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRaising minimum required CMake version to 2.8.12.2.
Chris Bieneman [Mon, 23 Mar 2015 20:03:57 +0000 (20:03 +0000)]
Raising minimum required CMake version to 2.8.12.2.

This commit is in reference to the llvm-dev thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/083672.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233008 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in llvm IR
David Blaikie [Mon, 23 Mar 2015 19:51:23 +0000 (19:51 +0000)]
Refactor: Simplify boolean expressions in llvm IR

Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson with a few other simplifications to fix
else-after-returns in the surrounding code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233005 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in llvm Support
David Blaikie [Mon, 23 Mar 2015 19:45:40 +0000 (19:45 +0000)]
Refactor: Simplify boolean expressions in llvm Support

Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson - I dropped the parens and != 0 test, for
consistency with other patches/tests like this, but I'm open to the
notion that we should add the explicit non-zero test in all these sort
of cases (non-bool assigned to a bool).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233004 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in x86 target
David Blaikie [Mon, 23 Mar 2015 19:42:36 +0000 (19:42 +0000)]
Refactor: Simplify boolean expressions in x86 target

Simplify boolean expressions with `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233002 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-sort includes with sort-includes.py and insert raw_ostream.h where it's used.
Benjamin Kramer [Mon, 23 Mar 2015 19:32:43 +0000 (19:32 +0000)]
Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232998 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ctorutils] Update and sort includes. NFC.
Benjamin Kramer [Mon, 23 Mar 2015 19:06:17 +0000 (19:06 +0000)]
[ctorutils] Update and sort includes. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232995 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[winehprepare] Update and sort includes. NFC.
Benjamin Kramer [Mon, 23 Mar 2015 18:57:17 +0000 (18:57 +0000)]
[winehprepare] Update and sort includes. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232994 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAnother set of missing raw_ostream.h. Still no functional change.
Benjamin Kramer [Mon, 23 Mar 2015 18:45:56 +0000 (18:45 +0000)]
Another set of missing raw_ostream.h. Still no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232993 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Merge tables for commuting
Matt Arsenault [Mon, 23 Mar 2015 18:45:41 +0000 (18:45 +0000)]
R600/SI: Merge tables for commuting

Don't use a separate table for compares anymore,
and use the same VOP2_REV class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232992 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Only use one range of isCommutable for compares
Matt Arsenault [Mon, 23 Mar 2015 18:45:38 +0000 (18:45 +0000)]
R600/SI: Only use one range of isCommutable for compares

Also don't count the class instructions as isCompare anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232991 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Remove redundant unsetting of hasSideEffects
Matt Arsenault [Mon, 23 Mar 2015 18:45:36 +0000 (18:45 +0000)]
R600/SI: Remove redundant unsetting of hasSideEffects

These are already set in the base class for the instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232990 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Move hasSideEffects setting into VOPCX classes
Matt Arsenault [Mon, 23 Mar 2015 18:45:35 +0000 (18:45 +0000)]
R600/SI: Move hasSideEffects setting into VOPCX classes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232989 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Allow commuting compares
Matt Arsenault [Mon, 23 Mar 2015 18:45:30 +0000 (18:45 +0000)]
R600/SI: Allow commuting compares

This enables very common cases to switch to the
smaller encoding.

All of the standard LLVM canonicalizations of comparisons
are the opposite of what we want. Compares with constants
are moved to the RHS, but the first operand can be an inline
immediate, literal constant, or SGPR using the 32-bit VOPC
encoding.

There are additional bad canonicalizations that should
also be fixed, such as canonicalizing ge x, k to gt x, (k + 1)
if this makes k no longer an inline immediate value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232988 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Use right class for cmpsx f64 instructions
Matt Arsenault [Mon, 23 Mar 2015 18:45:23 +0000 (18:45 +0000)]
R600/SI: Use right class for cmpsx f64 instructions

Use VOPCX_F64 to not need the let Defs = [EXEC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232987 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Remove cond operand to VOPCX classes
Matt Arsenault [Mon, 23 Mar 2015 18:45:20 +0000 (18:45 +0000)]
R600/SI: Remove cond operand to VOPCX classes

It isn't used, and these will probably never be directly selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232986 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: simplify boolean expressions in llvm-objdump
David Blaikie [Mon, 23 Mar 2015 18:39:02 +0000 (18:39 +0000)]
Refactor: simplify boolean expressions in llvm-objdump

Simplify boolean expressions involving `true` and `false` with `clang-tidy`.

Actually upon inspection a bunch of these boolean variables could be
factored away entirely anyway - using find_if and then testing the
result before using it. This also helps reduce indentation in the code
anyway - and a bunch of other related simplification fell out nearby so
I just committed all of that.

Patch by Richard Thomson (legalize@xmission.com)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232984 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd missing ELFObjectWriter::reset() override, like other MC classes.
Yaron Keren [Mon, 23 Mar 2015 18:35:01 +0000 (18:35 +0000)]
Add missing ELFObjectWriter::reset() override, like other MC classes.

See detailed discussion at

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140915/235418.html

and r217907, r217948:

 http://llvm.org/viewvc/llvm-project?view=revision&revision=217907
 http://llvm.org/viewvc/llvm-project?view=revision&revision=217948

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232982 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMore missing includes only visible to MSVC.
Benjamin Kramer [Mon, 23 Mar 2015 18:23:08 +0000 (18:23 +0000)]
More missing includes only visible to MSVC.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232981 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd missing include that MSVC complains about.
Benjamin Kramer [Mon, 23 Mar 2015 18:19:41 +0000 (18:19 +0000)]
Add missing include that MSVC complains about.

Also reorder includes a bit, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232980 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPurge unused includes throughout libSupport.
Benjamin Kramer [Mon, 23 Mar 2015 18:07:13 +0000 (18:07 +0000)]
Purge unused includes throughout libSupport.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232976 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AArch64] Enable rematerialization of float 0 values.
Chad Rosier [Mon, 23 Mar 2015 17:19:34 +0000 (17:19 +0000)]
[AArch64] Enable rematerialization of float 0 values.

Patch by Geoff Berry<gberry@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232967 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[ARM] Add more pattern matching for f16 <-> f64 conversions"
Bradley Smith [Mon, 23 Mar 2015 16:52:52 +0000 (16:52 +0000)]
Revert "[ARM] Add more pattern matching for f16 <-> f64 conversions"

This change is incorrect since it converts double rounding into single rounding,
which can produce different results. Instead this optimization will be done by
modifying Clang's codegen to not produce double rounding in the first place.

This reverts commit r232954.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232962 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify boolean expressions with true and false using clang-tidy
Eli Bendersky [Mon, 23 Mar 2015 16:26:23 +0000 (16:26 +0000)]
Simplify boolean expressions with true and false using clang-tidy

Patch by Richard (legalize@xmission.com)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232961 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Remove target-specific ITOFP/FPTOI nodes
James Molloy [Mon, 23 Mar 2015 16:15:16 +0000 (16:15 +0000)]
[ARM] Remove target-specific ITOFP/FPTOI nodes

Anton tried this 5 years ago but it was reverted due to extra VMOVs
being emitted. This can be easily fixed with a liberal application
of patterns - matching loads/stores and extractelts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232958 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600/SI: Fix crash in SIInstrInfo::areLoadsFromSameBasePtr()
Tom Stellard [Mon, 23 Mar 2015 16:06:01 +0000 (16:06 +0000)]
R600/SI: Fix crash in SIInstrInfo::areLoadsFromSameBasePtr()

This function assumed that SMRD instructions always have immediate
offsets, which is not always the case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232957 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Hexagon] Simplify boolean expression
Colin LeMahieu [Mon, 23 Mar 2015 16:01:03 +0000 (16:01 +0000)]
[Hexagon] Simplify boolean expression

Patch by Richard
http://reviews.llvm.org/D8523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232955 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Add more pattern matching for f16 <-> f64 conversions
Bradley Smith [Mon, 23 Mar 2015 15:59:54 +0000 (15:59 +0000)]
[ARM] Add more pattern matching for f16 <-> f64 conversions

Specifically when the conversion is done in two steps, f16 -> f32 -> f64.

For example:

%1 = tail call float @llvm.convert.from.fp16.f32(i16 %0)
%conv = fpext float %1 to double

to:

vcvtb.f64.f16

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232954 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[gcov] Move formatBranchInfo into an anonymous namespace.
Benjamin Kramer [Mon, 23 Mar 2015 13:59:13 +0000 (13:59 +0000)]
[gcov] Move formatBranchInfo into an anonymous namespace.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232949 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove private classes into anonymous namespaces
Benjamin Kramer [Mon, 23 Mar 2015 12:30:58 +0000 (12:30 +0000)]
Move private classes into anonymous namespaces

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232944 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix sign extension for MIPS64 in makeLibCall function
Petar Jovanovic [Mon, 23 Mar 2015 12:28:13 +0000 (12:28 +0000)]
Fix sign extension for MIPS64 in makeLibCall function

Fixing sign extension in makeLibCall for MIPS64. In MIPS64 architecture all
32 bit arguments (int, unsigned int, float 32 (soft float)) must be sign
extended. This fixes test "MultiSource/Applications/oggenc/".

Patch by Strahinja Petrovic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232943 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[aarch64] Distinguish the 'Q' and 'm' inline assembly memory constraints.
Daniel Sanders [Mon, 23 Mar 2015 11:33:15 +0000 (11:33 +0000)]
[aarch64] Distinguish the 'Q' and 'm' inline assembly memory constraints.

Summary:
But still handle them the same way since I don't know how they differ on
this target.

Clang also has code for 'Ump', 'Utf', 'Usa', and 'Ush' but calls
llvm_unreachable() on this code path so they are not converted to a
constraint id at the moment.

No functional change intended.

Reviewers: t.p.northover

Subscribers: aemerson, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232941 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SDAG] Don't widen VSETCC during type legalization for split operands
Hal Finkel [Mon, 23 Mar 2015 08:22:43 +0000 (08:22 +0000)]
[SDAG] Don't widen VSETCC during type legalization for split operands

Because the operands of a vector SETCC node can be of a different type from the
result (and often are), it can happen that even if we'd prefer to widen the
result type of the SETCC, the operands have been split instead. In this case,
the SETCC result also must be split. This mirrors what is done in
WidenVecRes_SELECT, and should be NFC elsewhere because if the operands are not
widened the following calls to GetWidenedVector will assert (which is what was
happening in the test case).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232935 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Orc] Add missing -use-orcmcjit flag to a number of Orc regression tests.
Lang Hames [Mon, 23 Mar 2015 06:02:49 +0000 (06:02 +0000)]
[Orc] Add missing -use-orcmcjit flag to a number of Orc regression tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232931 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix typo 'AVX too' instead of 'AVX2'
Craig Topper [Mon, 23 Mar 2015 04:17:11 +0000 (04:17 +0000)]
Fix typo 'AVX too' instead of 'AVX2'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232929 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] Add one stepping of Broadwell to the CPU name autodetection for march=native.
Craig Topper [Mon, 23 Mar 2015 00:15:06 +0000 (00:15 +0000)]
[X86] Add one stepping of Broadwell to the CPU name autodetection for march=native.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232927 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence a GCC warning
David Majnemer [Sun, 22 Mar 2015 21:27:10 +0000 (21:27 +0000)]
Silence a GCC warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232923 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFoldingSet: Make FoldingSetImpl's dtor protected and non-virtual
Benjamin Kramer [Sun, 22 Mar 2015 18:22:33 +0000 (18:22 +0000)]
FoldingSet: Make FoldingSetImpl's dtor protected and non-virtual

It's not intended to be polymorphically deleted. Make FoldingSet
and ContextualFoldingSet final to avoid noise from -Wnon-virtual-dtor.

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232922 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPrevent CHECK-NOTs from matching file paths
Duncan P. N. Exon Smith [Sun, 22 Mar 2015 15:58:21 +0000 (15:58 +0000)]
Prevent CHECK-NOTs from matching file paths

A build directory with a name like `build-Werror` would hit a false
positive on these `CHECK-NOT`s before, since the actual error line looks
like:

    .../build-Werror/bin/llvm-as <stdin>:1:2: error: ...

Switch to using:

    CHECK-NOT: error:

(note the trailing semi-colon) to avoid matching almost any file path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232917 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFixed MSVC compile warning issue introduced in r232837
Simon Pilgrim [Sun, 22 Mar 2015 13:38:36 +0000 (13:38 +0000)]
Fixed MSVC compile warning issue introduced in r232837

- was reporting 'warning C4715: 'getType32' : not all control paths return a value'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232913 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SimplifyLibCalls] Fix negative shifts being produced by the memchr -> bitfield trans...
Benjamin Kramer [Sat, 21 Mar 2015 22:04:26 +0000 (22:04 +0000)]
[SimplifyLibCalls] Fix negative shifts being produced by the memchr -> bitfield transform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232903 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SimplifyLibCalls] Turn memchr(const, C, const) into a bitfield check.
Benjamin Kramer [Sat, 21 Mar 2015 21:09:33 +0000 (21:09 +0000)]
[SimplifyLibCalls] Turn memchr(const, C, const) into a bitfield check.

strchr("123!", C) != nullptr is a common pattern to check if C is one
of 1, 2, 3 or !. If the largest element of the string is smaller than
the target's register size we can easily create a bitfield and just
do a simple test for set membership.

int foo(char C) { return strchr("123!", C) != nullptr; } now becomes

cmpl $64, %edi ## range check
sbbb %al, %al
movabsq $0xE000200000001, %rcx
btq %rdi, %rcx ## bit test
sbbb %cl, %cl
andb %al, %cl ## and the two conditions
andb $1, %cl
movzbl %cl, %eax ## returning an int
ret

(imho the backend should expand this into a series of branches, but
that's a different story)

The code is currently limited to bit fields that fit in a register, so
usually 64 or 32 bits. Sadly, this misses anything using alpha chars
or {}. This could be fixed by just emitting a i128 bit field, but that
can generate really ugly code so we have to find a better way. To some
degree this is also recreating switch lowering logic, but we can't
simply emit a switch instruction and thus change the CFG within
instcombine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232902 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoR600: Cleanup test with multiple check prefixes
Matt Arsenault [Sat, 21 Mar 2015 19:15:46 +0000 (19:15 +0000)]
R600: Cleanup test with multiple check prefixes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232901 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoStringRef: Just forward StringRef::find to libc's memchr.
Benjamin Kramer [Sat, 21 Mar 2015 16:42:35 +0000 (16:42 +0000)]
StringRef: Just forward StringRef::find to libc's memchr.

Modern libc's have an SSE version of memchr which is a lot faster than our
hand-rolled version. In the past I was reluctant to use it because Darwin's
memchr used a naive ridiculously slow implementation, but that has been fixed
some versions ago.

Should have zero functional impact.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232898 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert accidental commit.
Benjamin Kramer [Sat, 21 Mar 2015 15:37:32 +0000 (15:37 +0000)]
Revert accidental commit.

While this is a fun change, I didn't really test it :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232897 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplifyLibCalls: Add basic optimization of memchr calls.
Benjamin Kramer [Sat, 21 Mar 2015 15:36:21 +0000 (15:36 +0000)]
SimplifyLibCalls: Add basic optimization of memchr calls.

This is just memchr(x, y, 0) -> nullptr and constant folding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232896 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoValueTracking: Forward getConstantStringInfo's TrimAtNul param into recursive invocation
Benjamin Kramer [Sat, 21 Mar 2015 15:36:06 +0000 (15:36 +0000)]
ValueTracking: Forward getConstantStringInfo's TrimAtNul param into recursive invocation

Currently this is only used to tweak the backend's memcpy inlining
heuristics, testing that isn't very helpful. A real test case will
follow in the next commit, where this behavior would cause a real
miscompilation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232895 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTidied up vec_zero_cse.ll test. NFCI.
Simon Pilgrim [Sat, 21 Mar 2015 14:05:12 +0000 (14:05 +0000)]
Tidied up vec_zero_cse.ll test. NFCI.

Added target triple and refactored the CHECKs to be per function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232894 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMemoryDependenceAnalysis: Don't miscompile atomics
David Majnemer [Sat, 21 Mar 2015 06:19:17 +0000 (06:19 +0000)]
MemoryDependenceAnalysis: Don't miscompile atomics

r216771 introduced a change to MemoryDependenceAnalysis that allowed it
to reason about acquire/release operations.  However, this change does
not ensure that the acquire/release operations pair.  Unfortunately,
this leads to miscompiles as we won't see an acquire load as properly
memory effecting.  This largely reverts r216771.

This fixes PR22708.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232889 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAArch64: simplify test case
Tim Northover [Sat, 21 Mar 2015 04:37:08 +0000 (04:37 +0000)]
AArch64: simplify test case

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232886 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove the target independent TargetMachine::getSubtarget and
Eric Christopher [Sat, 21 Mar 2015 04:22:23 +0000 (04:22 +0000)]
Remove the target independent TargetMachine::getSubtarget and
TargetMachine::getSubtargetImpl routines.

This keeps the target independent code free of bare subtarget
calls while the remainder of the backends are migrated, or not
if they don't wish to support per-function subtargets as would
be needed for function multiversioning or LTO of disparate
cpu subarchitecture types, e.g.

clang -msse4.2 -c foo.c -emit-llvm -o foo.bc
clang -c bar.c -emit-llvm -o bar.bc
llvm-link foo.bc bar.bc -o baz.bc
llc baz.bc

and get appropriate code for what the command lines requested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232885 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove the bare getSubtargetImpl call from the AArch64 port. As part
Eric Christopher [Sat, 21 Mar 2015 04:04:50 +0000 (04:04 +0000)]
Remove the bare getSubtargetImpl call from the AArch64 port. As part
of this add a test that shows we can generate code for functions
that specifically enable a subtarget feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232884 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove the bare getSubtargetImpl call from the PPC port. As part
Eric Christopher [Sat, 21 Mar 2015 03:36:02 +0000 (03:36 +0000)]
Remove the bare getSubtargetImpl call from the PPC port. As part
of this add a test that shows we can generate code with
for functions that differ by subtarget feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232882 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoForward the Function based getSubtarget call to the appropriate Impl
Eric Christopher [Sat, 21 Mar 2015 03:32:45 +0000 (03:32 +0000)]
Forward the Function based getSubtarget call to the appropriate Impl
call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232881 91177308-0d34-0410-b5e6-96231b3b80d8