OSDN Git Service
Nuno Lopes [Thu, 28 Jun 2012 22:31:24 +0000 (22:31 +0000)]
make instcombine produce calls to llvm.donothing instead of a random intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159384
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 22:30:12 +0000 (22:30 +0000)]
add a new @llvm.donothing intrinsic that, well, does nothing, and teach CodeGen to ignore calls to it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159383
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Grosbach [Thu, 28 Jun 2012 21:03:44 +0000 (21:03 +0000)]
'Promote' vector [su]int_to_fp should widen elements.
Teach vector legalization how to honor Promote for int to float
conversions. The code checking whether to promote the operation knew
to look at the operand, but the actual promotion code didn't. This
fixes that. The operand is promoted up via [zs]ext.
rdar://
11762659
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159378
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Thu, 28 Jun 2012 20:46:26 +0000 (20:46 +0000)]
Changed the formatting sequence of a curly brace to
the comment per code review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159376
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Thu, 28 Jun 2012 20:35:00 +0000 (20:35 +0000)]
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159374
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 20:17:05 +0000 (20:17 +0000)]
Remove layering violation #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159372
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 28 Jun 2012 20:08:47 +0000 (20:08 +0000)]
Fix hexagon gcc builtin names to use '_' instead of '.'.
This way the generated GCC builtin to LLVM intrinsic converter
actually works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159370
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 28 Jun 2012 19:09:53 +0000 (19:09 +0000)]
Enable automatic GCC<->LLVM intrinsic translation for mips.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159367
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Thu, 28 Jun 2012 18:20:28 +0000 (18:20 +0000)]
Define MIPS DSP Rev1 intrinsics. That allows frontend to emit a correct IR.
This patch was reviewed in the llvm-commits list by Jim Grosbach.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159364
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 16:34:03 +0000 (16:34 +0000)]
MemoryBuiltins:
- recognize C++ new(std::nothrow) friends
- ignore ExtractElement and ExtractValue instructions in size/offset analysis (all easy cases are probably folded away before we get here)
- also recognize realloc as noalias
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159356
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 16:13:37 +0000 (16:13 +0000)]
make LazyValueInfo analyze the default case of switch statements (we know that in the default branch the value cannot be any of the switch cases)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159353
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 16:10:13 +0000 (16:10 +0000)]
add ConstantRange::difference (to perform set difference/relative complement)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159352
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 28 Jun 2012 14:25:45 +0000 (14:25 +0000)]
Devirtualize DIScope and subclasses.
Nothing in here makes use of the virtuality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159349
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 28 Jun 2012 09:34:41 +0000 (09:34 +0000)]
[asan] set a hard limit on the number of instructions instrumented pear each BB. This is (hopefully temporary) workaround for PR13225
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159344
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 08:43:12 +0000 (08:43 +0000)]
Sphinxify the bitcode format document.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159340
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Jun 2012 07:47:50 +0000 (07:47 +0000)]
Fix Windows build after r159281: s/iterator/const_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159334
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 28 Jun 2012 06:36:24 +0000 (06:36 +0000)]
Move the setup for variables that are expanded in the lit.site.cfg into
a dedicated helper function. This will enable re-using the same logic
for Clang's lit setup, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159333
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Thu, 28 Jun 2012 05:42:45 +0000 (05:42 +0000)]
Precompute SCEV pointer analysis prior to instruction fusion in BBVectorize.
When both a load/store and its address computation are being vectorized, it can
happen that the address-computation vectorization destroys SCEV's ability
to analyize the relative pointer offsets. As a result (like with the aliasing
analysis info), we need to precompute the necessary information prior to
instruction fusing.
This was found during stress testing (running through the test suite with a very
low required chain length); unfortunately, I don't have a small test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159332
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Thu, 28 Jun 2012 05:42:43 +0000 (05:42 +0000)]
Remove a useless check in BBVectorize.
A shuffle mask will always be a constant, but I did not realize that
when I originally wrote the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159331
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Thu, 28 Jun 2012 05:42:42 +0000 (05:42 +0000)]
Allow BBVectorize to form non-2^n-length vectors.
The original algorithm only used recursive pair fusion of equal-length
types. This is now extended to allow pairing of any types that share
the same underlying scalar type. Because we would still generally
prefer the 2^n-length types, those are formed first. Then a second
set of iterations form the non-2^n-length types.
Also, a call to SimplifyInstructionsInBlock has been added after each
pairing iteration. This takes care of DCE (and a few other things)
that make the following iterations execute somewhat faster. For the
same reason, some of the simple shuffle-combination cases are now
handled internally.
There is some additional refactoring work to be done, but I've had
many requests for this feature, so additional refactoring will come
soon in future commits (as will additional test cases).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159330
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Thu, 28 Jun 2012 05:42:26 +0000 (05:42 +0000)]
Refactor operation equivalence checking in BBVectorize by extending Instruction::isSameOperationAs.
Maintaining this kind of checking in different places is dangerous, extending
Instruction::isSameOperationAs consolidates this logic into one place. Here
I've added an optional flags parameter and two flags that are important for
vectorization: CompareIgnoringAlignment and CompareUsingScalarTypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159329
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 02:17:58 +0000 (02:17 +0000)]
Only print out the tag if it's there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159328
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 02:12:20 +0000 (02:12 +0000)]
Don't output an empty string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159327
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Thu, 28 Jun 2012 01:33:40 +0000 (01:33 +0000)]
The Mips specific inline asm operand modifier 'z' has the
following description in the gnu sources:
Print $0 if operand is zero otherwise print the op normally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159324
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 01:16:18 +0000 (01:16 +0000)]
make LVI::getEdgeValue() always intersect the constraints of the edge with the range of the block. Previously it was only performing the intersection for a few cases, thus losing precision
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159320
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Thu, 28 Jun 2012 00:59:33 +0000 (00:59 +0000)]
fix a off-by-one bug in intersectWith(), and add a bunch of tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159319
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 00:41:44 +0000 (00:41 +0000)]
Use the interface through DIDescriptor to get the tag/version for a debug info
MDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159317
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Thu, 28 Jun 2012 00:41:11 +0000 (00:41 +0000)]
Silence unused variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159316
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 00:18:12 +0000 (00:18 +0000)]
Fix cmake failure from moving files around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159314
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 28 Jun 2012 00:16:51 +0000 (00:16 +0000)]
Remove 'site.exp' building from both CMake and configure+make.
This is another vestige of the DejaGNU roots. There were FIXMEs in the
lit setup to add a 'lit.site.cfg', which has been around for quite some
time now, so I've properly switched the handling of the 4 things
actually used in site.exp to go through lit.site.cfg now. No more
parsing of the .exp file, one fewer configure-style generated file,
etc., etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159313
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Thu, 28 Jun 2012 00:05:13 +0000 (00:05 +0000)]
Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and
include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h.
The reasoning is because the DebugInfo module is simply an interface to the
debug info MDNodes and has nothing to do with analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159312
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 28 Jun 2012 00:03:15 +0000 (00:03 +0000)]
Remove the last vestiges of the '-lit' and '-dg' test runner split by
removing '-lit' qualifiers from make rules. I've left a legacy
'check-local-lit' rule in case build scripts have this encoded
somewhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159311
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 28 Jun 2012 00:03:13 +0000 (00:03 +0000)]
Remove 'check-dg', a wrapper around 'check-local-dg' which was just
nuked.
Add a comment that the 'check-lit' rule is really just a legacy of
having two test runners.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159310
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 27 Jun 2012 23:53:41 +0000 (23:53 +0000)]
Remove autoconf support for runtest and tclsh, some of the last vestigal
bits of DejaGNU.
Eric, you may want to remove the TCLSH bits from aclocal.m4 and
regenerate... I didn't want to touch the m4 file lest something
exploded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159308
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 27 Jun 2012 23:48:39 +0000 (23:48 +0000)]
Rip out legacy DejaGNU support from our Makefiles. This hasn't been the
default in forever, and hasn't even worked since most of the .exp files
were removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159307
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 27 Jun 2012 23:34:25 +0000 (23:34 +0000)]
LLVM-GCC is dead. Really. I promise. ;]
More importantly, these files don't even have the variable that these
lines purport to substite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159304
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Wed, 27 Jun 2012 23:13:42 +0000 (23:13 +0000)]
This allows hello world to be compiled for Mips 64 direct object.
It takes advantage of r159299 which introduces relocation support for N64.
elf-dump needed to be upgraded to support N64 relocations as well.
This passes make check.
Jack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159302
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Wed, 27 Jun 2012 22:48:25 +0000 (22:48 +0000)]
This allows hello world to be compiled for Mips 64 direct object.
It takes advantage of r159299 which introduces relocation support for N64.
elf-dump needed to be upgraded to support N64 relocations as well.
This passes make check.
Jack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159301
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Wed, 27 Jun 2012 22:34:28 +0000 (22:34 +0000)]
Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159300
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Wed, 27 Jun 2012 22:28:30 +0000 (22:28 +0000)]
The ELF relocation record format is different for N64
which many Mips 64 ABIs use than for O64 which many
if not all other target ABIs use.
Most architectures have the following 64 bit relocation record format:
typedef struct
{
Elf64_Addr r_offset; /* Address of reference */
Elf64_Xword r_info; /* Symbol index and type of relocation */
} Elf64_Rel;
typedef struct
{
Elf64_Addr r_offset;
Elf64_Xword r_info;
Elf64_Sxword r_addend;
} Elf64_Rela;
Whereas N64 has the following format:
typedef struct
{
Elf64_Addr r_offset;/* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym; /* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
} Elf64_Rel;
typedef struct
{
Elf64_Addr r_offset;/* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym; /* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
Elf64_Sxword r_addend;
} Elf64_Rela;
The structure is the same size, but the r_info data element
is now 5 separate elements. Besides the content aspects,
endian byte reordering will be different for the area with
each element being endianized separately.
I treat this as generic and continue to pass r_type as
an integer masking and unmasking the byte sized N64
values for N64 mode. I've implemented this and it causes no
affect on other current targets.
This passes make check.
Jack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159299
91177308-0d34-0410-b5e6-
96231b3b80d8
Anshuman Dasgupta [Wed, 27 Jun 2012 19:38:29 +0000 (19:38 +0000)]
Refactor and speed up DFA generator.
Patch by Ivan Llopard!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159281
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Beaumont-Gay [Wed, 27 Jun 2012 17:10:33 +0000 (17:10 +0000)]
Revert r159136 due to PR13124.
Original commit message:
If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159272
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Wed, 27 Jun 2012 16:23:48 +0000 (16:23 +0000)]
When users ask for -mcpu=help or -mattr=help, just output the help without
requiring a module. Original patch by Sunay Ismail, simplified by Arnaud
de Grandmaison, then complicated by me (if a triple was specified on the
command line, output help for that triple, not for the default).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159268
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Wed, 27 Jun 2012 14:19:00 +0000 (14:19 +0000)]
Some reassociate optimizations create new instructions, which they insert just
before the expression root. Any existing operators that are changed to use one
of them needs to be moved between it and the expression root, and recursively
for the operators using that one. When I rewrote RewriteExprTree I accidentally
inverted the logic, resulting in the compacting going down from operators to
operands rather than up from operands to the operators using them, oops. Fix
this, resolving PR12963.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159265
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Barton [Wed, 27 Jun 2012 09:48:23 +0000 (09:48 +0000)]
Teach assembler to handle capitalised operation values for DSB instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159259
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 27 Jun 2012 09:44:16 +0000 (09:44 +0000)]
Clean up the 'check' CMake build rule a bit, notable renaming it to
'check-llvm'.
Don't worry! 'check' still works! =] To rationalize the names of targets
used to run tests, the vague plan is the following:
make check-llvm # run LLVM reg/unit tests (currently 'check')
make check-clang # run Clang reg/unit tests (currently 'clang-test')
make check-rt # run CompilerRT reg/unit tests
make check-asan # run ASan reg/unit tests (subset of -rt)
make check-tsan # run TSan reg/unit tests (subset of -rt)
make check-all # run as much of the above as is available
The last one respects what projects are checked out and built for
a given tree. Personally, I would like to eventually make 'check' be an
alias for 'check-all'. For now however, it is an alias for 'check-llvm',
and thus no behavior has changed.
While this patch and my plan only really apply to CMake, I think it
might be good to similarly rationalize the naming scheme for the Make
builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159258
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Barton [Wed, 27 Jun 2012 09:36:19 +0000 (09:36 +0000)]
Prevent ARM Assembler crashing on unrecognised assembly format for DSB instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159257
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Wed, 27 Jun 2012 07:20:57 +0000 (07:20 +0000)]
Sphinxify the exception handling doc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159254
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Wed, 27 Jun 2012 00:49:46 +0000 (00:49 +0000)]
Silence uninitialized variable warning in MipsISelDAGToDAG.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159243
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Wed, 27 Jun 2012 00:40:34 +0000 (00:40 +0000)]
Test case for r159240.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159242
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 27 Jun 2012 00:30:08 +0000 (00:30 +0000)]
Exclude both libcxx and compiler-rt until we get their CMake builds
suitable for building as a whole-project.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159241
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Wed, 27 Jun 2012 00:20:39 +0000 (00:20 +0000)]
Fix bug in computation of stack size in MipsFrameLowering.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159240
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 26 Jun 2012 23:22:18 +0000 (23:22 +0000)]
Reduce indentation in function. Rearrange some methods. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159239
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Grosbach [Tue, 26 Jun 2012 22:58:01 +0000 (22:58 +0000)]
TableGen: AsmMatcher diagnostics preference detail.
Don't override a custom diagnostic w/ a generic InvalidOperand, all else
being equal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159238
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 26 Jun 2012 22:57:33 +0000 (22:57 +0000)]
Revamp how debugging information is emitted for debug info objects.
It's not necessary for each DI class to have its own copy of `print' and
`dump'. Instead, just give DIDescriptor those methods and have it call the
appropriate debugging printing routine based on the type of the debug
information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159237
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Tue, 26 Jun 2012 22:54:59 +0000 (22:54 +0000)]
Add a missing check to avoid dereference null. No sensible test case possible. Sorry. rdar://
11745134
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159236
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Tue, 26 Jun 2012 22:03:13 +0000 (22:03 +0000)]
Remove a instcombine transform that (no longer?) makes sense:
// C - zext(bool) -> bool ? C - 1 : C
if (ZExtInst *ZI = dyn_cast<ZExtInst>(Op1))
if (ZI->getSrcTy()->isIntegerTy(1))
return SelectInst::Create(ZI->getOperand(0), SubOne(C), C);
This ends up forming sext i1 instructions that codegen to terrible code. e.g.
int blah(_Bool x, _Bool y) {
return (x - y) + 1;
}
=>
movzbl %dil, %eax
movzbl %sil, %ecx
shll $31, %ecx
sarl $31, %ecx
leal 1(%rax,%rcx), %eax
ret
Without the rule, llvm now generates:
movzbl %sil, %ecx
movzbl %dil, %eax
incl %eax
subl %ecx, %eax
ret
It also helps with ARM (and pretty much any target that doesn't have a sext i1 :-).
The transformation was done as part of Eli's r75531. He has given the ok to
remove it.
rdar://
11748024
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159230
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 26 Jun 2012 21:36:32 +0000 (21:36 +0000)]
Implement getHostCPUName for ARM/linux. This will be used to implement -march=native in clang.
The cpuid registers are only available in privileged mode so we don't have
an OS-independent way of implementing this. ARM doesn't provide a list of
processor IDs so the list is somewhat incomplete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159228
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Tue, 26 Jun 2012 21:33:36 +0000 (21:33 +0000)]
Fix llc's -print-before=pass and -print-after=pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159227
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 26 Jun 2012 19:47:59 +0000 (19:47 +0000)]
X86: add GATHER intrinsics (AVX2) in LLVM
Support the following intrinsics:
llvm.x86.avx2.gather.d.pd, llvm.x86.avx2.gather.q.pd
llvm.x86.avx2.gather.d.pd.256, llvm.x86.avx2.gather.q.pd.256
llvm.x86.avx2.gather.d.ps, llvm.x86.avx2.gather.q.ps
llvm.x86.avx2.gather.d.ps.256, llvm.x86.avx2.gather.q.ps.256
Modified Disassembler to handle VSIB addressing mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159221
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Tue, 26 Jun 2012 18:46:28 +0000 (18:46 +0000)]
Teach TableGen to put chains on more instructions
When generating selection tables for Pat instances, TableGen relied on
an output Instruction's Pattern field being set to infer whether a
chain should be added.
This patch adds additional logic to check various flag fields so that
correct code can be generated even if Pattern is unset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159217
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 26 Jun 2012 17:13:58 +0000 (17:13 +0000)]
Fix ThreadLocalImpl::getInstance for --disable-threads.
PR13114.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159210
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 26 Jun 2012 17:09:29 +0000 (17:09 +0000)]
Allow targets to inject passes before the virtual register rewriter.
Such passes can be used to tweak the register assignments in a
target-dependent way, for example to avoid write-after-write
dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159209
91177308-0d34-0410-b5e6-
96231b3b80d8
Stepan Dyatkovskiy [Tue, 26 Jun 2012 16:08:20 +0000 (16:08 +0000)]
IntegersSubsetTest: Due to compilation failure with -std=c11, replaced -1UL with NOT_A_NUMBER constant (0xffff).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159207
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Tue, 26 Jun 2012 13:49:27 +0000 (13:49 +0000)]
There are a number of generic inline asm operand modifiers that
up to r158925 were handled as processor specific. Making them
generic and putting tests for these modifiers in the CodeGen/Generic
directory caused a number of targets to fail.
This commit addresses that problem by having the targets call
the generic routine for generic modifiers that they don't currently
have explicit code for.
For now only generic print operands 'c' and 'n' are supported.vi
Affected files:
test/CodeGen/Generic/asm-large-immediate.ll
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/NVPTX/NVPTXAsmPrinter.cpp
lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/XCore/XCoreAsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.cpp
lib/Target/Hexagon/HexagonAsmPrinter.cpp
lib/Target/CellSPU/SPUAsmPrinter.cpp
lib/Target/Sparc/SparcAsmPrinter.cpp
lib/Target/MBlaze/MBlazeAsmPrinter.cpp
lib/Target/Mips/MipsAsmPrinter.cpp
MSP430 isn't represented because it did not even run with
the long existing 'c' modifier and it was not apparent what
needs to be done to get it inline asm ready.
Contributer: Jack Carter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159203
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Tue, 26 Jun 2012 13:39:21 +0000 (13:39 +0000)]
Replacing zero-sized alloca's with a null pointer is too aggressive, instead
merge all zero-sized alloca's into one, fixing c43204g from the Ada ACATS
conformance testsuite. What happened there was that a variable sized object
was being allocated on the stack, "alloca i8, i32 %size". It was then being
passed to another function, which tested that the address was not null (raising
an exception if it was) then manipulated %size bytes in it (load and/or store).
The optimizers cleverly managed to deduce that %size was zero (congratulations
to them, as it isn't at all obvious), which made the alloca zero size, causing
the optimizers to replace it with null, which then caused the check mentioned
above to fail, and the exception to be raised, wrongly. Note that no loads
and stores were actually being done to the alloca (the loop that does them is
executed %size times, i.e. is not executed), only the not-null address check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159202
91177308-0d34-0410-b5e6-
96231b3b80d8
Stepan Dyatkovskiy [Tue, 26 Jun 2012 11:57:43 +0000 (11:57 +0000)]
IntegersSubsetMapping: implemented "diff" operation. Operation allows at the same time perform up to three operations:
- LHS exclude RHS
- LHS intersect RHS (LHS successors will keeped)
- RHS exclude LHS
The complexity is N+M, where
N is size of LHS
M is size of RHS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159201
91177308-0d34-0410-b5e6-
96231b3b80d8
Stepan Dyatkovskiy [Tue, 26 Jun 2012 11:41:47 +0000 (11:41 +0000)]
IntegersSubsetMapping: removed exclude operation, it will replaced with more universal "diff" operation in next commit.
Changes was separated onto two commits for better readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159200
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 26 Jun 2012 11:37:00 +0000 (11:37 +0000)]
Sphyinxify the Bugpoint document.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159199
91177308-0d34-0410-b5e6-
96231b3b80d8
Elena Demikhovsky [Tue, 26 Jun 2012 10:50:07 +0000 (10:50 +0000)]
Removed unused variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159197
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 26 Jun 2012 10:05:06 +0000 (10:05 +0000)]
Rename to match other X86_64* names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159196
91177308-0d34-0410-b5e6-
96231b3b80d8
Elena Demikhovsky [Tue, 26 Jun 2012 08:04:10 +0000 (08:04 +0000)]
Shuffle optimization for AVX/AVX2.
The current patch optimizes frequently used shuffle patterns and gives these instruction sequence reduction.
Before:
vshufps $-35, %xmm1, %xmm0, %xmm2 ## xmm2 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm2, %xmm2 ## xmm2 = xmm2[0,2,1,3]
vextractf128 $1, %ymm1, %xmm1
vextractf128 $1, %ymm0, %xmm0
vshufps $-35, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm0, %xmm0 ## xmm0 = xmm0[0,2,1,3]
vinsertf128 $1, %xmm0, %ymm2, %ymm0
After:
vshufps $13, %ymm0, %ymm1, %ymm1 ## ymm1 = ymm1[1,3],ymm0[0,0],ymm1[5,7],ymm0[4,4]
vshufps $13, %ymm0, %ymm0, %ymm0 ## ymm0 = ymm0[1,3,0,0,5,7,4,4]
vunpcklps %ymm1, %ymm0, %ymm0 ## ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159188
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 26 Jun 2012 05:16:37 +0000 (05:16 +0000)]
Update a bunch of stale comments that dated from when this folled the
very first (and worst) placement algorithm. These should now more
accurately reflect the reality of the pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159185
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Tue, 26 Jun 2012 04:12:49 +0000 (04:12 +0000)]
Remove some duplicate instructions that exist only to given different mnemonics for the assembler. Use InstAlias instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159184
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Tue, 26 Jun 2012 04:11:38 +0000 (04:11 +0000)]
Enable the new LoopInfo algorithm by default.
The primary advantage is that loop optimizations will be applied in a
stable order. This helps debugging and unit test creation. It is also
a better overall implementation without pathologically bad performance
on deep functions.
On large functions (llvm-stress --size=200000 | opt -loops)
Before: 0.1263s
After: 0.0225s
On deep functions (after tweaking llvm-stress, thanks Nadav):
Before: 0.2281s
After: 0.0227s
See r158790 for more comments.
The loop tree is now consistently generated in forward order, but loop
passes are applied in reverse order over the program. If we have a
loop optimization that prefers forward order, that can easily be
achieved by adding a different type of LoopPassManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159183
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Tue, 26 Jun 2012 04:11:34 +0000 (04:11 +0000)]
Remove unnecessary FIXME
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159182
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Tue, 26 Jun 2012 01:19:33 +0000 (01:19 +0000)]
Make sure type is not extended or untyped before create a constant of the type. No test case. Found by inspection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159179
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 26 Jun 2012 00:28:15 +0000 (00:28 +0000)]
Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159178
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Friedman [Mon, 25 Jun 2012 23:42:33 +0000 (23:42 +0000)]
Make some ugly hacks for inline asm operands which name a specific register a bit more thorough. PR13196.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159176
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Mon, 25 Jun 2012 23:26:10 +0000 (23:26 +0000)]
revert my previous commit (r159173), since as Eli pointed out, it's perfectly ok to mark realloc as noalias
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159175
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Mon, 25 Jun 2012 22:55:50 +0000 (22:55 +0000)]
do not set realloc() as NotAlias, since it can return the same pointer. This whole thing should be upgraded to use the MemoryBuiltin interface anyway..
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159173
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Mon, 25 Jun 2012 21:49:38 +0000 (21:49 +0000)]
ARM: update peephole optimization.
More condition codes are included when deciding whether to remove cmp after
a sub instruction. Specifically, we extend from GE|LT|GT|LE to
GE|LT|GT|LE|HS|LS|HI|LO|EQ|NE. If we have "sub a, b; cmp b, a; movhs", we
should be able to replace with "sub a, b; movls".
rdar:
11725965
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159166
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Mon, 25 Jun 2012 21:25:16 +0000 (21:25 +0000)]
Define DAGOperand, an empty base class for RegisterClass and Operand. This allows one to write multiclasses that are polymorphic over both registers and non-register operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159162
91177308-0d34-0410-b5e6-
96231b3b80d8
Dan Gohman [Mon, 25 Jun 2012 19:47:37 +0000 (19:47 +0000)]
Fix the objc_autoreleasedReturnValue optimization code to locate
the call correctly even in the case where it is an invoke. This
fixes rdar://
11714057.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159157
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Mon, 25 Jun 2012 18:18:27 +0000 (18:18 +0000)]
Enforce stricter liveness rules for PHIs.
Verify that all paths from the entry block to a virtual register read
pass through a def. Enable this check even when MRI->isSSA() is false.
Verify that the live range of a virtual register is live out of all
predecessor blocks, even for PHI-values.
This requires that PHIElimination sometimes inserts IMPLICIT_DEF
instruction in predecessor blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159150
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Mon, 25 Jun 2012 18:12:18 +0000 (18:12 +0000)]
Run ProcessImplicitDefs on SSA form where it can be much simpler.
Implicitly defined virtual registers can simply have the <undef> bit set
on all uses, and copies can be turned into implicit defs recursively.
Physical registers are a bit trickier. We handle the common case where a
physreg def is used by a nearby instruction in the same basic block. For
more complicated cases, just leave the IMPLICIT_DEF instruction in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159149
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Mon, 25 Jun 2012 17:11:47 +0000 (17:11 +0000)]
improve optimization of invoke instructions:
- simplifycfg: invoke undef/null -> unreachable
- instcombine: invoke new -> invoke expect(0, 0) (an arbitrary NOOP intrinsic; only done if the allocated memory is unused, of course)
- verifier: allow invoke of intrinsics (to make the previous step work)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159146
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Mon, 25 Jun 2012 16:17:54 +0000 (16:17 +0000)]
check for the NoAlias attribute through CallSite
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159145
91177308-0d34-0410-b5e6-
96231b3b80d8
Nuno Lopes [Mon, 25 Jun 2012 16:16:58 +0000 (16:16 +0000)]
add CallSite/CallInst/InvokeInst::hasFnAttr()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159144
91177308-0d34-0410-b5e6-
96231b3b80d8
Meador Inge [Mon, 25 Jun 2012 14:48:43 +0000 (14:48 +0000)]
PR13013: ELF Type identification fails for MSB type ELF files.
Fix 'sys::IdentifyFileType' to work with big and little endian byte orderings
when reading the ELF object file type.
Initial patch by Stefan Hepp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159138
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 25 Jun 2012 14:30:31 +0000 (14:30 +0000)]
If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159136
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Bendersky [Mon, 25 Jun 2012 10:13:14 +0000 (10:13 +0000)]
The name (and comment describing) of llvm::GetFirstDebuigLocInBasicBlock no longer represents what the function does. Therefore, the function is removed and its functionality is folded into the only place in the code-base where it was being used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159133
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 25 Jun 2012 06:51:42 +0000 (06:51 +0000)]
Add SSE2 predicate to CVTPS2PD instructions. Doesn't matter much because there are no patterns in the instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159127
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 25 Jun 2012 06:16:00 +0000 (06:16 +0000)]
Remove codegen only instruction in favor of one that has the same definition. Make some pattern operands more explicit about types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159126
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Mon, 25 Jun 2012 05:20:13 +0000 (05:20 +0000)]
Just remove generic support for C++11 alignas -- GCC is already
advertising complete support w/o alignas implemented, and its
implementation of alignas in the latest versions is so convoluted as to
be unusable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159125
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Mon, 25 Jun 2012 03:36:12 +0000 (03:36 +0000)]
Teach PHIElimination to handle <undef> operands.
When a PHI use is <undef>, don't emit a copy in the predecessor block,
but insert an IMPLICIT_DEF instruction instead. This ensures that
virtual register uses are always jointly dominated by defs, even if some
of them are IMPLICIT_DEF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159121
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Mon, 25 Jun 2012 03:27:12 +0000 (03:27 +0000)]
Handle <undef> operands in TwoAddressInstructionPass.
When the source register to a 2-addr instruction is undefined, there is
no need to attempt any transformations - simply replace the source
register with the destination register.
This also comes up when lowering IMPLICIT_DEF instructions - make sure
the <undef> flag is moved to the new partial register def operand:
%vreg8<def> = INSERT_SUBREG %vreg9<undef>, %vreg0<kill>, sub_16bit
rewrite undef:
%vreg8<def> = INSERT_SUBREG %vreg8<undef>, %vreg0<kill>, sub_16bit
convert to:
%vreg8:sub_16bit<def,read-undef> = COPY %vreg0<kill>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159120
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Sun, 24 Jun 2012 15:53:01 +0000 (15:53 +0000)]
%RCX is not a function live-out in eh.return functions.
The function live-out registers must be live at all function returns,
and %RCX is only used by eh.return. When a function also has a normal
return, only %RAX holds a return value.
This fixes PR13188.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159116
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sun, 24 Jun 2012 13:32:01 +0000 (13:32 +0000)]
llvm/lib: [CMake] Add explicit dependency to intrinsics_gen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159112
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Sun, 24 Jun 2012 13:28:01 +0000 (13:28 +0000)]
Allow controlling vectorization of boolean values separately from other integer types.
These are used as the result of comparisons, and often handled differently from larger integer types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159111
91177308-0d34-0410-b5e6-
96231b3b80d8