Commit Graph

86506 Commits

Author SHA1 Message Date
Pawel Wodnicki 6d3a0a73eb fix for PR1476
llvm-svn: 167535
2012-11-07 16:56:52 +00:00
Kostya Serebryany 157a515376 [asan] fix bug 14277 (asan needs to fail with fata error if an __asan interface function is being redefined. Before this fix asan asserts)
llvm-svn: 167529
2012-11-07 12:42:18 +00:00
Andrew Trick 3ca33acb95 misched: Heuristics based on the machine model.
misched is disabled by default. With -enable-misched, these heuristics
balance the schedule to simultaneously avoid saturating processor
resources, expose ILP, and minimize register pressure. I've been
analyzing the performance of these heuristics on everything in the
llvm test suite in addition to a few other benchmarks. I would like
each heuristic check to be verified by a unit test, but I'm still
trying to figure out the best way to do that. The heuristics are still
in considerable flux, but as they are refined we should be rigorous
about unit testing the improvements.

llvm-svn: 167527
2012-11-07 07:05:09 +00:00
Andrew Trick e145559b70 misched: handle on-the-fly regpressure queries better for 2-addr
instructions without relying on liveintervals.

llvm-svn: 167526
2012-11-07 07:05:05 +00:00
Bill Wendling f720bf64d4 Add comment describing what's going on here.
llvm-svn: 167525
2012-11-07 05:19:04 +00:00
Bill Wendling d9bb9b611b When we're updating the subprogram scope DIE, we want to determine if we're
updating an abstract DIE or not. If we are, then we use that. Its children will
be added on later, as well as the object pointer attribute. Otherwise, this
function may be called with a concrete DIE twice and adding the children and
object pointer attribute to it twice.
<rdar://problem/12401423&12600340>

llvm-svn: 167524
2012-11-07 04:42:18 +00:00
Eli Bendersky 659d206678 Fix a broken sentence
llvm-svn: 167521
2012-11-07 01:52:41 +00:00
Eli Bendersky 8a7e80f6f5 Document the -input-file option of FileCheck
llvm-svn: 167517
2012-11-07 01:41:30 +00:00
Chad Rosier 65710a7589 [arm fast-isel] Appease the machine verifier by using the proper register
classes.  For my test case the number of errors drop from 356 to 21.
Part of rdar://12594152

llvm-svn: 167508
2012-11-07 00:13:01 +00:00
Jakub Staszak 7d6ee3e1b4 Simplify code. No functionality change.
llvm-svn: 167505
2012-11-06 23:52:19 +00:00
Nadav Rotem 1c89744f32 Make the helper functions static. No functional change.
llvm-svn: 167501
2012-11-06 23:36:00 +00:00
Chad Rosier 1ec8e404fc Mark the Int_eh_sjlj_dispatchsetup pseudo instruction as clobbering all
registers.  Previously, the register we being marked as implicitly defined, but
not killed.  In some cases this would cause the register scavenger to spill a
dead register.

Also, use an empty register mask to simplify the logic and to reduce the memory
footprint.
rdar://12592448

llvm-svn: 167499
2012-11-06 23:05:24 +00:00
Chad Rosier 8d2c229006 [regallocfast] Make sure the MachineRegisterInfo is aware of clobbers from a
register masks.  This is an obvious and necessary fix for a soon to be committed
patch.  No test case possible at this time.  Reviewed by Jakob.

llvm-svn: 167498
2012-11-06 22:52:42 +00:00
Nadav Rotem f036ca466e CostModel: add another known vector trunc optimization.
llvm-svn: 167488
2012-11-06 21:17:17 +00:00
Argyrios Kyrtzidis 073e009ed5 [c-index-test] When building with BUILD_CLANG_ONLY=YES, include c-index-test.
It is part of libclang and has other uses besides running the clang tests.

llvm-svn: 167484
2012-11-06 19:54:46 +00:00
Nadav Rotem 0914f0b262 Cost Model: add tables for some avx type-conversion hacks.
llvm-svn: 167480
2012-11-06 19:33:53 +00:00
Andrew Kaylor 49517a494b Fix build error from previous commit.
llvm-svn: 167477
2012-11-06 19:06:46 +00:00
Andrew Kaylor d8ffd9c7e7 Add interface for object-based JIT events.
This patch adds the interface to expose events from MCJIT when an object is emitted or freed and implements the MCJIT functionality to send those events.  The IntelJITEventListener implementation is left empty for now.  It will be fleshed out in a future patch.

llvm-svn: 167475
2012-11-06 18:51:59 +00:00
Daniel Dunbar e2d25c2731 MemoryBuffer: Windows doesn't define S_IFIFO.
llvm-svn: 167467
2012-11-06 17:08:09 +00:00
Alexey Samsonov bdb2594cb3 docs: use code font for console commands in phabricator manual
llvm-svn: 167459
2012-11-06 15:04:37 +00:00
Michael Liao ec47090b1e Remove tailing whitespaces
llvm-svn: 167445
2012-11-06 08:06:35 +00:00
Andrew Trick e96390ea96 misched: TargetSchedule interface for machine resources.
Expose the processor resources defined by the machine model to the
scheduler and other clients through the TargetSchedule interface.

Normalize each resource count with respect to other kinds of
resources. This allows scheduling heuristics to balance resources
against other kinds of resources and latency.

llvm-svn: 167444
2012-11-06 07:10:38 +00:00
Andrew Trick 4d1fa712ac misched: Rename RemainingCount to avoid confusion with remaining resources.
llvm-svn: 167443
2012-11-06 07:10:34 +00:00
Andrew Trick baeaabb2d0 ScheduleDAG interface. Added OrderKind to distinguish nonregister dependencies.
This is in preparation for adding "weak" DAG edges, but generally
simplifies the design.

llvm-svn: 167435
2012-11-06 03:13:46 +00:00
Nadav Rotem 48c5b8e659 Refactor the getTypeLegalizationCost interface. No functionality change.
llvm-svn: 167422
2012-11-05 23:57:45 +00:00
Nadav Rotem c378a8067d CostModel: Add tables for the common x86 compares.
llvm-svn: 167421
2012-11-05 23:48:20 +00:00
Nadav Rotem ae79765676 Code Model: Improve the accuracy of the zext/sext/trunc vector cost estimation.
llvm-svn: 167412
2012-11-05 22:20:53 +00:00
Richard Smith 18d2762048 Suppress signed/unsigned comparison warning.
llvm-svn: 167410
2012-11-05 22:01:44 +00:00
Kevin Enderby 27121c1543 Fix for PR14264 cause by commit r167237 which did not take into account a
possible buffer change with a .macro directive.

rdar://12637628

llvm-svn: 167408
2012-11-05 21:55:41 +00:00
Daniel Dunbar 43a172d935 MemoryBuffer: Support reading named pipes in getFile().
- We only support this when the client didn't claim to know the file size.

llvm-svn: 167407
2012-11-05 21:55:40 +00:00
Nadav Rotem 856ffa6677 Cost Model: Normalize the insert/extract index when splitting types
llvm-svn: 167402
2012-11-05 21:12:13 +00:00
Nadav Rotem 020be9dc29 Cost Model: teach the cost model about expanding integers.
llvm-svn: 167401
2012-11-05 21:11:10 +00:00
Andrew Kaylor a714efc1bd Add a method to indicate section address re-assignment is finished.
Prior to this patch RuntimeDyld attempted to re-apply relocations every time reassignSectionAddress was called (via MCJIT::mapSectionAddress).  In addition to being inefficient and redundant, this led to a problem when a section was temporarily moved too far away from another section with a relative relocation referencing the section being moved.  To fix this, I'm adding a new method (finalizeObject) which the client can call to indicate that it is finished rearranging section addresses so the relocations can safely be applied.

llvm-svn: 167400
2012-11-05 20:57:16 +00:00
Ulrich Weigand 339d0597d3 On PowerPC64, integer return values (as well as arguments) are supposed
to be extended to a full register.   This is modeled in the IR by marking
the return value (or argument) with a signext or zeroext attribute.

However, while these attributes are respected for function arguments,
they are currently ignored for function return values by the PowerPC
back-end.  This patch updates PPCCallingConv.td to ask for the promotion
to i64, and fixes LowerReturn and LowerCallResult to implement it.

The new test case verifies that both arguments and return values are
properly extended when passing them; and also that the optimizers
understand incoming argument and return values are in fact guaranteed
by the ABI to be extended.

The patch caused a spurious breakage in CodeGen/PowerPC/coalesce-ext.ll,
since the test case used a "ret" instruction to create a use of an i32
value at the end of the function (to set up data flow as required for
what the test is intended to test).  Since there's now an implicit
promotion to i64, that data flow no longer works as expected.  To fix
this, this patch now adds an extra "add" to ensure we have an appropriate
use of the i32 value.

llvm-svn: 167396
2012-11-05 19:39:45 +00:00
Nadav Rotem 7411623fd8 Implement the cost of abnormal x86 instruction lowering as a table.
llvm-svn: 167395
2012-11-05 19:32:46 +00:00
Jim Grosbach 2cce3f91f8 lli: Initialize the native asm parser for inline assembly.
MCJIT supports inline assembly, but requires the asm parser to do so.
Make sure to link it in and initialize it.

llvm-svn: 167392
2012-11-05 19:06:05 +00:00
Hal Finkel 4f24c621d9 Add support for the PowerPC-specific inline asm Z constraint and y modifier.
The Z constraint specifies an r+r memory address, and the y modifier expands
to the "r, r" in the asm string. For this initial implementation, the base
register is forced to r0 (which has the special meaning of 0 for r+r addressing
on PowerPC) and the full address is taken in the second register. In the
future, this should be improved.

llvm-svn: 167388
2012-11-05 18:18:42 +00:00
Adhemerval Zanella c4182d1890 [PATCH] PowerPC: Expand load extend vector operations
This patch expands the SEXTLOAD, ZEXTLOAD, and EXTLOAD operations for
vector types when altivec is enabled.

llvm-svn: 167386
2012-11-05 17:15:56 +00:00
Rafael Espindola 6cc02e0026 Add missing this->. Fixes pr14238.
llvm-svn: 167383
2012-11-05 14:57:21 +00:00
Richard Osborne a1fffcf73a Don't infer whether a value is captured in the current function from the
'nocapture' attribute.

The nocapture attribute only specifies that no copies are made that
outlive the function. This isn't the same as there being no copies at all.
This fixes PR14045.

llvm-svn: 167381
2012-11-05 10:48:24 +00:00
Chandler Carruth 89ad975c68 Add a couple of stubs to the release notes for things I noticed while
clearing out my backlog of commit mail.

llvm-svn: 167380
2012-11-05 10:17:00 +00:00
Eli Bendersky 6f6f55ee61 PR14256: SelectionDAGLowering was renamed to SelectionDAGBuilder a long time ago. Fix references to it in documentation and comments.
llvm-svn: 167378
2012-11-05 02:59:23 +00:00
NAKAMURA Takumi dce899962b ConstantFolding.cpp: Whitespace.
llvm-svn: 167377
2012-11-05 00:11:11 +00:00
Duncan Sands 71c2070e2d Apply the patch from PR14160. I failed to construct a testcase for this, but
I'm applying it anyway since it seems to be obviously correct.

llvm-svn: 167370
2012-11-04 09:02:45 +00:00
Craig Topper 3b530ea605 Remove alignments from folding tables for scalar FMA4 instructions.
llvm-svn: 167366
2012-11-04 04:40:08 +00:00
Duncan Sands 4698cb339f Fix the IntegersSubsetTest unit test when compiled with gcc-4.7. The issue here
is that the unit test doesn't have IntTy equal to APInt, instead it uses a class
derived from APInt.  When, as in these lines, an IntTy& reference is returned
but is assigned to an APInt&, the compiler destroys the temporary the IntTy& was
referring to, leaving the APInt& referring to garbage.  This causes the unittest
to fail systematically on my machine; it can also be caught by running the test
under valgrind.

llvm-svn: 167356
2012-11-03 14:04:04 +00:00
Duncan Sands a318ef6fa6 Generalize the transform that boosts GEP indices to the size of a pointer to
also do it for vectors of pointers.

llvm-svn: 167354
2012-11-03 11:44:17 +00:00
Akira Hatanaka da1980f697 [mips] Set flag neverHasSideEffects flag on floating point conversion
instructions.

llvm-svn: 167348
2012-11-03 00:53:12 +00:00
Nadav Rotem c2345cbe73 X86 CostModel: Add support for a some of the common arithmetic instructions for SSE4, AVX and AVX2.
llvm-svn: 167347
2012-11-03 00:39:56 +00:00
Akira Hatanaka 7828331329 [mips] Set flag isAsCheapAsAMove flag on instruction LUi.
llvm-svn: 167345
2012-11-03 00:26:02 +00:00
Owen Anderson 15fd6ac4ba Be careful not to optimize a SELECT_CC into a SETCC post-legalization if the SETCC node would be illegal.
llvm-svn: 167344
2012-11-03 00:17:26 +00:00
Akira Hatanaka 5852e3b800 [mips] Stop reserving register AT and use register scavenger when a scratch
register is needed.

llvm-svn: 167341
2012-11-03 00:05:43 +00:00
Akira Hatanaka 654e3b40f5 [mips] Do not reserve all 64-bit registers, but only the ones which need to be
reserved. Without this fix, RegScavenger::getRegsAvailable incorrectly
returns an empty set of integer registers.

llvm-svn: 167335
2012-11-02 23:36:01 +00:00
David Blaikie bc1b4e73e6 Include all the fields so we can correctly emit DW_TAG_structure_type for C++ structs.
llvm-svn: 167334
2012-11-02 23:33:23 +00:00
Nadav Rotem 23848f8f1d Add a stub for the x86 cost model impl. Implement a basic cost rule for inserting/extracting from XMM registers.
llvm-svn: 167333
2012-11-02 23:27:16 +00:00
Nadav Rotem 13da94734c CostModel: add support for Vector Insert and Extract.
llvm-svn: 167329
2012-11-02 22:31:56 +00:00
Akira Hatanaka d0836fd20a [mips] Fix disassembler test cases.
llvm-svn: 167326
2012-11-02 22:20:10 +00:00
Nadav Rotem a6b91ac307 Add a cost model analysis that allows us to estimate the cost of IR-level instructions.
llvm-svn: 167324
2012-11-02 21:48:17 +00:00
Nadav Rotem 919b5aab34 Scalar Bitcasts and Truncs are usually free
llvm-svn: 167323
2012-11-02 21:47:47 +00:00
Akira Hatanaka 6dcf75897c [mips] Fix bug in test case. Disable machine LICM to prevent instruction from
being moved out of a basic block.

llvm-svn: 167322
2012-11-02 21:46:42 +00:00
Quentin Colombet 8e1fe84c3c Vext Lowering was missing opportunities
llvm-svn: 167318
2012-11-02 21:32:17 +00:00
Akira Hatanaka 949f8d890d [mips] Use register number instead of name to print register $AT.
llvm-svn: 167315
2012-11-02 21:26:03 +00:00
Akira Hatanaka 97b43d8bdf [mips] Add function MipsFrameLowering::estimateStackSize.
This function estimates stack size and will be called before
PrologEpilogInserter scans the callee-saved registers.

llvm-svn: 167313
2012-11-02 21:10:22 +00:00
Akira Hatanaka 719df2874c [mips] Add member field MipsFunctionInfo::IncomingArgSize which holds the size
of the incoming argument area.

llvm-svn: 167312
2012-11-02 21:03:58 +00:00
Rafael Espindola 7296139d5e Fix a build problem with xlc. The error message was
"../llvm-git/utils/TableGen/CodeGenSchedule.cpp", line 1594.12: 1540-0218 (S) The call does not match any parameter list for "operator+".
"../llvm-git/include/llvm/ADT/STLExtras.h", line 130.1: 1540-1283 (I) "template <class _Iterator, class Func> llvm::operator+(mapped_iterator<_Iterator,Func>::difference_type, const mapped_iterator<_Iterator,Func> &)" is not a viable candidate.

Patch by Kai.

llvm-svn: 167311
2012-11-02 20:57:36 +00:00
Akira Hatanaka 0dfbf1262b [mips] Delete MipsFunctionInfo::EmitNOAT. Unconditionally print directive
"set .noat" so that the assembler doesn't issue warnings when register $AT is
used.

llvm-svn: 167310
2012-11-02 20:56:25 +00:00
Rafael Espindola 2f92f61098 XLC supports the same atomic functions as GCC, use them.
Patch by Kai.

llvm-svn: 167309
2012-11-02 20:54:45 +00:00
Andrew Kaylor fb05a50f6b Change resolveRelocation parameters so the relocations can find placeholder values in the original object buffer.
Some ELF relocations require adding the a value to the original contents of the object buffer at the specified location.  In order to properly handle multiple applications of a relocation, the RuntimeDyld code should be grabbing the original value from the object buffer and writing a new value into the loaded section buffer.  This patch changes the parameters passed to resolveRelocations to accommodate this need.

llvm-svn: 167304
2012-11-02 19:45:23 +00:00
Dmitri Gribenko 13539d1b0a Documentation: fix typos.
llvm-svn: 167302
2012-11-02 18:06:51 +00:00
Alexey Samsonov 9bdb63ae0d Fix whitespaces
llvm-svn: 167295
2012-11-02 12:20:34 +00:00
Duncan Sands 47ef7cffb8 Enable the assertion in getIntPtrType (I've audited all users of this method and
they are now all correct; hopefully the buildbots will agree!).

llvm-svn: 167289
2012-11-02 09:02:37 +00:00
Chandler Carruth b62807a95c Add a testcase to loop-idiom to cover PR14241 when we start handling
strided loops again.

llvm-svn: 167287
2012-11-02 08:40:24 +00:00
Chandler Carruth 099f5cb031 Revert the switch of loop-idiom to use the new dependence analysis.
The new analysis is not yet ready for prime time. It has a *critical*
flawed assumption, and some troubling shortages of testing. Until it's
been hammered into better shape, let's stick with the working code. This
should be easy to revert itself when the analysis is ready.

Fixes PR14241, a miscompile of any memcpy-able loop which uses a pointer
as the induction mechanism. If you have been seeing miscompiles in this
revision range, you really want to test with this backed out. The
results of this miscompile are a bit subtle as they can lead to
downstream passes concluding things are impossible which are in fact
possible.

Thanks to David Blaikie for the majority of the reduction of this
miscompile. I'll be checking in the test case in a non-revert commit.

Revesions reverted here:

r167045: LoopIdiom: Fix a serious missed optimization: we only turned
         top-level loops into memmove.
r166877: LoopIdiom: Add checks to avoid turning memmove into an infinite
         loop.
r166875: LoopIdiom: Recognize memmove loops.
r166874: LoopIdiom: Replace custom dependence analysis with
         DependenceAnalysis.
llvm-svn: 167286
2012-11-02 08:33:25 +00:00
Duncan Sands a17bb1419f Fix an obvious typo that causes an assertion failure when running
test/Transforms/GVN/rle.ll if the (currently disabled) check for a
pointer type in getIntPtrType is turned on.

llvm-svn: 167285
2012-11-02 07:49:32 +00:00
Chandler Carruth acc748b2b5 Fix sign compare warning. Patch by Mahesha HS.
llvm-svn: 167282
2012-11-02 05:24:00 +00:00
NAKAMURA Takumi d1cc9db3d6 libprofile/CommonProfiling.c: Fix according to C89.
llvm-svn: 167272
2012-11-02 01:32:02 +00:00
Manman Ren 7dcadc6dbe PGO: allows the profile data file name to be specified by the LLVMPROF_OUTPUT
environment variable.

This allows parallel make for profiling code, without it there are file
collisions as each parallel run uses the default file name.

There is already code in the runtime library to specify the output file name
via the command line, but this only works for programs which already process
argc/argv.  This patch builds on that support.

Patch by Alastair Murray.

llvm-svn: 167269
2012-11-02 01:10:15 +00:00
Manman Ren 3d5af279b1 OutputArg: added an index of the original argument to match the change to
InputArg in r165616.

This will enable us to get the actual type for both InputArg and OutputArg.

rdar://9932559

llvm-svn: 167265
2012-11-01 23:49:58 +00:00
Hal Finkel 376f82d5d3 BBVectorize: Commit the rest of the test-case change.
llvm-svn: 167257
2012-11-01 21:57:27 +00:00
Hal Finkel 560545b85f BBVectorize: Use target costs for incoming and outgoing values instead of the depth heuristic.
When target cost information is available, compute explicit costs of inserting and
extracting values from vectors. At this point, all costs are estimated using the
target information, and the chain-depth heuristic is not needed. As a result, it is now, by
default, disabled when using target costs.

llvm-svn: 167256
2012-11-01 21:50:12 +00:00
Andrew Kaylor 0eece8d7f5 Fixed format string to avoid pointer truncation during 64-bit debugging.
llvm-svn: 167247
2012-11-01 19:49:21 +00:00
Pranav Bhandarkar 34b601804e Use the relationship models infrastructure to add two relations - getPredOpcode
and getPredNewOpcode. The first relates non predicated instructions with their
predicated forms and the second relates predicated instructions with their
predicate-new forms.

Patch by Jyotsna Verma!

llvm-svn: 167243
2012-11-01 19:13:23 +00:00
Kevin Enderby 4eaf8ef5cb Add support for generating dwarf debugging info with assembly files
run through the 'C' preprocessor.  That is pick up the file name
and line numbers from the cpp hash file line comments for the
dwarf file and line numbers tables.

rdar://9275556

llvm-svn: 167237
2012-11-01 17:31:35 +00:00
NAKAMURA Takumi da2afc9a70 llvm/test/lit.cfg: Don't use mcjit to ppc32 yet, not ready.
Unsupported CPU type!
UNREACHABLE executed at llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:553!

llvm-svn: 167231
2012-11-01 14:28:51 +00:00
Kostya Serebryany 28d0694c27 [asan] don't instrument globals that we've created ourselves (reduces the binary size a bit)
llvm-svn: 167230
2012-11-01 13:42:40 +00:00
Chandler Carruth ba98ef892f Add a getAddressSpace method to the GEP instruction to mirror that of
the inttoptr instruction. The conceptual model here is that
'getAddressSpace' refers to the address space of this instruction's
type. It just happens that for GEPs, that is always the same as the
pointer operand's address space. We want both names so that access
patterns can be consistent between different instruction types.

llvm-svn: 167229
2012-11-01 11:25:55 +00:00
Chandler Carruth 49d7e23b14 Add some consistent doxygen comments for the address space helpers.
These clarify that the methods called 'getPointerAddressSpace' apply to
the pointer *operand* of the instruction.

llvm-svn: 167228
2012-11-01 11:25:28 +00:00
Chandler Carruth 43120f4973 Normalize the API and doxygen comments for the ptrtoint instruction.
llvm-svn: 167227
2012-11-01 11:16:47 +00:00
Chandler Carruth 52c3a3382a Remove a weird static helper from the GEP instruction and just directly
compute the address space in the one place it was used.

Also write the getPointerAddressSpace member in terms of the
getPointerOperandType member.

llvm-svn: 167226
2012-11-01 10:59:30 +00:00
Chandler Carruth 705561159c As I'm going to be touching several comments in this file, update the
'@brief' doxygen markup to the now standard '\brief' markup form, in
conformance with the coding standards. This will let me continue to
write new comments in this form without making things inconsistent.

llvm-svn: 167225
2012-11-01 10:46:54 +00:00
Chandler Carruth d5639ff80f Add a test case for PR14233.
llvm-svn: 167224
2012-11-01 10:26:36 +00:00
Chandler Carruth 4a6c2a4b4f Teach Type::getPointerAddressSpace to look through pointer vectors
politely and document this feature.

This simple API extension then allows us to write all of the
Instructions' address space query methods much more simply. No
functionality change intended here.

llvm-svn: 167223
2012-11-01 09:37:49 +00:00
Chandler Carruth 5da3f0512e Revert the majority of the next patch in the address space series:
r165941: Resubmit the changes to llvm core to update the functions to
         support different pointer sizes on a per address space basis.

Despite this commit log, this change primarily changed stuff outside of
VMCore, and those changes do not carry any tests for correctness (or
even plausibility), and we have consistently found questionable or flat
out incorrect cases in these changes. Most of them are probably correct,
but we need to devise a system that makes it more clear when we have
handled the address space concerns correctly, and ideally each pass that
gets updated would receive an accompanying test case that exercises that
pass specificaly w.r.t. alternate address spaces.

However, from this commit, I have retained the new C API entry points.
Those were an orthogonal change that probably should have been split
apart, but they seem entirely good.

In several places the changes were very obvious cleanups with no actual
multiple address space code added; these I have not reverted when
I spotted them.

In a few other places there were merge conflicts due to a cleaner
solution being implemented later, often not using address spaces at all.
In those cases, I've preserved the new code which isn't address space
dependent.

This is part of my ongoing effort to clean out the partial address space
code which carries high risk and low test coverage, and not likely to be
finished before the 3.2 release looms closer. Duncan and I would both
like to see the above issues addressed before we return to these
changes.

llvm-svn: 167222
2012-11-01 09:14:31 +00:00
Chandler Carruth 7ec5085e01 Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type,
and also introduced a crasher bug in the constant folder reported in
PR14233.

These commits also contained several problems that should really be
addressed before they are re-committed. I have avoided reverting various
cleanups to the DataLayout APIs that are reasonable to have moving
forward in order to reduce the amount of churn, and minimize the number
of commits that were reverted. I've also manually updated merge
conflicts and manually arranged for the getIntPtrType function to stay
in DataLayout and to be defined in a plausible way after this revert.

Thanks to Duncan for working through this exact strategy with me, and
Nick Lewycky for tracking down the really annoying crasher this
triggered. (Test case to follow in its own commit.)

After discussing with Duncan extensively, and based on a note from
Micah, I'm going to continue to back out some more of the more
problematic patches in this series in order to ensure we go into the
LLVM 3.2 branch with a reasonable story here. I'll send a note to
llvmdev explaining what's going on and why.

Summary of reverted revisions:

r166634: Fix a compiler warning with an unused variable.
r166607: Add some cleanup to the DataLayout changes requested by
         Chandler.
r166596: Revert "Back out r166591, not sure why this made it through
         since I cancelled the command. Bleh, sorry about this!
r166591: Delete a directory that wasn't supposed to be checked in yet.
r166578: Add in support for getIntPtrType to get the pointer type based
         on the address space.
llvm-svn: 167221
2012-11-01 08:07:29 +00:00
Hal Finkel c89e75e93e BBVectorize: Account for internal shuffle costs
When target costs are available, use them to account for the costs of
shuffles on internal edges of the DAG of candidate pairs.

Because the shuffle costs here are currently for only the internal edges,
the current target cost model is trivial, and the chain depth requirement
is still in place, I don't yet have an easy test
case. Nevertheless, by looking at the debug output, it does seem to do the right
think to the effective "size" of each DAG of candidate pairs.

llvm-svn: 167217
2012-11-01 06:26:34 +00:00
Michael Liao 70a99c8e19 Cleanup another place redundant SP maintained
llvm-svn: 167209
2012-11-01 03:47:50 +00:00
NAKAMURA Takumi e9b89b4fe5 [CMake] Add llvm-mcmarkup to check-llvm.
llvm-svn: 167208
2012-11-01 02:13:50 +00:00
NAKAMURA Takumi 68d1700eae test/CodeGen/X86/fp-fast.ll: Add +avx.
llvm-svn: 167207
2012-11-01 02:13:45 +00:00
Owen Anderson b351c8d692 Add a few more simple fast-math constant propagations and cancellations.
llvm-svn: 167200
2012-11-01 02:00:53 +00:00
Jakob Stoklund Olesen 9892a4b794 Exploit the new identity composition in composeSubRegIndices().
The static compose() function in RegisterCoalescer was doing the exact
same thing.

llvm-svn: 167198
2012-11-01 01:15:43 +00:00
Jakub Staszak 4e45abf0ae Don't insert and erase load instruction. Simply create (new) and delete it.
llvm-svn: 167196
2012-11-01 01:10:43 +00:00
Andrew Kaylor f2c10782ce Streamlined memory manager hierarchy for MCJIT and RuntimeDyld.
Patch by Ashok Thirumurthi

llvm-svn: 167192
2012-11-01 00:46:04 +00:00
Michael J. Spencer be6f003275 [Support] Fix StrError on Windows to actually return the error string...
llvm-svn: 167191
2012-11-01 00:34:09 +00:00
Jakob Stoklund Olesen 366bd86335 Generate a table-driven version of TRI::composeSubRegIndices().
Explicitly allow composition of null sub-register indices, and handle
that common case in an inlinable stub.

Use a compressed table implementation instead of the previous nested
switches which generated pretty bad code.

llvm-svn: 167190
2012-11-01 00:32:10 +00:00
Andrew Kaylor 8565e50ad4 Fixed format strings to avoid pointer truncation during 64-bit debugging.
llvm-svn: 167185
2012-11-01 00:17:11 +00:00
Jim Grosbach acd8801e25 MC: Simple example parser for MC assembly markup.
Nothing fancy, just a simple demonstration parser.

llvm-svn: 167181
2012-10-31 23:24:13 +00:00
Shuxin Yang 01efdd6c28 (For X86) Enhancement to add-carray/sub-borrow (adc/sbb) optimization.
The adc/sbb optimization is to able to convert following expression
into a single adc/sbb instruction:
  (ult) ... = x + 1 // where the ult is unsigned-less-than comparison
  (ult) ... = x - 1

  This change is to flip the "x >u y" (i.e. ugt comparison) in order 
to expose the adc/sbb opportunity.

llvm-svn: 167180
2012-10-31 23:11:48 +00:00
Nadav Rotem 4cb8cdab5e LoopVectorize: Preserve NSW, NUW and IsExact flags.
llvm-svn: 167174
2012-10-31 21:40:39 +00:00
Nadav Rotem 6d7d39783d Fix a bug in the cost calculation of vector casts. Detect situations where bitcasts cost zero.
llvm-svn: 167170
2012-10-31 20:52:26 +00:00
Andrew Kaylor 66ebd33bd3 Mark code, not data, as executable in lli RemoteTarget simulator.
llvm-svn: 167164
2012-10-31 20:37:14 +00:00
Rafael Espindola 27783bc9c1 Remove Triple::getArchTypeForDarwinArchName. I lives on the clang driver now.
llvm-svn: 167157
2012-10-31 18:52:25 +00:00
Akira Hatanaka 4f5ef21869 [mips] Set isAsCheapAsAMove flag on ADDiu and DADDiu, which enables
re-materialization of immediate loads.

llvm-svn: 167153
2012-10-31 18:37:55 +00:00
Amara Emerson 72b86293cb MCJIT unit test: add calls to ensure that instruction caches are properly invalidated before code execution.
llvm-svn: 167146
2012-10-31 17:44:16 +00:00
Amara Emerson eb7fb84a3e Port lli bug fix from r166920 to MCJIT unit test.
llvm-svn: 167145
2012-10-31 17:41:51 +00:00
Amara Emerson f270b82181 Commit access test.
llvm-svn: 167144
2012-10-31 17:35:12 +00:00
Arnold Schwaighofer 9d08a15b0f Remove stale documentation about tail duplicaton IR pass
We no longer have a tail duplication pass that runs on LLVM IR. It was removed
in 3.0.

llvm-svn: 167140
2012-10-31 17:25:31 +00:00
Akira Hatanaka c096c88067 Test case for r167039. Check that tail-call optimization is disabled for
mips16.

llvm-svn: 167139
2012-10-31 17:25:23 +00:00
Eli Bendersky 70f4e794b5 Fix typo in CodeGenerator doc
llvm-svn: 167137
2012-10-31 16:41:07 +00:00
Benjamin Kramer ede2fe3bfd LCSSA: Try to recover compile time regressions due to SCEV updates.
- Use value handle tricks to communicate use replacements instead of forgetLoop, this is a lot faster.
- Move the "big hammer" out of the main loop so it's not called for every instruction.

This should recover most (if not all) compile time regressions introduced by this code.

llvm-svn: 167136
2012-10-31 16:30:03 +00:00
Nadav Rotem ec3ab49dda Put the threshold magic number in a variable.
llvm-svn: 167134
2012-10-31 16:22:16 +00:00
Ulrich Weigand 1caa6f9575 Disable all old-JIT unit tests on PowerPC.
These tests were all failing since the old JIT doesn't work
for PowerPC (any more), and there are no plans to attempt to
fix it again (instead, work focuses on MCJIT).

llvm-svn: 167133
2012-10-31 16:18:02 +00:00
Hans Wennborg b71f72aa82 Remove fixme about unreachable cases from SwitchToLookupTable
SimplifyCFG will have removed those cases for us.

llvm-svn: 167132
2012-10-31 16:15:25 +00:00
Nadav Rotem 1265ea8f8d Remove enum values since they are not used anymore.
llvm-svn: 167131
2012-10-31 16:14:06 +00:00
Hans Wennborg 4fef2fec3d Address Duncan's comments on r167121.
llvm-svn: 167130
2012-10-31 15:31:09 +00:00
Hal Finkel 842ad0b621 BBVectorize: Choose pair ordering to minimize shuffles
BBVectorize would, except for loads and stores, always fuse instructions
so that the first instruction (in the current source order) would always
represent the low part of the input vectors and the second instruction
would always represent the high part. This lead to too many shuffles
being produced because sometimes the opposite order produces fewer of them.

With this change, BBVectorize tracks the kind of pair connections that form
the DAG of candidate pairs, and uses that information to reorder the pairs to
avoid excess shuffles. Using this information, a future commit will be able
to add VTTI-based shuffle costs to the pair selection procedure. Importantly,
the number of remaining shuffles can now be estimated during pair selection.

There are some trivial instruction reorderings in the test cases, and one
simple additional test where we certainly want to do a reordering to
avoid an unnecessary shuffle.

llvm-svn: 167122
2012-10-31 15:17:07 +00:00
Hans Wennborg 09acdb9a16 Address Duncan's comments on r167115
- Use 0 instead of NULL
 - Helper function for "dyn_cast, else lookup in the constant pool".

llvm-svn: 167121
2012-10-31 15:14:39 +00:00
Meador Inge 05a625a0ed instcombine: Migrate strto* optimizations
This patch migrates the strto* optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

llvm-svn: 167119
2012-10-31 14:58:26 +00:00
Hans Wennborg 793b342dcf Fix false -> NULL conversion from r167115 spotted by Benjamin Kramer.
llvm-svn: 167117
2012-10-31 14:36:48 +00:00
Benjamin Kramer 1559127f6f Replace some instances of UniqueVector with SetVector, which is slightly cheaper.
No functionality change.

llvm-svn: 167116
2012-10-31 13:45:49 +00:00
Hans Wennborg 9e74dd97b8 Do simple constant propagation in lookup table formation for switches
By propagating the value for the switch condition, LLVM can now build
lookup tables for code such as:

  switch (x) {
    case 1: return 5;
    case 2: return 42;
    case 3: case 4: case 5:
      return x - 123;
    default:
      return 123;
  }

Given that x is known for each case, "x - 123" becomes a constant for
cases 3, 4, and 5.

llvm-svn: 167115
2012-10-31 13:42:45 +00:00
Benjamin Kramer c914ab6e3c Fix a couple of comment typos.
llvm-svn: 167113
2012-10-31 11:25:32 +00:00
Benjamin Kramer 8682ac1a77 LCSSA: Add a workaround for another nasty SCEV cache invalidation issue.
I'm not entirely happy with this solution, but I don't see a smarter way currently.
Fixes PR14214.

llvm-svn: 167112
2012-10-31 10:01:29 +00:00
Evgeniy Stepanov ef94169938 Add IRBuilderBase::getIntPtrTy.
llvm-svn: 167111
2012-10-31 09:50:01 +00:00
Benjamin Kramer 24c643b6de DependenceAnalysis: Don't crash if there is no constant operand.
This makes the code match the comments. Resolves a crash in loop idiom (PR14219).

llvm-svn: 167110
2012-10-31 09:20:38 +00:00
James Molloy 2f728a9185 Add support for ARM segment types PT_ARM_ARCHEXT, PT_ARM_EXIDX and PT_ARM_UNWIND.
Patch by Pete Chou!

llvm-svn: 167109
2012-10-31 09:10:56 +00:00
James Molloy 3ebe7a5a5b Add support for Cortex-A15 host recognition.
No testcase, as this is only testable on a C-A15 board.

llvm-svn: 167108
2012-10-31 09:07:37 +00:00
Reed Kotler 27a7229c47 Implement ADJCALLSTACKUP and ADJCALLSTACKDOWN
llvm-svn: 167107
2012-10-31 05:21:10 +00:00
Craig Topper 8cd3b07a51 Add scalar forms of FMA4 VFNMSUB/VFNMADD to folding tables. Patch from Cameron McInally.
llvm-svn: 167106
2012-10-31 04:59:46 +00:00
Meador Inge 6f8e01121a instcombine: Migrate strpbrk optimizations
This patch migrates the strpbrk optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

llvm-svn: 167105
2012-10-31 04:29:58 +00:00
Michael Liao e2d7e4e8e5 Clean up redundant SP register maintained in X86 TLI
llvm-svn: 167104
2012-10-31 04:14:09 +00:00
Meador Inge d589ac621b instcombine: Migrate strlen optimizations
This patch migrates the strlen optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

llvm-svn: 167103
2012-10-31 03:33:06 +00:00
Meador Inge 067294b3ac instcombine: Migrate strncpy optimizations
This patch migrates the strncpy optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

llvm-svn: 167102
2012-10-31 03:33:00 +00:00
Nadav Rotem ce77ab0c24 LoopVectorize: Do not vectorize loops with tiny constant trip counts.
llvm-svn: 167101
2012-10-31 03:31:07 +00:00
Bill Schmidt 9953cf294b This patch addresses an ABI compatibility issue with empty aggregate
parameters.  Examples of these are:

  struct { } a;
  union { } b[256];
  int a[0];

An empty aggregate has an address, although dereferencing that address is
pointless.  When passed as a parameter, an empty aggregate does not consume
a protocol register, nor does it consume a doubleword in the parameter save
area.  Passing an empty aggregate by reference passes an address just as
for any other aggregate.  Returning an empty aggregate uses GPR3 as a hidden
address of the return value location, just as for any other aggregate.

The patch modifies PPCTargetLowering::LowerFormalArguments_64SVR4 and
PPCTargetLowering::LowerCall_64SVR4 to properly skip empty aggregate
parameters passed by value.  The handling of return values and by-reference
parameters was already correct.

Built on powerpc64-unknown-linux-gnu and tested with no new regressions.
A test case is included to test proper handling of empty aggregate
parameters on both sides of the function call protocol.

llvm-svn: 167090
2012-10-31 01:15:05 +00:00
Akira Hatanaka d837be780d Change signature of function RAFast::spillAll to avoid conversion between
type MachineInstr* and MachineBasicBlock::iterator.

llvm-svn: 167088
2012-10-31 00:56:01 +00:00
Rafael Espindola 7edf38f7e3 xlc supports __attribute__((aligned(x))), use it.
Patch by Kai.

llvm-svn: 167087
2012-10-31 00:54:26 +00:00
Akira Hatanaka ebb31e9c42 Check that iterator I is not the end iterator.
llvm-svn: 167086
2012-10-31 00:50:52 +00:00
Rafael Espindola c14b96898a Add extra declarations of hash_value needed to build llvm with xlc 12.1.
Patch by Kai!

llvm-svn: 167085
2012-10-31 00:46:18 +00:00
Nadav Rotem ff7889196b Add support for loops that don't start with Zero.
This is important for loops in the LAPACK test-suite.
These loops start at 1 because they are auto-converted from fortran.

llvm-svn: 167084
2012-10-31 00:45:26 +00:00
Meador Inge 9a6a190562 instcombine: Migrate stpcpy optimizations
This patch migrates the stpcpy optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.  Note that the
__stpcpy_chk simplifications were migrated in a previous commit.

llvm-svn: 167083
2012-10-31 00:20:56 +00:00
Meador Inge cdb2ca54ae instcombine: Split out the __stpcpy_chk simplifications from StrCpyChkOpt
r166198 migrated the strcpy optimization to instcombine.  The strcpy
simplifier that was migrated from Transforms/Scalar/SimplifyLibCalls.cpp
was also doing some __strcpy_chk simplifications.  Those fortified
simplifications were migrated as well, but introduced a bug in the
__stpcpy_chk simplifier in the process.  This happened because the
__strcpy_chk and __stpcpy_chk simplifiers were both mapped to StrCpyChkOpt
which was updated with simplifications that worked for __strcpy_chk, but
not __stpcpy_chk.

This patch fixes the problem by adding proper test coverage and creating a
new simplifier for __stpcpy_chk (instead of sharing one with __strcpy_chk).

llvm-svn: 167082
2012-10-31 00:20:51 +00:00
Manman Ren 6b223a4f06 X86 SSE: update rsqrtss and rcpss to use two source operands and
the first source operand is tied to the destination operand.

This is to accurately model the corresponding instructions where the upper
bits are unmodified.

rdar://12558838
PR14221

llvm-svn: 167064
2012-10-30 23:53:59 +00:00
Eli Friedman fc1f2cd3e5 Fix regression in old-style JIT.
llvm-svn: 167057
2012-10-30 22:21:55 +00:00
Manman Ren acb8becc73 X86 MMX: optimize transfer from mmx to i32
We used to generate a store (movq) + a load.
Now we use movd.

rdar://9946746

llvm-svn: 167056
2012-10-30 22:15:38 +00:00
Nadav Rotem 47a299dcc9 Add documentation.
llvm-svn: 167055
2012-10-30 22:06:26 +00:00
Eric Christopher 206cf6487c Reformat and 80-column this. It's not strictly conforming
yet, but it's better.

llvm-svn: 167053
2012-10-30 21:36:43 +00:00
Chandler Carruth 1296b59522 Fix PR14212: For some strange reason I treated vectors differently from
integers in that the code to handle split alloca-wide integer loads or
stores doesn't come first. It should, for the same reasons as with
integers, and the PR attests to that. Also had to fix a busted assert in
that this test case also covers.

llvm-svn: 167051
2012-10-30 20:52:40 +00:00
Chad Rosier 909f6a035f [inline asm] Get the mayLoad/mayStore directly from the MIOp_ExtraInfo operand.
llvm-svn: 167050
2012-10-30 20:39:19 +00:00
Hal Finkel 08f34ac9dd BBVectorize: Cache fixed-order pairs instead of recomputing pointer info.
Instead of recomputing relative pointer information just prior to fusing,
cache this information (which also needs to be computed during the
candidate-pair selection process). This cuts down on the total number of
SE queries made, and also is a necessary intermediate step on the road toward
including shuffle costs in the pair selection procedure.

No functionality change is intended.

llvm-svn: 167049
2012-10-30 20:17:37 +00:00
Akira Hatanaka 9c962c02e4 [mips] Allow tail-call optimization for vararg functions and functions which
use the caller's stack.

llvm-svn: 167048
2012-10-30 20:16:31 +00:00
Chad Rosier 86f6050c54 Add a comment for r167040.
llvm-svn: 167046
2012-10-30 20:01:12 +00:00
Benjamin Kramer 48a6478242 LoopIdiom: Fix a serious missed optimization: we only turned top-level loops into memmove.
Thanks to Preston Briggs for catching this!

llvm-svn: 167045
2012-10-30 19:49:39 +00:00
Hal Finkel 2eaadd1a2d BBVectorize: Fix a small bug introduced in r167042.
We need to make sure that we take the correct load/store alignment
when the inputs are flipped.

llvm-svn: 167044
2012-10-30 19:47:37 +00:00
Akira Hatanaka 4866fe14e2 Add code for saving formal argument information to MipsFunctionInfo. This
information will be used by IsEligibleForTailCallOptimization to determine
whether a call can be tail-call optimized.

llvm-svn: 167043
2012-10-30 19:37:25 +00:00
Hal Finkel f384890961 BBVectorize: Simplify how input swapping is handled.
Stop propagating the FlipMemInputs variable into the routines that
create the replacement instructions. Instead, just flip the arguments
of those routines. This allows for some associated cleanup (not all
of which is done here). No functionality change is intended.

llvm-svn: 167042
2012-10-30 19:35:29 +00:00
Akira Hatanaka 6233cf565f Add definition of function MipsTargetLowering::passArgOnStack which emits nodes
for passing a function call argument on a stack.

llvm-svn: 167041
2012-10-30 19:23:25 +00:00
Chad Rosier 9e1274fb48 [inline asm] Implement mayLoad and mayStore for inline assembly. In general,
the MachineInstr MayLoad/MayLoad flags are based on the tablegen implementation.
For inline assembly, however, we need to compute these based on the constraints.

Revert r166929 as this is no longer needed, but leave the test case in place. 
rdar://12033048 and PR13504

llvm-svn: 167040
2012-10-30 19:11:54 +00:00
Akira Hatanaka 8e50aba5f9 Do not do tail-call optimization if target is mips16.
llvm-svn: 167039
2012-10-30 19:07:58 +00:00
Hal Finkel eac2887143 BBVectorize: Don't make calls to SE when the result is unused.
SE was being called during the instruction-fusion process (when the result
is unreliable, and thus ignored). No functionality change is intended.

llvm-svn: 167037
2012-10-30 18:55:49 +00:00
Nadav Rotem d3df665140 80-col
llvm-svn: 167036
2012-10-30 18:37:43 +00:00
Nadav Rotem bc21aceb19 LoopVectorize: Add support for write-only loops when the write destination is a single pointer.
Speedup SciMark by 1%

llvm-svn: 167035
2012-10-30 18:36:45 +00:00
Adhemerval Zanella 5c043aeb1b PowerPC: Expand FSRQT for vector types
This patch expands FSQRT for floating point vector types when altivec is
used.

llvm-svn: 167034
2012-10-30 18:29:42 +00:00
Nadav Rotem b3e8e688da LoopVectorize: Fix a bug in the initialization of reduction variables. AND needs to start at all-one
while XOR, and OR need to start at zero.

llvm-svn: 167032
2012-10-30 18:12:36 +00:00
Ulrich Weigand 7db4429430 Set %defaultjit to use MCJIT for PowerPC targets.
Update Transforms/LICM/2003-12-11-SinkingToPHI.ll test to use
%defaultjit as well.

llvm-svn: 167031
2012-10-30 18:07:58 +00:00
Bill Wendling 10e0e2ec49 Fix grammar.
llvm-svn: 167029
2012-10-30 17:51:02 +00:00
Michael Liao 83a77c3288 Enable ELF machine type to be specified explicitly in X86 backend
llvm-svn: 167027
2012-10-30 17:33:39 +00:00
Quentin Colombet 5799e9f66c Change ForceSizeOpt attribute into MinSize attribute
llvm-svn: 167020
2012-10-30 16:32:52 +00:00
Duncan Sands e2395dc27b Fix isEliminableCastPair to work correctly in the presence of pointers
with different sizes.

llvm-svn: 167018
2012-10-30 16:03:32 +00:00
Hans Wennborg e0cf14fa9d switch_to_lookup_table.ll: Remove some unnecessary lines, comments,
function attributes, etc.

llvm-svn: 167016
2012-10-30 15:11:52 +00:00
Adhemerval Zanella 56775e0f13 PowerPC: More support for Altivec compare operations
This patch adds more support for vector type comparisons using altivec.
It adds correct support for v16i8, v8i16, v4i32, and v4f32 vector
types for comparison operators ==, !=, >, >=, <, and <=.

llvm-svn: 167015
2012-10-30 13:50:19 +00:00
Duncan Sands 3ce427c039 Add a helper for telling whether a type is a pointer or vector of pointer type.
Simplify the implementation of the corresponding integer and float functions and
move them inline while there.

llvm-svn: 167014
2012-10-30 13:38:54 +00:00
Ulrich Weigand 6a9bb51a8d Enable some additional constant folding for PPCDoubleDouble.
This fixes Clang :: CodeGen/complex-builtints.c on PowerPC.

llvm-svn: 167013
2012-10-30 12:33:18 +00:00
Hans Wennborg f3254838e4 Use TargetTransformInfo to control switch-to-lookup table transformation
When the switch-to-lookup tables transform landed in SimplifyCFG, it
was pointed out that this could be inappropriate for some targets.
Since there was no way at the time for the pass to know anything about
the target, an awkward reverse-transform was added in CodeGenPrepare
that turned lookup tables back into switches for some targets.

This patch uses the new TargetTransformInfo to determine if a
switch should be transformed, and removes
CodeGenPrepare::ConvertLoadToSwitch.

llvm-svn: 167011
2012-10-30 11:23:25 +00:00
Hal Finkel d0b95b0961 Remove an invalid assert in TargetTransformImpl
getCastInstrCost had an assert prohibiting scalar to vector casts. Such casts,
however, are allowed. This should make the vectorizer buildbot happier.

llvm-svn: 166998
2012-10-30 02:41:57 +00:00
Sid Manning 67211fb6fb * Add e_flags enum for Hexagon
* Add Hexagon specific section indexes for small data
- Reviewed by Michael Spencer

llvm-svn: 166997
2012-10-30 02:26:15 +00:00
Jim Grosbach 4739f2eb19 ARM: Better disassembly for pc-relative LDR.
When the operand is a plain immediate rather than a label, print it
as [pc, #imm] like we do for the Thumb2 wide encoding variant.

rdar://12154503

llvm-svn: 166991
2012-10-30 01:04:51 +00:00
Reed Kotler a811753716 Change mips16 delay slot jumps to non delay slot forms by default.
We will make them delay slot forms if there is something that can be
placed in the delay slot during a separate pass. Mips16 extended instructions
cannot be placed in delay slots.

llvm-svn: 166990
2012-10-30 00:54:49 +00:00
Nadav Rotem 73ddcfe03f LoopVectorizer: change debug prints: Print the module identifier when deciding to vectorize. When deciding not to vectorize do not print the called function name because it can be null.
llvm-svn: 166989
2012-10-30 00:40:39 +00:00
Jakub Staszak a3d8e9974a Re-commit r166971. I reverted it to quickly, when buildbots didn't have a chance
to test it with chapni's fix (-mattr=+avx).

llvm-svn: 166985
2012-10-30 00:01:57 +00:00
Kevin Enderby 6fd9624843 Fix ARM's b.w instruction for thumb 2 and the encoding T4. The branch target
is 24 bits not 20 and the decoding needed to correctly handle converting the
J1 and J2 bits to their I1 and I2 values to reconstruct the displacement. 

llvm-svn: 166982
2012-10-29 23:27:20 +00:00
Jakub Staszak d74cb61d86 Revert r166971. It causes buildbot failure. To be investigated.
llvm-svn: 166979
2012-10-29 23:13:50 +00:00
NAKAMURA Takumi 382df5eb18 llvm/test/CodeGen/X86/vec_shuffle-30.ll: Try to unbreak builds - assuming +avx.
llvm-svn: 166974
2012-10-29 22:45:18 +00:00
Jakub Staszak c3a92131dc Remove unused variable.
llvm-svn: 166973
2012-10-29 22:04:32 +00:00
Jakub Staszak 9c361bdfeb Simplify code. No functionality change.
llvm-svn: 166972
2012-10-29 22:02:26 +00:00
Jakub Staszak c8f4825ba6 Allow to fold vector load if there is more than one bitcast, so in the case:
%0 = load <8 x i16>* %dest
%1 = shufflevector <8 x i16> %0, <8 x i16> %in,
      <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 13, i32 undef, i32 14, i32 14>
store <8 x i16> %1, <8 x i16>* %dest

We get:
  vmovlpd (%eax), %xmm0, %xmm0

instead of:
  vmovaps (%eax), %xmm1
  vmovsd  %xmm1, %xmm0, %xmm0

No extra test-case is added. I just fixed the existing one
(also it uses FileCheck now).

llvm-svn: 166971
2012-10-29 21:56:35 +00:00
Nadav Rotem 5ad045a8c5 LoopVectorize: Update and preserve the dominator tree info.
llvm-svn: 166970
2012-10-29 21:52:38 +00:00
Jakub Staszak 850eb67cc0 Typo.
llvm-svn: 166969
2012-10-29 21:49:46 +00:00
Bill Schmidt bd4ac26973 This patch solves a problem with passing varargs parameters under the PPC64
ELF ABI.

A varargs parameter consisting of a single-precision floating-point value,
or of a single-element aggregate containing a single-precision floating-point
value, must be passed in the low-order (rightmost) four bytes of the
doubleword stack slot reserved for that parameter.  If there are GPR protocol
registers remaining, the parameter must also be mirrored in the low-order
four bytes of the reserved GPR.

Prior to this patch, such parameters were being passed in the high-order
four bytes of the stack slot and the mirrored GPR.

The patch adds a new test case to verify the correct code generation.

llvm-svn: 166968
2012-10-29 21:18:16 +00:00
Simon Atanasyan c2cccd795f Add mips64-* and mips64el-* triples to configure scripts
as valid triples denote  Mips target.

llvm-svn: 166961
2012-10-29 19:49:45 +00:00
Reed Kotler 740981e35c Implement patterns for extloadi8 and extloadi16
llvm-svn: 166960
2012-10-29 19:39:04 +00:00
Ulrich Weigand 3abb34389d In various places throughout the code generator, there were special
checks to avoid performing compile-time arithmetic on PPCDoubleDouble.

Now that APFloat supports arithmetic on PPCDoubleDouble, those checks
are no longer needed, and we can treat the type like any other.

llvm-svn: 166958
2012-10-29 18:35:49 +00:00
Ulrich Weigand 908c936fa9 APFloat cleanup: Remove now unused "arithmeticOK" logic.
llvm-svn: 166954
2012-10-29 18:18:44 +00:00
Chad Rosier 466c1c6870 Remove redundant test case from r166949, per Eli's suggestion.
llvm-svn: 166953
2012-10-29 18:18:26 +00:00
Ulrich Weigand e1d62f9c0a APFloat cleanup: Remove now unused fields "sign2" and "exponent2".
llvm-svn: 166952
2012-10-29 18:17:42 +00:00
Ulrich Weigand d9f7e259aa Implement arithmetic on APFloat with PPCDoubleDouble semantics by
treating it as if it were an IEEE floating-point type with 106-bit
mantissa.

This makes compile-time arithmetic on "long double" for PowerPC
in clang (in particular parsing of floating point constants)
work, and fixes all "long double" related failures in the test
suite.

llvm-svn: 166951
2012-10-29 18:09:01 +00:00
Chad Rosier 1bbaa449ad [ms-inline asm] Add support for the [] operator. Essentially, [expr1][expr2] is
equivalent to [expr1 + expr2].  See test cases for more examples.
rdar://12470392

llvm-svn: 166949
2012-10-29 18:01:54 +00:00
Nadav Rotem 39aab03be3 Rename the BB-vectorize flag to match the dragonegg name
llvm-svn: 166948
2012-10-29 18:01:14 +00:00
Michael Liao ad0b69fe3e Fix PR14204
- Add missing pattern on X86ISD::VZEXT from VR256 to VR256 when AVX2 is enabled.

llvm-svn: 166947
2012-10-29 17:57:12 +00:00
Joerg Sonnenberger 2b86e48b3a Fix typo
llvm-svn: 166945
2012-10-29 17:56:15 +00:00
Jakob Stoklund Olesen 9a06696a77 Completely disallow partial copies in adjustCopiesBackFrom().
Partial copies can show up even when CoalescerPair.isPartial() returns
false. For example:

   %vreg24:dsub_0<def> = COPY %vreg31:dsub_0; QPR:%vreg24,%vreg31

Such a partial-partial copy is not good enough for the transformation
adjustCopiesBackFrom() needs to do.

llvm-svn: 166944
2012-10-29 17:51:52 +00:00
Ulrich Weigand 0de4a1e4ae Allow i32/i64 for 'f' constraint on PowerPC.
This fixes PR12757.

llvm-svn: 166943
2012-10-29 17:49:34 +00:00
Duncan Sands 5bdd9dda48 Remove a wrapper around getIntPtrType added to GVN by Hal in commit 166624 (the
wrapper returns a vector of integers when passed a vector of pointers) by having
getIntPtrType itself return a vector of integers in this case.  Outside of this
wrapper, I didn't find anywhere in the codebase that was relying on the old
behaviour for vectors of pointers, so give this a whirl through the buildbots.

llvm-svn: 166939
2012-10-29 17:31:46 +00:00
Bob Wilson 09d16aa87e Remove code to saturate profile counts.
We may need to change the way profile counter values are stored, but
saturation is the wrong thing to do.  Just remove it for now.

Patch by Alastair Murray!

llvm-svn: 166938
2012-10-29 17:27:39 +00:00
Nadav Rotem c59ae207ef Change the PassManagerBuilder (used by -O3) loop vectorizer flag from -vectorize to -vectorize-loops because we dont want to share the same flag as the bb-vectorizer.
llvm-svn: 166937
2012-10-29 16:36:25 +00:00
Hans Wennborg aad8ad1c36 Minor style fixes for TargetTransformationInfo and TargetTransformImpl
llvm-svn: 166936
2012-10-29 16:26:52 +00:00
Reed Kotler aebb8b034c Expand all atomic ops for mips16.
llvm-svn: 166935
2012-10-29 16:16:54 +00:00
NAKAMURA Takumi 83163a2ff3 llvm/Config/config.h.cmake: Good bye, Kevin! We won't honor authors in comments.
llvm-svn: 166934
2012-10-29 16:07:28 +00:00
NAKAMURA Takumi 4bd79920be PPCSubtarget.h: Add explicit braces.
llvm-svn: 166932
2012-10-29 15:51:42 +00:00
NAKAMURA Takumi 70b25de24e PPCSubtarget.h: Whitespace.
llvm-svn: 166931
2012-10-29 15:51:35 +00:00
Preston Gurd 52dacca977 This patch addresses a problem with the Post RA scheduler generating an
incorrect instruction sequence due to it not being aware that an
inline assembly instruction may reference memory.

This patch fixes the problem by causing the scheduler to always assume that any
inline assembly code instruction could access memory. This is necessary because
the internal representation of the inline instruction does not include
any information about memory accesses.
 
This should fix PR13504.

llvm-svn: 166929
2012-10-29 15:01:23 +00:00
Bill Schmidt bbc661e572 This patch adds alignment information for long double to the 64-bit PowerPC
ELF subtarget.

The existing logic is used as a fallback to avoid any changes to the Darwin
ABI.  PPC64 ELF now has two possible data layout strings: one for FreeBSD,
which requires 8-byte alignment, and a default string that requires
16-byte alignment.

I've added a test for PPC64 Linux to verify the 16-byte alignment.  If
somebody wants to add a separate test for FreeBSD, that would be great.

Note that there is a companion patch to update the alignment information
in Clang, which I am committing now as well.

llvm-svn: 166928
2012-10-29 14:59:36 +00:00
Duncan Sands 835e93a231 Factorize code: rather than duplication the logic in getPointerTypeSizeInBits,
just call getPointerTypeSizeInBits.  No functionality change.

llvm-svn: 166926
2012-10-29 14:30:05 +00:00
Duncan Sands 0a3322e5da Loads and stores without an explicit alignment use the abi alignment not the
preferred alignment.  Correct the documentation.

llvm-svn: 166925
2012-10-29 14:12:44 +00:00
Duncan Sands 59f4646614 Rather than duplicating the getPointerSize code just call getPointerSize.
llvm-svn: 166923
2012-10-29 12:19:04 +00:00
Duncan Sands ac8448e0d0 Silence a GCC warning about comparing signed and unsigned types.
llvm-svn: 166922
2012-10-29 11:29:53 +00:00
Tim Northover 3643a8f8eb Align the data section correctly when loading an ELF file.
Patch by Amara Emerson.

llvm-svn: 166920
2012-10-29 10:47:07 +00:00
Tim Northover 94bc73d3d1 Make use of common-symbol alignment info in ELF loader.
Patch by Amara Emerson.

llvm-svn: 166919
2012-10-29 10:47:04 +00:00
Tim Northover 4f223bf7c4 Add interface for querying object files for symbol values.
Currently only implemented for ELF.

Patch by Amara Emerson.

llvm-svn: 166918
2012-10-29 10:47:00 +00:00
Evgeniy Stepanov 5e9f055a4a va_start, va_end, va_copy: InstrinsicInst subclasses and InstVisitor support.
llvm-svn: 166916
2012-10-29 09:39:03 +00:00
Nadav Rotem 42f73c8e4d Calling TLI->getNumRegisters creates a circular dependency when building LLVM using cmake.
Get the number of registers by calling getTypeLegalizationCost.

PR14199.

llvm-svn: 166911
2012-10-29 05:28:35 +00:00
Lang Hames ee6142c36b Remove unused typedef.
llvm-svn: 166910
2012-10-29 04:57:52 +00:00
Rafael Espindola 7043858a5b Add -alias and -ralias options to match what we have for functions and
globals.

llvm-svn: 166909
2012-10-29 02:23:07 +00:00
Rafael Espindola 56183fbe78 llvm-extract changes linkages so that functions on both sides of the
split module can see each other. If it is keeping a symbol that already has
a non local linkage, it doesn't need to change it.

llvm-svn: 166908
2012-10-29 01:59:03 +00:00
Rafael Espindola 9d30d0fc67 llvm-extract was unable to handle aliases. It would leave a copy on the
output of both

llvm-extract foo.ll -func=bar
and
llvm-extract foo.ll -func=bar -delete

so the two new files could not be linked together anymore. With this change
alias are handled almost like functions and global variables. Almost because
with alias we cannot just clear the initializer/body, we have to create a new
declaration and replace the alias with it.

The net result is that now the output of the above commands can be linked
even if foo.ll has aliases.

llvm-svn: 166907
2012-10-29 00:27:55 +00:00
Reed Kotler e6c31579be Implement brind operator for mips16.
llvm-svn: 166903
2012-10-28 23:08:07 +00:00
Rafael Espindola d957cb2584 Remove TargetELFWriterInfo.
All the credit goes to Jan Voung for noticing it was dead!

llvm-svn: 166902
2012-10-28 21:34:43 +00:00
Reed Kotler 3589dd74ac This patch is for the implementation of mips16 complex pattern addr16.
Previously mips16 was sharing the pattern addr which is used for mips32
and mips64. This had a number of problems:
1) Storing and loading byte and halfword quantities for mips16 has particular
problems due to the primarily non mips16 nature of SP. When we must
load/store byte/halfword stack objects in a function, we must create a mips16
alias register for SP. This functionality is tested in stchar.ll.
2) We need to have an FP register under certain conditions (such as 
dynamically sized alloca). We use mips16 register S0 for this purpose.
In this case, we also use this register when accessing frame objects so this
issue also affects the complex pattern addr16. This functionality is
tested in alloca16.ll.

The Mips16InstrInfo.td has been updated to use addr16 instead of addr.

The complex pattern C++ function for addr has been copied to addr16 and
updated to reflect the above issues.

llvm-svn: 166897
2012-10-28 06:02:37 +00:00
Jakob Stoklund Olesen 57143f7e78 Never attempt to join an early-clobber def with a regular kill.
This fixes PR14194.

llvm-svn: 166880
2012-10-27 17:41:27 +00:00
Benjamin Kramer 8d2ee55a0c LoopIdiom: Add checks to avoid turning memmove into an infinite loop.
I don't think this is possible with the current implementation but that may change eventually.

llvm-svn: 166877
2012-10-27 15:18:28 +00:00
Benjamin Kramer 1c9e5186c0 LoopIdiom: Recognize memmove loops.
This turns loops like
  for (unsigned i = 0; i != n; ++i)
    p[i] = p[i+1];
into memmove, which has a highly optimized implementation in most libcs.

This was really easy with the new DependenceAnalysis :)

llvm-svn: 166875
2012-10-27 14:25:51 +00:00
Benjamin Kramer d5c9be8247 LoopIdiom: Replace custom dependence analysis with DependenceAnalysis.
Requires a lot less code and complexity on loop-idiom's side and the more
precise analysis can catch more cases, like the one I included as a test case.
This also fixes the edge-case miscompilation from PR9481.

Compile time performance seems to be slightly worse, but this is mostly due
to an extra LCSSA run scheduled by the PassManager and should be fixed there.

llvm-svn: 166874
2012-10-27 14:25:44 +00:00
Benjamin Kramer 5bc077aa88 SCEV validator: Ignore CouldNotCompute/undef on both sides. This is mostly noise and blocks finding more severe bugs.
llvm-svn: 166873
2012-10-27 11:36:07 +00:00
Benjamin Kramer 24d270db57 SCEV validator: Add workarounds for some common false positives due to the way it handles strings.
llvm-svn: 166872
2012-10-27 10:45:01 +00:00
Chandler Carruth 34e3477593 Clarify that there is an option other than OAuth for Phabricator and
offer up my email to the spam lords for it. Hopefully this will
eventually be more automatic, but we don't want people to think there is
only one option.

llvm-svn: 166870
2012-10-27 09:47:33 +00:00
Hal Finkel bad10bb2f3 Update BBVectorize to use the new VTTI instr. cost interfaces.
The monolithic interface for instruction costs has been split into
several functions. This is the corresponding change. No functionality
change is intended.

llvm-svn: 166865
2012-10-27 04:33:48 +00:00
Nadav Rotem 859366f93f 1. Fix a bug in getTypeConversion. When a *simple* type is split, we need to return the type of the split result.
2. Change the maximum vectorization width from 4 to 8.
3. A test for both.

llvm-svn: 166864
2012-10-27 04:11:32 +00:00
Quentin Colombet 3ee56a3bf5 [code size][ARM] Emit regular call instructions instead of the move, branch sequence
llvm-svn: 166854
2012-10-27 01:10:17 +00:00
Reed Kotler 7e4d9969cb Implement MipsHi for mips16
llvm-svn: 166852
2012-10-27 00:57:14 +00:00
Akira Hatanaka 6a124a84dc [mips] Do not tail-call optimize vararg functions or functions with byval
arguments.

This is rather conservative and should be fixed later to be more aggressive.

llvm-svn: 166851
2012-10-27 00:56:56 +00:00
Akira Hatanaka 2c07f1f140 [mips] Make sure FuncArg doesn't advance when OrigArgIndex is the same as in the
previous iteration.

llvm-svn: 166850
2012-10-27 00:44:39 +00:00