oota-llvm.git
7 years agoStop calling the flat out insane ARM target parsing code unless the
Chandler Carruth [Sun, 30 Aug 2015 09:54:34 +0000 (09:54 +0000)]
Stop calling the flat out insane ARM target parsing code unless the
architecture string is something quite weird. Similarly delay calling
the BPF parsing code, although that is more reasonable.

To understand why I was motivated to make this change, it cuts the time
for running the ADT TripleTest unittests by a factor of two in
non-optimized builds (the developer default) and reduces my 'check-llvm'
time by a full 15 seconds. The implementation of parseARMArch is *that*
slow. I tried to fix it in the prior series of commits, but frankly,
I have no idea how to finish fixing it. The entire premise of the
function (to allow 'v7a-unknown-linux' or some such to parse as an
'arm-unknown-linux' triple) seems completely insane to me, but I'll let
the ARM folks sort that out. At least it is now out of the critical path
of every developer working on LLVM. It also will likely make some other
folks' code significantly faster as I've heard reports of 2% of time
spent in triple parsing even in optimized builds!

I'm not done making this code faster, but I am done trying to improve
the ARM target parsing code.

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

7 years agoRemove a linear walk to find the default FPU for a given CPU by directly
Chandler Carruth [Sun, 30 Aug 2015 09:01:38 +0000 (09:01 +0000)]
Remove a linear walk to find the default FPU for a given CPU by directly
expanding the .def file within a StringSwitch.

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

7 years ago[MIR Serialization] static -> static const in getSerializable*MachineOperandTargetFlags
Hal Finkel [Sun, 30 Aug 2015 08:07:29 +0000 (08:07 +0000)]
[MIR Serialization] static -> static const in getSerializable*MachineOperandTargetFlags

Make the arrays 'static const' instead of just 'static'. Post-commit review
comment from Roman Divacky on IRC. NFC.

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

7 years agoTeach the target parsing framework to directly compute the length of all
Chandler Carruth [Sun, 30 Aug 2015 07:51:04 +0000 (07:51 +0000)]
Teach the target parsing framework to directly compute the length of all
of its strings when expanding the string literals from the macros, and
push all of the APIs to be StringRef instead of C-string APIs.

This (remarkably) removes a very non-trivial number of strlen calls. It
even deletes code and complexity from one of the primary users -- Clang.

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

7 years ago[PowerPC/MIR Serialization] Target flags serialization support
Hal Finkel [Sun, 30 Aug 2015 07:50:35 +0000 (07:50 +0000)]
[PowerPC/MIR Serialization] Target flags serialization support

Add support for MIR serialization of PowerPC-specific operand target flags
(based on the generic infrastructure added in r244185 and r245383).

I won't even pretend that this is good test coverage, but this includes the
regression test associated with r246372. Adding an MIR test for that fix is far
superior to adding an IR-level test because particular instruction-scheduling
decisions are necessary in order to expose the bug, and using an MIR test we
can start the pipeline post-scheduling.

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

7 years ago[PowerPC] Don't assume ADDISdtprelHA's source is r3
Hal Finkel [Sun, 30 Aug 2015 07:44:05 +0000 (07:44 +0000)]
[PowerPC] Don't assume ADDISdtprelHA's source is r3

Even through ADDISdtprelHA generally has r3 as its source register, it is
possible for the instruction scheduler to move things around such that some
other register is the source. We need to print the actual source register, not
always r3. Fixes PR24394.

The test case will come in a follow-up commit because it depends on MIR
target-flags parsing.

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

7 years agoNew interface function is added to VectorUtils
Elena Demikhovsky [Sun, 30 Aug 2015 07:28:18 +0000 (07:28 +0000)]
New interface function is added to VectorUtils
Value *getSplatValue(Value *Val);

It complements the CreateVectorSplat(), which creates 2 instructions - insertelement and shuffle with all-zero mask.

The new function recognizes the pattern - insertelement+shuffle and returns the splat value (or nullptr).
It also returns a splat value form ConstantDataVector, for completeness.

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

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

7 years agoRefactor the ARM target parsing to use a def file with macros to expand
Chandler Carruth [Sun, 30 Aug 2015 05:27:31 +0000 (05:27 +0000)]
Refactor the ARM target parsing to use a def file with macros to expand
the necessary tables.

This will allow me to restructure the code and structures using this to
be significantly more efficient. It also removes the duplication of the
list of several enumerators. It also enshrines that the order of
enumerators match the order of the entries in the tables, something the
implementation code actually uses.

No functionality changed (yet).

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

7 years ago[Triple] Use clang-format to normalize the formatting of the ARM target
Chandler Carruth [Sun, 30 Aug 2015 02:17:15 +0000 (02:17 +0000)]
[Triple] Use clang-format to normalize the formatting of the ARM target
parsing logic prior to making substantial changes to it.

This parsing logic is incredibly wasteful, so I'm planning to rewrite
it. Just unittesting the triple parsing logic spends well over 80% of
its time in the ARM parsing logic, and others have measured significant
time spent here in real production compiles.

Stay tuned...

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

7 years ago[Triple] Stop abusing a class to have only static methods and just use
Chandler Carruth [Sun, 30 Aug 2015 02:09:48 +0000 (02:09 +0000)]
[Triple] Stop abusing a class to have only static methods and just use
the namespace that we are already using for the enums that are produced
by the parsing.

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

7 years agoSelectionDAG: add missing ComputeSignBits case for SELECT_CC
Fiona Glaser [Sat, 29 Aug 2015 23:04:38 +0000 (23:04 +0000)]
SelectionDAG: add missing ComputeSignBits case for SELECT_CC

Identical to SELECT, just with different operand numbers.

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

7 years agoFix shared library build.
Peter Collingbourne [Sat, 29 Aug 2015 22:34:34 +0000 (22:34 +0000)]
Fix shared library build.

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

7 years ago[ARM] Fix up buildbots after r246360
James Molloy [Sat, 29 Aug 2015 11:50:08 +0000 (11:50 +0000)]
[ARM] Fix up buildbots after r246360

I have no idea how I missed this in my internal testing. Just no idea. Sorry for the bot-armageddon.

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

7 years ago[ARM] Hoist fabs/fneg above a conversion to float.
James Molloy [Sat, 29 Aug 2015 10:49:11 +0000 (10:49 +0000)]
[ARM] Hoist fabs/fneg above a conversion to float.

This is especially visible in softfp mode, for example in the implementation of libm fabs/fneg functions. If we have:

%1 = vmovdrr r0, r1
%2 = fabs %1

then move the fabs before the vmovdrr:

%1 = and r1, #0x7FFFFFFF
%2 = vmovdrr r0, r1

This is never a lose, and could be a serious win because the vmovdrr may be followed by a vmovrrd, which would enable us to remove the conversion into FPRs completely.

We already do this for f32, but not for f64. Tests are added for both.

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

7 years agoAMDGPU: Add sdst operand to VOP2b instructions
Matt Arsenault [Sat, 29 Aug 2015 07:16:50 +0000 (07:16 +0000)]
AMDGPU: Add sdst operand to VOP2b instructions

The VOP3 encoding of these allows any SGPR pair for the i1
output, but this was forced before to always use vcc.
This doesn't yet try to use this, but does add the operand
to the definitions so the main change is adding vcc to the
output of the VOP2 encoding.

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

7 years agoAMDGPU: Set mem operands for spill instructions
Matt Arsenault [Sat, 29 Aug 2015 06:48:57 +0000 (06:48 +0000)]
AMDGPU: Set mem operands for spill instructions

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

7 years agoAMDGPU: Fix dropping mem operands when moving to VALU
Matt Arsenault [Sat, 29 Aug 2015 06:48:46 +0000 (06:48 +0000)]
AMDGPU: Fix dropping mem operands when moving to VALU

Without a memory operand, mayLoad or mayStore instructions
are treated as hasUnorderedMemRef, which results in much worse
scheduling.

We really should have a verifier check that any
non-side effecting mayLoad or mayStore has a memory operand.
There are a few instructions (interp and images) which I'm
not sure what / where to add these.

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

7 years agoAMDGPU/SI: Fix some invaild assumptions when folding 64-bit immediates
Tom Stellard [Sat, 29 Aug 2015 01:58:21 +0000 (01:58 +0000)]
AMDGPU/SI: Fix some invaild assumptions when folding 64-bit immediates

Summary:
We were assuming tha if the use operand had a sub-register that
the immediate was 64-bits, but this was breaking the case of
folding a 64-bit immediate into another 64-bit instruction.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

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

7 years agoAMDGPU/SI: Factor operand folding code into its own function
Tom Stellard [Fri, 28 Aug 2015 23:45:19 +0000 (23:45 +0000)]
AMDGPU/SI: Factor operand folding code into its own function

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

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

7 years agoRevert r246350, "The host and default target triples do not need to match for "native""
NAKAMURA Takumi [Fri, 28 Aug 2015 23:33:17 +0000 (23:33 +0000)]
Revert r246350, "The host and default target triples do not need to match for "native""

Wrong assumption. Consider --host=x86_64-linux --target=(i686|x86_64)-win32. See also r193459.

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

7 years agoDI: Update tests before adding !dbg subprogram attachments
Duncan P. N. Exon Smith [Fri, 28 Aug 2015 23:32:00 +0000 (23:32 +0000)]
DI: Update tests before adding !dbg subprogram attachments

I'm working on adding !dbg attachments to functions (PR23367), which
we'll use to determine the canonical subprogram for a function (instead
of the `subprograms:` array in the compile units).  This updates a few
old tests in preparation.

Transforms/Mem2Reg/ConvertDebugInfo2.ll had an old-style grep+count
based test that would start to fail because I've added an extra line
with `!dbg`.  Instead, explicitly `CHECK` for what I think the test
actually cares about.

All three testcases have subprograms with a valid `function:` reference
-- which means my upgrade script will add a `!dbg` attachment -- but
that aren't referenced from any compile unit.  I suspect these testcases
were handreduced over-zealously (or have bitrotted?).  Add a reference
from the compile unit so that upcoming Verifier checks won't fail here.

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

7 years agoThe host and default target triples do not need to match for "native"
Paul Robinson [Fri, 28 Aug 2015 23:21:15 +0000 (23:21 +0000)]
The host and default target triples do not need to match for "native"
backend to work.

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

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

7 years agoDI: Set DILexicalBlock columns >= 65536 to 0/unknown
Duncan P. N. Exon Smith [Fri, 28 Aug 2015 22:58:50 +0000 (22:58 +0000)]
DI: Set DILexicalBlock columns >= 65536 to 0/unknown

This fixes PR24621 and matches what we do for `DILocation`.  Although
the limit seems somewhat artificial, there are places in the backend
that also assume 16-bit columns, so we may as well just be consistent
about the limits.

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

7 years agoUse UNSUPPORTED instead of XFAIL to disable this test, as it passes on one AArch64...
Peter Collingbourne [Fri, 28 Aug 2015 22:17:29 +0000 (22:17 +0000)]
Use UNSUPPORTED instead of XFAIL to disable this test, as it passes on one AArch64 bot.

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

7 years agolit: Match UNSUPPORTED against target triple as we do for XFAIL.
Peter Collingbourne [Fri, 28 Aug 2015 22:17:28 +0000 (22:17 +0000)]
lit: Match UNSUPPORTED against target triple as we do for XFAIL.

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

7 years ago[X86] NFC: Clean up and clang-format a few lines
Vedant Kumar [Fri, 28 Aug 2015 21:59:00 +0000 (21:59 +0000)]
[X86] NFC: Clean up and clang-format a few lines

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

7 years agoDI: Add Function::getSubprogram()
Duncan P. N. Exon Smith [Fri, 28 Aug 2015 21:55:35 +0000 (21:55 +0000)]
DI: Add Function::getSubprogram()

Add `Function::setSubprogram()` and `Function::getSubprogram()`,
convenience methods to forward to `setMetadata()` and `getMetadata()`,
respectively, and deal in `DISubprogram` instead of `MDNode`.

Also add a verifier check to enforce that `!dbg` attachments are always
subprograms.

Originally (when I had the llvm-dev discussion back in April) I thought
I'd store a pointer directly on `llvm::Function` for these attachments
-- we frequently have debug info, and that's much cheaper than using map
in the context if there are no other function-level attachments -- but
for now I'm just using the generic infrastructure.  Let's add the extra
complexity only if this shows up in a profile.

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

7 years agoAsmPrinter: Allow null subroutine type
Duncan P. N. Exon Smith [Fri, 28 Aug 2015 21:38:24 +0000 (21:38 +0000)]
AsmPrinter: Allow null subroutine type

Currently the DWARF backend requires that subprograms have a type, and
the type is ignored if it has an empty type array.  The long term
direction here -- see PR23079 -- is instead to skip the type entirely if
there's no valid type.

It turns out we have cases in tree of missing types on subprograms, but
since they're not referenced by compile units, the backend never crashes
on them.  One option would be to add a Verifier check that subprograms
have types, and fix the bitrot.  However, this is a fair bit of churn
(20-30 testcases) that would be reversed anyway by PR23079.

I found this inconsistency because of a WIP patch and upgrade script for
PR23367 that started crashing on test/DebugInfo/2010-10-01-crash.ll.
This commit updates the testcase to reference the subprogram from the
compile unit, and fixes the resulting crash (in line with the direction
of PR23079).  This also updates `DIBuilder` to stop assuming a non-null
pointer for the subroutine types.

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

7 years agoRevert r246232 and r246304.
David Majnemer [Fri, 28 Aug 2015 21:13:39 +0000 (21:13 +0000)]
Revert r246232 and r246304.

This reverts isSafeToSpeculativelyExecute's use of ReadNone until we
split ReadNone into two pieces: one attribute which reasons about how
the function reasons about memory and another attribute which determines
how it may be speculated, CSE'd, trap, etc.

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

7 years agoRemove white space (test commit)
Matthew Simpson [Fri, 28 Aug 2015 20:38:33 +0000 (20:38 +0000)]
Remove white space (test commit)

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

7 years agoSplit the gold tests into X86 and PowerPC directories.
Rafael Espindola [Fri, 28 Aug 2015 20:33:56 +0000 (20:33 +0000)]
Split the gold tests into X86 and PowerPC directories.

Patch by Than McIntosh!

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

7 years agoDI: Require subprogram definitions to be distinct
Duncan P. N. Exon Smith [Fri, 28 Aug 2015 20:26:49 +0000 (20:26 +0000)]
DI: Require subprogram definitions to be distinct

As a follow-up to r246098, require `DISubprogram` definitions
(`isDefinition: true`) to be 'distinct'.  Specifically, add an assembler
check, a verifier check, and bitcode upgrading logic to combat testcase
bitrot after the `DIBuilder` change.

While working on the testcases, I realized that
test/Linker/subprogram-linkonce-weak-odr.ll isn't relevant anymore.  Its
purpose was to check for a corner case in PR22792 where two subprogram
definitions match exactly and share the same metadata node.  The new
verifier check, requiring that subprogram definitions are 'distinct',
precludes that possibility.

I updated almost all the IR with the following script:

    git grep -l -E -e '= !DISubprogram\(.* isDefinition: true' |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's/= \(!DISubprogram(.*, isDefinition: true\)/= distinct \1/'

Likely some variant of would work for out-of-tree testcases.

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

7 years ago[IR] Add some asserts to CallInst and InvokeInst; NFCI.
Sanjoy Das [Fri, 28 Aug 2015 19:09:34 +0000 (19:09 +0000)]
[IR] Add some asserts to CallInst and InvokeInst; NFCI.

The asserts check that accessors supposed to access call / invoke
arguments only ever access call / invoke arguments.

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

7 years ago[InstCombine] Fix PR24605.
Sanjoy Das [Fri, 28 Aug 2015 19:09:31 +0000 (19:09 +0000)]
[InstCombine] Fix PR24605.

PR24605 is caused due to an incorrect insert point in instcombine's IR
builder.  When simplifying

  %t = add X Y
  ...
  %m = icmp ... %t

the replacement for %t should be placed before %t, not before %m, as
there could be a use of %t between %t and %m.

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

7 years agoOptimize memcmp(x,y,n)==0 for small n and suitably aligned x/y.
Chad Rosier [Fri, 28 Aug 2015 18:30:18 +0000 (18:30 +0000)]
Optimize memcmp(x,y,n)==0 for small n and suitably aligned x/y.

http://reviews.llvm.org/D6952
PR20673

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

7 years ago[test] (NFC) Simplify Transforms/ConstProp/calls.ll
Vedant Kumar [Fri, 28 Aug 2015 18:04:20 +0000 (18:04 +0000)]
[test] (NFC) Simplify Transforms/ConstProp/calls.ll

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

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

7 years ago[mips64][mcjit] Add N64R6 relocations tests and fix N64R2 tests
Petar Jovanovic [Fri, 28 Aug 2015 18:02:53 +0000 (18:02 +0000)]
[mips64][mcjit] Add N64R6 relocations tests and fix N64R2 tests

This patch adds a test for MIPS64R6 relocations, it corrects check
expressions for R_MIPS_26 and R_MIPS_PC16 relocations in MIPS64R2 test, and
it adds run for big endian in MIPS64R2 test.

Patch by Vladimir Radosavljevic.

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

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

7 years ago[mips] Remove incorrect DebugLoc entries from prologue
Petar Jovanovic [Fri, 28 Aug 2015 17:53:26 +0000 (17:53 +0000)]
[mips] Remove incorrect DebugLoc entries from prologue

This has been causing the prologue_end to be incorrectly positioned.

Patch by Vladimir Radosavljevic.

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

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

7 years agoMake MergeConsecutiveStores look at other stores on same chain
Matt Arsenault [Fri, 28 Aug 2015 17:31:28 +0000 (17:31 +0000)]
Make MergeConsecutiveStores look at other stores on same chain

When combiner AA is enabled, look at stores on the same chain.
Non-aliasing stores are moved to the same chain so the existing
code fails because it expects to find an adajcent store on a consecutive
chain.

Because of how DAGCombiner tries these store combines,
MergeConsecutiveStores doesn't see the correct set of stores on the chain
when it visits the other stores. Each store individually has its chain
fixed before trying to merge consecutive stores, and then tries to merge
stores from that point before the other stores have been processed to
have their chains fixed. To fix this, attempt to use FindBetterChain
on any possibly neighboring stores in visitSTORE.

Suppose you have 4 32-bit stores that should be merged into 1 vector
store. One store would be visited first, fixing the chain. What happens is
because not all of the store chains have yet been fixed, 2 of the stores
are merged. The other 2 stores later have their chains fixed,
but because the other stores were already merged, they have different
memory types and merging the two different sized stores is not
supported and would be more difficult to handle.

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

7 years agoTest case for r246304.
David Majnemer [Fri, 28 Aug 2015 17:19:54 +0000 (17:19 +0000)]
Test case for r246304.

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

7 years agoRemove Merge Functions pointer comparisons
JF Bastien [Fri, 28 Aug 2015 16:49:09 +0000 (16:49 +0000)]
Remove Merge Functions pointer comparisons

Summary:
This patch removes two remaining places where pointer value comparisons
are used to order functions: comparing range annotation metadata, and comparing
block address constants. (These are both rare cases, and so no actual
non-determinism was observed from either case).

The fix for range metadata is simple: the annotation always consists of a pair
of integers, so we just order by those integers.

The fix for block addresses is more subtle. Two constants are the same if they
are the same basic block in the same function, or if they refer to corresponding
basic blocks in each respective function. Note that in the first case, merging
is trivially correct. In the second, the correctness of merging relies on the
fact that the the values of block addresses cannot be compared. This change is
actually an enhancement, as these functions could not previously be merged (see
merge-block-address.ll).

There is still a problem with cross function block addresses, in that constants
pointing to a basic block in a merged function is not updated.

This also more robustly compares floating point constants by all fields of their
semantics, and fixes a dyn_cast/cast mixup.

Author: jrkoenig
Reviewers: dschuff, nlewycky, jfb
Subscribers llvm-commits
Differential revision: http://reviews.llvm.org/D12376

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

7 years ago[CodeGen] isInTailCallPosition didn't consider readnone tailcalls
David Majnemer [Fri, 28 Aug 2015 16:44:09 +0000 (16:44 +0000)]
[CodeGen] isInTailCallPosition didn't consider readnone tailcalls

A readnone tailcall may still have a chain of computation which follows
it that would invalidate a tailcall lowering.  Don't skip the analysis
in such cases.

This fixes PR24613.

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

7 years ago[LoopUtils] Move a private constructor nearer the other private members
James Molloy [Fri, 28 Aug 2015 14:40:29 +0000 (14:40 +0000)]
[LoopUtils] Move a private constructor nearer the other private members

This was part of Adam Nemet's review feedback that I forgot to implement.

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

7 years ago[x86] enable machine combiner reassociations for scalar 'and' insts
Sanjay Patel [Fri, 28 Aug 2015 14:09:48 +0000 (14:09 +0000)]
[x86] enable machine combiner reassociations for scalar 'and' insts

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

7 years ago[MC] Convert tests to use llvm-readobj --macho-version-min.
Davide Italiano [Fri, 28 Aug 2015 12:40:05 +0000 (12:40 +0000)]
[MC] Convert tests to use llvm-readobj --macho-version-min.

As an added bonus this also tests the newly introduced feature.

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

7 years agollvm-readobj: Dump more info for COFF import libraries.
Rui Ueyama [Fri, 28 Aug 2015 10:27:50 +0000 (10:27 +0000)]
llvm-readobj: Dump more info for COFF import libraries.

This patch teaches llvm-readobj to print out COFF import file header fields.

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

7 years ago[SROA] Fix PR24463, a crash I introduced in SROA by allowing it to
Chandler Carruth [Fri, 28 Aug 2015 09:03:52 +0000 (09:03 +0000)]
[SROA] Fix PR24463, a crash I introduced in SROA by allowing it to
handle more allocas with loads past the end of the alloca.

I suspect there are some related crashers with slightly different
patterns, but I'll fix those and add test cases as I find them.

Thanks to David Majnemer for the excellent test case reduction here.
Made this super simple to debug and fix.

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

7 years agoAttempt to unbreak Win32 build.
Rui Ueyama [Fri, 28 Aug 2015 07:48:41 +0000 (07:48 +0000)]
Attempt to unbreak Win32 build.

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

7 years agoRe-apply r246276 - Object: Teach llvm-ar to create symbol table for COFF short import...
Rui Ueyama [Fri, 28 Aug 2015 07:40:30 +0000 (07:40 +0000)]
Re-apply r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files

This patch includes a fix for a llvm-readobj test. With this patch,
the tool does no longer print out COFF headers for the short import
file, but that's probably desirable because the header for the short
import file is dummy.

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

7 years agoRevert r246244 and r246243
Steven Wu [Fri, 28 Aug 2015 06:52:00 +0000 (06:52 +0000)]
Revert r246244 and r246243

These two commits cause clang/llvm bootstrap to hang.

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

7 years agoRollback r246276 - Object: Teach llvm-ar to create symbol table for COFF short import...
Rui Ueyama [Fri, 28 Aug 2015 06:03:01 +0000 (06:03 +0000)]
Rollback r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files

This change caused a test for llvm-readobj to fail.

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

7 years agoObject: Teach llvm-ar to create symbol table for COFF short import files.
Rui Ueyama [Fri, 28 Aug 2015 05:47:46 +0000 (05:47 +0000)]
Object: Teach llvm-ar to create symbol table for COFF short import files.

COFF short import files are special kind of files that contains only
DLL-exported symbol names. That's different from object files because
it has no data except symbol names.

This change implements a SymbolicFile interface for the short import
files so that symbol names can be accessed through that interface.
llvm-ar is now able to read the file and create symbol table entries
for short import files.

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

7 years agoLLVMCodeGen: Update libdeps corresponding to r246236.
NAKAMURA Takumi [Fri, 28 Aug 2015 05:38:49 +0000 (05:38 +0000)]
LLVMCodeGen: Update libdeps corresponding to r246236.

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

7 years agoTweak XFAIL line for mips.
Peter Collingbourne [Fri, 28 Aug 2015 04:07:52 +0000 (04:07 +0000)]
Tweak XFAIL line for mips.

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

7 years agoKaleidoscope: Prune __attribute__((used)). Some compilers wouldn't accept one.
NAKAMURA Takumi [Fri, 28 Aug 2015 03:34:33 +0000 (03:34 +0000)]
Kaleidoscope: Prune __attribute__((used)). Some compilers wouldn't accept one.

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

7 years agoDisable llvm/test/Examples/ for now while investigating.
NAKAMURA Takumi [Fri, 28 Aug 2015 03:32:43 +0000 (03:32 +0000)]
Disable llvm/test/Examples/ for now while investigating.

FIXME:
  - Introduce explicit mapping.
  - Investigate crash on win32. Could we introduce crash handler in examples?

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

7 years agoXFAIL parallel.ll test on MIPS and AArch64 until test failures can be investigated.
Peter Collingbourne [Fri, 28 Aug 2015 02:14:15 +0000 (02:14 +0000)]
XFAIL parallel.ll test on MIPS and AArch64 until test failures can be investigated.

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

7 years ago[CodeGen] Support (and default to) expanding READCYCLECOUNTER to 0.
Ahmed Bougacha [Fri, 28 Aug 2015 01:49:59 +0000 (01:49 +0000)]
[CodeGen] Support (and default to) expanding READCYCLECOUNTER to 0.

For targets that didn't support this, this will let us respect the
langref instead of failing to select.

Note that we don't need to change the 32-bit x86/PPC lowerings (to
account for the result type/# difference) because they're both
custom and bypass type legalization.

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

7 years ago[WinEH] Update coloring to handle nested cases cleanly
Joseph Tremoulet [Fri, 28 Aug 2015 01:12:35 +0000 (01:12 +0000)]
[WinEH] Update coloring to handle nested cases cleanly

Summary:
Change the coloring algorithm in WinEHPrepare to visit a funclet's exits
in its parents' contexts and so properly classify the continuations of
nested funclets.

Also change the placement of cloned blocks to be deterministic and to
maintain the relative order of each funclet's blocks.

Add a lit test showing various patterns that require cloning, the last
several of which don't have CHECKs yet because they require cloning
entire funclets which is NYI.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

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

7 years agoConstant propagation after hitting assume(cmp) bugfix
Piotr Padlewski [Fri, 28 Aug 2015 01:02:00 +0000 (01:02 +0000)]
Constant propagation after hitting assume(cmp) bugfix

Last time code run into assertion `BBE.isSingleEdge()` in
lib/IR/Dominators.cpp:200.

http://reviews.llvm.org/D12170

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

7 years agoConstant propagation after hiting llvm.assume
Piotr Padlewski [Fri, 28 Aug 2015 01:01:57 +0000 (01:01 +0000)]
Constant propagation after hiting llvm.assume

After hitting @llvm.assume(X) we can:
- propagate equality that X == true
- if X is icmp/fcmp (with eq operation), and one of operand
  is constant we can change all variables with constants in the same BasicBlock

http://reviews.llvm.org/D11918

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

7 years ago[CMake] Fix build on MSVC in r246156.
NAKAMURA Takumi [Fri, 28 Aug 2015 00:36:58 +0000 (00:36 +0000)]
[CMake] Fix build on MSVC in r246156.

add_windows_version_resource_file() affects ALL_FILES. OBJLIB shouldn't have *.obj as SOURCES.

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

7 years agoFix: CFLAA -- Mark no-args returns as unknown
George Burgess IV [Fri, 28 Aug 2015 00:16:18 +0000 (00:16 +0000)]
Fix: CFLAA -- Mark no-args returns as unknown

Prior to this patch, we hadn't been marking StratifiedSets with the
appropriate StratifiedAttrs when handling the result of no-args call
instructions. This caused us to report NoAlias when handed, for
example, an escaped alloca and a result from an opaque function. Now we
properly mark the return value of said functions.

Thanks again to Chandler, Richard, and Nick for pinging me about this.

Differential review: http://reviews.llvm.org/D12408

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

7 years ago[AArch64][CollectLOH] Fix a regression that prevented us to detect chains of
Quentin Colombet [Thu, 27 Aug 2015 23:47:10 +0000 (23:47 +0000)]
[AArch64][CollectLOH] Fix a regression that prevented us to detect chains of
more than 2 instructions.

I introduced this regression a while back and did not noticed it because I
somehow forgot to push the initial test cases for the pass!

Fix that as well!

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

7 years agoCodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.
Peter Collingbourne [Thu, 27 Aug 2015 23:37:36 +0000 (23:37 +0000)]
CodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.

llvm::splitCodeGen is a function that implements the core of parallel LTO
code generation. It uses llvm::SplitModule to split the module into linkable
partitions and spawning one code generation thread per partition. The function
produces multiple object files which can be linked in the usual way.

This has been threaded through to LTOCodeGenerator (and llvm-lto for testing
purposes). Separate patches will add parallel LTO support to the gold plugin
and lld.

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

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

7 years ago[WinEH] Add some support for code generating catchpad
Reid Kleckner [Thu, 27 Aug 2015 23:27:47 +0000 (23:27 +0000)]
[WinEH] Add some support for code generating catchpad

We can now run 32-bit programs with empty catch bodies.  The next step
is to change PEI so that we get funclet prologues and epilogues.

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

7 years ago[yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.
Michael J. Spencer [Thu, 27 Aug 2015 23:11:20 +0000 (23:11 +0000)]
[yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.

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

7 years ago[ValueTracking] readnone CallInsts are fair game for speculation
David Majnemer [Thu, 27 Aug 2015 23:03:01 +0000 (23:03 +0000)]
[ValueTracking] readnone CallInsts are fair game for speculation

Any call which is side effect free is trivially OK to speculate.  We
already had similar logic in EarlyCSE and GVN but we were missing it
from isSafeToSpeculativelyExecute.

This fixes PR24601.

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

7 years agoAdd a global mapping layer for Orc. Adapted from a patch by Andy Somogyi.
Lang Hames [Thu, 27 Aug 2015 22:20:05 +0000 (22:20 +0000)]
Add a global mapping layer for Orc. Adapted from a patch by Andy Somogyi.

Thanks Andy!

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

7 years agoSupport: Introduce thread.h.
Peter Collingbourne [Thu, 27 Aug 2015 21:52:31 +0000 (21:52 +0000)]
Support: Introduce thread.h.

This header is a wrapper for <thread> that works around problems with the
MSVC headers when exceptions are disabled.

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

7 years ago[CodeGen] Check FoldConstantArithmetic result before using it.
Ahmed Bougacha [Thu, 27 Aug 2015 21:46:04 +0000 (21:46 +0000)]
[CodeGen] Check FoldConstantArithmetic result before using it.

Fixes PR24602: r245689 introduced an unguarded use of
SelectionDAG::FoldConstantArithmetic, which returns 0 when it fails
because of opaque (hoisted) constants.

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

7 years ago[TableGen][DAGISel] Dedup predicates with same code to run. NFCI.
Ahmed Bougacha [Thu, 27 Aug 2015 20:43:34 +0000 (20:43 +0000)]
[TableGen][DAGISel] Dedup predicates with same code to run. NFCI.

I locally hit the 255 limit, but a lot of these are redundant: each
predicate coming from a different record was allocated a new number,
even when we already emitted the same code for another predicate.

Instead, re-use numbers and emit the predicate code only once.
This reduces the total text size of *DAGISel.cpp.o by ~1%.

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

7 years agoFix test introduced in r246187 that failed on some systems.
Tyler Nowicki [Thu, 27 Aug 2015 20:43:29 +0000 (20:43 +0000)]
Fix test introduced in r246187 that failed on some systems.

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

7 years agoOops - Re-add the Kaleidoscope regression tests themselves (accidentally left
Lang Hames [Thu, 27 Aug 2015 20:33:22 +0000 (20:33 +0000)]
Oops - Re-add the Kaleidoscope regression tests themselves (accidentally left
out of r246201).

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

7 years agoRecommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
Lang Hames [Thu, 27 Aug 2015 20:31:44 +0000 (20:31 +0000)]
Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
the kaleidoscope 'library' functions aren't dead-stripped in release builds.

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

7 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 19:56:57 +0000 (19:56 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

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

7 years agoRevert 246186; still breaks on some systems
Erik Schnetter [Thu, 27 Aug 2015 19:34:14 +0000 (19:34 +0000)]
Revert 246186; still breaks on some systems

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

7 years agoImprove vectorization diagnostic messages and extend vectorize(enable) pragma.
Tyler Nowicki [Thu, 27 Aug 2015 18:56:49 +0000 (18:56 +0000)]
Improve vectorization diagnostic messages and extend vectorize(enable) pragma.

This patch changes the analysis diagnostics produced when loops with
floating-point recurrences or memory operations are identified. The new messages
say "cannot prove it is safe to reorder * operations; allow reordering by
specifying #pragma clang loop vectorize(enable)". Depending on the type of
diagnostic the message will include additional options such as ffast-math or
__restrict__.

This patch also allows the vectorize(enable) pragma to override the low pointer
memory check threshold. When the hint is given a higher threshold is used.

See the clang patch for the options produced for each diagnostic.

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

7 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 18:56:23 +0000 (18:56 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

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

7 years agoRevert r246175 to get builder green again.
Lang Hames [Thu, 27 Aug 2015 18:54:41 +0000 (18:54 +0000)]
Revert r246175 to get builder green again.

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

7 years ago[TableGen] Remove dead code. NFC.
Ahmed Bougacha [Thu, 27 Aug 2015 18:14:21 +0000 (18:14 +0000)]
[TableGen] Remove dead code. NFC.

The only user of this was removed in r129670.

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

7 years agoAdd Kaleidoscope regression tests.
Lang Hames [Thu, 27 Aug 2015 18:13:34 +0000 (18:13 +0000)]
Add Kaleidoscope regression tests.

These will be run if LLVM_BUILD_EXAMPLES is enabled.

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

7 years agoAMDGPU/SI: Add test for folding constants into operands
Matt Arsenault [Thu, 27 Aug 2015 17:41:27 +0000 (17:41 +0000)]
AMDGPU/SI: Add test for folding constants into operands

Patch by Axel Davy

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

7 years agoRevert r246158 since it breaks LLVM.Transforms/ConstProp.calls.ll
Erik Schnetter [Thu, 27 Aug 2015 17:24:01 +0000 (17:24 +0000)]
Revert r246158 since it breaks LLVM.Transforms/ConstProp.calls.ll

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

7 years agoFix a case of `CHECK[^:]*$`.
Jonathan Roelofs [Thu, 27 Aug 2015 17:03:14 +0000 (17:03 +0000)]
Fix a case of `CHECK[^:]*$`.

http://reviews.llvm.org/D11917

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

7 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 16:36:37 +0000 (16:36 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

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

7 years ago[CMake] OBJLIB-ize *-tblgen.
NAKAMURA Takumi [Thu, 27 Aug 2015 16:10:47 +0000 (16:10 +0000)]
[CMake] OBJLIB-ize *-tblgen.

This improves dependency chain of;

  (LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen)

with;

  (LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen)

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

7 years ago[LoopVectorize] Move test from r246149 into a target-specific folder to appease bots.
Chad Rosier [Thu, 27 Aug 2015 15:24:47 +0000 (15:24 +0000)]
[LoopVectorize] Move test from r246149 into a target-specific folder to appease bots.

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

7 years ago[CMake] Let ExceptionDemo buildable with ENABLE_EH.
NAKAMURA Takumi [Thu, 27 Aug 2015 15:13:14 +0000 (15:13 +0000)]
[CMake] Let ExceptionDemo buildable with ENABLE_EH.

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

7 years ago[llvm-readobj] Add support for dumping MachO min version load command.
Davide Italiano [Thu, 27 Aug 2015 15:11:32 +0000 (15:11 +0000)]
[llvm-readobj] Add support for dumping MachO min version load command.

Example output:
File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
MinVersion {
  Cmd: LC_VERSION_MIN_IPHONEOS
  Size: 16
  Version: 99.8.7
  SDK: n/a
}

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

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

7 years ago[LoopVectorize] Add Support for Small Size Reductions.
Chad Rosier [Thu, 27 Aug 2015 14:12:17 +0000 (14:12 +0000)]
[LoopVectorize] Add Support for Small Size Reductions.

Unlike scalar operations, we can perform vector operations on element types that
are smaller than the native integer types. We type-promote scalar operations if
they are smaller than a native type (e.g., i8 arithmetic is promoted to i32
arithmetic on Arm targets). This patch detects and removes type-promotions
within the reduction detection framework, enabling the vectorization of small
size reductions.

In the legality phase, we look through the ANDs and extensions that InstCombine
creates during promotion, keeping track of the smaller type. In the
profitability phase, we use the smaller type and ignore the ANDs and extensions
in the cost model. Finally, in the code generation phase, we truncate the result
of the reduction to allow InstCombine to rewrite the entire expression in the
smaller type.

This fixes PR21369.
http://reviews.llvm.org/D12202

Patch by Matt Simpson <mssimpso@codeaurora.org>!

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

7 years ago[LoopVectorize] Extract InductionInfo into a helper class...
James Molloy [Thu, 27 Aug 2015 09:53:00 +0000 (09:53 +0000)]
[LoopVectorize] Extract InductionInfo into a helper class...

... and move it into LoopUtils where it can be used by other passes, just like ReductionDescriptor. The API is very similar to ReductionDescriptor - that is, not very nice at all. Sorting these both out will come in a followup.

NFC

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

7 years agoWhoops, remove trailing whitespace.
Alex Rosenberg [Thu, 27 Aug 2015 05:37:12 +0000 (05:37 +0000)]
Whoops, remove trailing whitespace.

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

7 years agoisKnownNonNull needs to consider globals in non-zero address spaces.
Pete Cooper [Thu, 27 Aug 2015 03:16:29 +0000 (03:16 +0000)]
isKnownNonNull needs to consider globals in non-zero address spaces.

Globals in address spaces other than one may have 0 as a valid address,
so we should not assume that they can be null.

Reviewed by Philip Reames.

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

7 years agoAllow value forwarding past release fences in EarlyCSE
Philip Reames [Thu, 27 Aug 2015 01:32:33 +0000 (01:32 +0000)]
Allow value forwarding past release fences in EarlyCSE

A release fence acts as a publication barrier for stores within the current thread to become visible to other threads which might observe the release fence. It does not require the current thread to observe stores performed on other threads. As a result, we can allow store-load and load-store forwarding across a release fence.

We do need to make sure that stores before the fence can't be eliminated even if there's another store to the same location after the fence. In theory, we could reorder the second store above the fence and *then* eliminate the former, but we can't do this if the stores are on opposite sides of the fence.

Note: While more aggressive then what's there, this patch is still implementing a really conservative ordering.  In particular, I'm not trying to exploit undefined behavior via races, or the fact that the LangRef says only 'atomic' accesses are ordered w.r.t. fences.

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

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

7 years ago[RewriteStatepointsForGC] Reduce the number of new instructions for base pointers
Philip Reames [Thu, 27 Aug 2015 01:02:28 +0000 (01:02 +0000)]
[RewriteStatepointsForGC] Reduce the number of new instructions for base pointers

When computing base pointers, we introduce new instructions to propagate the base of existing instructions which might not be bases. However, the algorithm doesn't make any effort to recognize when the new instruction to be inserted is the same as an existing one already in the IR. Since this is happening immediately before rewriting, we don't really have a chance to fix it after the pass runs without teaching loop passes about statepoints.

I'm really not thrilled with this patch. I've rewritten it 4 different ways now, but this is the best I've come up with. The case where the new instruction is just the original base defining value could be merged into the existing algorithm with some complexity. The problem is that we might have something like an extractelement from a phi of two vectors. It may be trivially obvious that the base of the 0th element is an existing instruction, but I can't see how to make the algorithm itself figure that out. Thus, I resort to the call to SimplifyInstruction instead.

Note that we can only adjust the instructions we've inserted ourselves. The live sets are still being tracked in side structures at this point in the code. We can't easily muck with instructions which might be in them. Long term, I'm really thinking we need to materialize the live pointer sets explicitly in the IR somehow rather than using side structures to track them.

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

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

7 years agoImproved printing of analysis diagnostics in the loop vectorizer.
Tyler Nowicki [Thu, 27 Aug 2015 01:02:04 +0000 (01:02 +0000)]
Improved printing of analysis diagnostics in the loop vectorizer.

This patch ensures that every analysis diagnostic produced by the vectorizer
will be printed if the loop has a vectorization hint on it. The condition has
also been improved to prevent printing when a disabling hint is specified.

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

7 years agoFixed a bug that edge weights are not assigned correctly when lowering switch statement.
Cong Hou [Thu, 27 Aug 2015 00:37:40 +0000 (00:37 +0000)]
Fixed a bug that edge weights are not assigned correctly when lowering switch statement.

This is a one-line-change patch that moves the update to UnhandledWeights to the correct position: it should be updated for all clusters instead of just range clusters.

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

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

7 years agoKaleidoscope: Prune unused libdeps.
NAKAMURA Takumi [Thu, 27 Aug 2015 00:04:24 +0000 (00:04 +0000)]
Kaleidoscope: Prune unused libdeps.

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

7 years ago[SimplifyCFG] Prune code from a provably unreachable switch default
Philip Reames [Wed, 26 Aug 2015 23:56:46 +0000 (23:56 +0000)]
[SimplifyCFG] Prune code from a provably unreachable switch default

As Sanjoy pointed out over in http://reviews.llvm.org/D11819, a switch on an icmp should always be able to become a branch instruction. This patch generalizes that notion slightly to prove that the default case of a switch is unreachable if the cases completely cover all possible bit patterns in the condition. Once that's done, the switch to branch conversion kicks in just fine.

Note: Duplicate case values are disallowed by the LangRef and verifier.

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

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