OSDN Git Service
Sean Silva [Mon, 7 Jan 2013 02:30:19 +0000 (02:30 +0000)]
Simplify TableGen type-compatibility checks.
Patch by Elior Malul!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171684
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Mon, 7 Jan 2013 01:37:14 +0000 (01:37 +0000)]
Switch TargetTransformInfo from an immutable analysis pass that requires
a TargetMachine to construct (and thus isn't always available), to an
analysis group that supports layered implementations much like
AliasAnalysis does. This is a pretty massive change, with a few parts
that I was unable to easily separate (sorry), so I'll walk through it.
The first step of this conversion was to make TargetTransformInfo an
analysis group, and to sink the nonce implementations in
ScalarTargetTransformInfo and VectorTargetTranformInfo into
a NoTargetTransformInfo pass. This allows other passes to add a hard
requirement on TTI, and assume they will always get at least on
implementation.
The TargetTransformInfo analysis group leverages the delegation chaining
trick that AliasAnalysis uses, where the base class for the analysis
group delegates to the previous analysis *pass*, allowing all but tho
NoFoo analysis passes to only implement the parts of the interfaces they
support. It also introduces a new trick where each pass in the group
retains a pointer to the top-most pass that has been initialized. This
allows passes to implement one API in terms of another API and benefit
when some other pass above them in the stack has more precise results
for the second API.
The second step of this conversion is to create a pass that implements
the TargetTransformInfo analysis using the target-independent
abstractions in the code generator. This replaces the
ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
lib/Target with a single pass in lib/CodeGen called
BasicTargetTransformInfo. This class actually provides most of the TTI
functionality, basing it upon the TargetLowering abstraction and other
information in the target independent code generator.
The third step of the conversion adds support to all TargetMachines to
register custom analysis passes. This allows building those passes with
access to TargetLowering or other target-specific classes, and it also
allows each target to customize the set of analysis passes desired in
the pass manager. The baseline LLVMTargetMachine implements this
interface to add the BasicTTI pass to the pass manager, and all of the
tools that want to support target-aware TTI passes call this routine on
whatever target machine they end up with to add the appropriate passes.
The fourth step of the conversion created target-specific TTI analysis
passes for the X86 and ARM backends. These passes contain the custom
logic that was previously in their extensions of the
ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
I separated them into their own file, as now all of the interface bits
are private and they just expose a function to create the pass itself.
Then I extended these target machines to set up a custom set of analysis
passes, first adding BasicTTI as a fallback, and then adding their
customized TTI implementations.
The fourth step required logic that was shared between the target
independent layer and the specific targets to move to a different
interface, as they no longer derive from each other. As a consequence,
a helper functions were added to TargetLowering representing the common
logic needed both in the target implementation and the codegen
implementation of the TTI pass. While technically this is the only
change that could have been committed separately, it would have been
a nightmare to extract.
The final step of the conversion was just to delete all the old
boilerplate. This got rid of the ScalarTargetTransformInfo and
VectorTargetTransformInfo classes, all of the support in all of the
targets for producing instances of them, and all of the support in the
tools for manually constructing a pass based around them.
Now that TTI is a relatively normal analysis group, two things become
straightforward. First, we can sink it into lib/Analysis which is a more
natural layer for it to live. Second, clients of this interface can
depend on it *always* being available which will simplify their code and
behavior. These (and other) simplifications will follow in subsequent
commits, this one is clearly big enough.
Finally, I'm very aware that much of the comments and documentation
needs to be updated. As soon as I had this working, and plausibly well
commented, I wanted to get it committed and in front of the build bots.
I'll be doing a few passes over documentation later if it sticks.
Commits to update DragonEgg and Clang will be made presently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171681
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Mon, 7 Jan 2013 00:31:26 +0000 (00:31 +0000)]
[ObjCARC Debug Message] - Added debug message when fuse a retain/autorelease pair in ObjCARCContract::ContractAutorelease.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171679
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Mon, 7 Jan 2013 00:04:56 +0000 (00:04 +0000)]
[ObjCARC Debug Message] - Added debug message when we zap a matching retain/autorelease pair in ObjCARCOpt::OptimizeReturns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171678
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Mon, 7 Jan 2013 00:04:52 +0000 (00:04 +0000)]
[ObjCARC Debug Message] - Added debug message when we erase ARC calls with null since they are no-ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171677
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 23:39:13 +0000 (23:39 +0000)]
[ObjCARC Debug Message] - Added debug message when we add a nounwind keyword to a function which can not throw.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171676
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 23:39:09 +0000 (23:39 +0000)]
[ObjCARC Debug Message] - Added debug message when we add a tail keyword to a function which can never be passed stack args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171675
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 22:56:54 +0000 (22:56 +0000)]
[ObjCARC Debug Messages] - Added missing newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171674
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 22:56:50 +0000 (22:56 +0000)]
Added debug statement to ObjCARC when we replace objc_autorelease(x) with objc_release(x) when x is otherwise unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171673
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 21:54:30 +0000 (21:54 +0000)]
Added 2x Debug statements to ObjCARC that log when we handle the two undefined pointer-to-weak-pointer is NULL cases by replacing the given call inst with an undefined value.
The reason that there are two cases is that the first case handles the unary cases and the second the binary cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171672
91177308-0d34-0410-b5e6-
96231b3b80d8
Dmitri Gribenko [Sun, 6 Jan 2013 21:23:27 +0000 (21:23 +0000)]
Documentation: add clang 3.0 + libstdc++ 4.7.x as a known bad combination that
is actually used by a few Linux distributions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171671
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 21:07:15 +0000 (21:07 +0000)]
Added debug message in ObjCARC when we remove a no-op cast which has only special semantic meaning in the frontend and thus in the optimizer can be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171670
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sun, 6 Jan 2013 21:07:11 +0000 (21:07 +0000)]
Added debug message to ObjCARC when we transform an objc_autoreleaseReturnValue => objc_autorelease due to its operand not being used as a return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171669
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 6 Jan 2013 20:39:29 +0000 (20:39 +0000)]
Fix suffix handling for parsing and printing of cvtsi2ss, cvtsi2sd, cvtss2si, cvttss2si, cvtsd2si, and cvttsd2si to match gas behavior.
cvtsi2* should parse with an 'l' or 'q' suffix or no suffix at all. No suffix should be treated the same as 'l' suffix. Printing should always print a suffix. Previously we didn't parse or print an 'l' suffix.
cvtt*2si/cvt*2si should parse with an 'l' or 'q' suffix or not suffix at all. No suffix should use the destination register size to choose encoding. Printing should not print a suffix.
Original 'l' suffix issue with cvtsi2* pointed out by Michael Kuperstein.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171668
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Sun, 6 Jan 2013 19:00:15 +0000 (19:00 +0000)]
Fix for PR14739. It's not safe to fold a load into a call across a store. Thanks to Nick Lewycky for the initial patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171665
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Sun, 6 Jan 2013 05:59:39 +0000 (05:59 +0000)]
Fix a crash in LSR replaceCongruentIVs.
Indirect branch in the preheader crashes replaceCongruentIVs.
Fixes rdar://
12910141.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171653
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sun, 6 Jan 2013 05:23:59 +0000 (05:23 +0000)]
[objdump] Use correct format specifiers and fix C++03 variadic warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171651
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sun, 6 Jan 2013 03:57:11 +0000 (03:57 +0000)]
[Object][ELF] Fix incorrect size of members for the 64 version of Elf_Phdr_Impl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171650
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sun, 6 Jan 2013 03:56:49 +0000 (03:56 +0000)]
[objdump] Add --private-headers, -p.
This currently prints the ELF program headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171649
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sun, 6 Jan 2013 03:56:27 +0000 (03:56 +0000)]
[Object][ELF] Add program header iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171648
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sun, 6 Jan 2013 03:56:14 +0000 (03:56 +0000)]
[Object][ELF] Refactor ELFRelocationIterator into ELFEntityIterator. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171647
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Sun, 6 Jan 2013 00:14:27 +0000 (00:14 +0000)]
Add reference to dcommit on GettingStarted
Signed-off-by: Renato Golin <renato.golin@linaro.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171642
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Sat, 5 Jan 2013 21:39:33 +0000 (21:39 +0000)]
Include access modifiers in subprogram metadata IR comment.
Based on code review feedback in r171604 from Chandler Carruth &
Eric Christopher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171636
91177308-0d34-0410-b5e6-
96231b3b80d8
Dmitri Gribenko [Sat, 5 Jan 2013 18:10:06 +0000 (18:10 +0000)]
GettingStarted: improve formatting and document that configure checks for
'clang' to use it as the compiler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171630
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sat, 5 Jan 2013 17:55:42 +0000 (17:55 +0000)]
Added debug message to ObjCARC when we transform objc_retainAutorelasedReturnValue => objc_retain since the operand to said function is not a return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171629
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Sat, 5 Jan 2013 17:55:35 +0000 (17:55 +0000)]
Added debug message for ObjCARC when we zap an objc_autoreleaseReturnValue/objc_retainAutoreleasedValue pair.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171628
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 5 Jan 2013 16:44:07 +0000 (16:44 +0000)]
switch from pointer equality comparison to MDNode::getMostGenericTBAA
when merging two TBAA tags, pointed out by Nuno.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171627
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 12:32:17 +0000 (12:32 +0000)]
Funnel the actual TargetTransformInfo pass from the SelectionDAGISel
pass into the SelectionDAG itself rather than snooping on the
implementation of that pass as exposed by the TargetMachine. This
removes the last direct client of the ScalarTargetTransformInfo class
outside of the TTI pass implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171625
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 5 Jan 2013 12:08:00 +0000 (12:08 +0000)]
Attribute: Make hashes match when looking up AttributeImpls.
This isn't optimal either but fixes a massive compile time regression from the
attribute uniquing work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171624
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 11:54:35 +0000 (11:54 +0000)]
Fix another place where we build the TTI pass to the new interface.
Sorry for the noise here, 'make check' doesn't build this code. =/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171623
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 11:43:11 +0000 (11:43 +0000)]
Convert the TargetTransformInfo from an immutable pass with dynamic
interfaces which could be extracted from it, and must be provided on
construction, to a chained analysis group.
The end goal here is that TTI works much like AA -- there is a baseline
"no-op" and target independent pass which is in the group, and each
target can expose a target-specific pass in the group. These passes will
naturally chain allowing each target-specific pass to delegate to the
generic pass as needed.
In particular, this will allow a much simpler interface for passes that
would like to use TTI -- they can have a hard dependency on TTI and it
will just be satisfied by the stub implementation when that is all that
is available.
This patch is a WIP however. In particular, the "stub" pass is actually
the one and only pass, and everything there is implemented by delegating
to the target-provided interfaces. As a consequence the tools still have
to explicitly construct the pass. Switching targets to provide custom
passes and sinking the stub behavior into the NoTTI pass is the next
step.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171621
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 10:16:02 +0000 (10:16 +0000)]
Switch the loop vectorizer from VTTI to just use TTI directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171620
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 10:09:33 +0000 (10:09 +0000)]
Switch the cost model analysis over to just the TTI interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171619
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 10:05:28 +0000 (10:05 +0000)]
Switch the BB vectorizer from the VTTI interface to the simple TTI
interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171618
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 10:05:26 +0000 (10:05 +0000)]
Switch SimplifyCFG over to the TargetTransformInfo interface rather than
the ScalarTargetTransformInfo interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171617
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 10:00:09 +0000 (10:00 +0000)]
Switch LoopIdiomRecognize to directly use the TargetTransformInfo
interface rather than the ScalarTargetTransformInterface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171616
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 09:56:20 +0000 (09:56 +0000)]
Replicate the APIs of ScalarTargetTransformInfo and
VectorTargetTransformInfo into the TargetTransformInfo pass,
implementing them be delegating back out to the two subobjects.
This is the first step to folding the interfaces together and making
TargetTransformInfo a normal analysis pass (specifically an analysis
group which targets can provide target-specific analysis pass
implementations of).
No callers are migrated here, this just stubs out the interface. Next
step will be to migrate all the callers to directly operate on TTI
instead of STTI or VTTI respectively. That will allow replacing the
machinery for delivering TTI without changing every caller at once.
WIP, I promise all the duplicated interfaces will be removed in the end,
this just decouples the steps of the process.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171615
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 08:47:26 +0000 (08:47 +0000)]
Switch the empty and tombstone key enumerators to not have explicit
values -- that's not required to fix the bug that was cropping up, and
the values selected made the enumeration's underlying type signed and
introduced some warnings. This fixes the -Werror build.
The underlying issue here was that the DenseMapInfo was casting values
completely outside the range of the underlying storage of the
enumeration to the enumeration's type. GCC went and "optimized" that
into infloops and other misbehavior. By providing designated special
values for these keys in the dense map, we ensure they are indeed
representable and that they won't be used for anything else.
It might be better to reuse None for the empty key and have the
tombstone share the value of the sentinel enumerator, but honestly
having 2 extra enumerators seemed not to matter and this seems a bit
simpler. I'll let Bill shuffle this around (or ask me to shuffle it
around) if he prefers it to look a different way.
I also made the switch a bit more clear (and produce a better assert)
that the enumerators are *never* going to show up and are errors if they
do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171614
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 08:19:20 +0000 (08:19 +0000)]
While the struct being defined in the AddressingMode.h header was
unused, there were transitive includes needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171613
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 08:12:59 +0000 (08:12 +0000)]
Remove unnecessary include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171612
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sat, 5 Jan 2013 07:55:47 +0000 (07:55 +0000)]
IR/Attributes: Provide EmptyKey and TombstoneKey in part of enum, as workaround for gcc-4.4 take #2.
I will investigate, later, what was wrong. I am too tired for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171611
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Sat, 5 Jan 2013 07:43:02 +0000 (07:43 +0000)]
Emit DW_TAG_formal_parameter for unnamed parameters.
This change essentially reverts r87069 which came without a test case. It
causes no regressions in the GDB 7.5 test suite & fixes 25 xfails (commit
to the test suite to follow). If anyone can present a test case that
demonstrates why this check is necessary I'd be happy to account for it in one
way or another.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171609
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 5 Jan 2013 07:39:25 +0000 (07:39 +0000)]
Recommit r171461 which was incorrectly reverted. Mark DIV/IDIV instructions hasSideEffects=1 because they can trap when dividing by 0. This is needed to keep early if conversion from moving them across basic blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171608
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Sat, 5 Jan 2013 05:42:48 +0000 (05:42 +0000)]
Revert revision 171524. Original message:
URL: http://llvm.org/viewvc/llvm-project?rev=171524&view=rev
Log:
The current Intel Atom microarchitecture has a feature whereby when a function
returns early then it is slightly faster to execute a sequence of NOP
instructions to wait until the return address is ready,
as opposed to simply stalling on the ret instruction
until the return address is ready.
When compiling for X86 Atom only, this patch will run a pass, called
"X86PadShortFunction" which will add NOP instructions where less than four
cycles elapse between function entry and return.
It includes tests.
Patch by Andy Zhang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171603
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sat, 5 Jan 2013 05:16:53 +0000 (05:16 +0000)]
Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171601
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sat, 5 Jan 2013 05:14:23 +0000 (05:14 +0000)]
DenseMap: Appease -fstrict-aliasing on g++-4.4.
With DenseMapInfo<Enum>, it is miscompiled on g++-4.4.
static inline Enum getEmptyKey() { return Enum(<arbitrary int/unsigned value>); }
isEauql(getEmptyKey(), ...)
The compiler mis-assumes the return value is not aliased to Enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171600
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Sat, 5 Jan 2013 05:05:51 +0000 (05:05 +0000)]
Don't call destructors on MachineInstr and MachineOperand.
The series of patches leading up to this one makes llc -O0 run 8% faster.
When deallocating a MachineFunction, there is no need to visit all
MachineInstr and MachineOperand objects to deallocate them. All their
memory come from a BumpPtrAllocator that is about to be purged, and they
have empty destructors anyway.
This only applies when deallocating the MachineFunction.
DeleteMachineInstr() should still be used to recycle MI memory during
the codegen passes.
Remove the LeakDetector support for MachineInstr. I've never seen it
used before, and now it definitely doesn't work. With this patch, leaked
MachineInstrs would be much less of a problem since all of their memory
will be reclaimed by ~MachineFunction().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171599
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Sat, 5 Jan 2013 05:00:09 +0000 (05:00 +0000)]
Use ArrayRecycler for MachineInstr operand lists.
Instead of an std::vector<MachineOperand>, use MachineOperand arrays
from an ArrayRecycler living in MachineFunction.
This has several advantages:
- MachineInstr now has a trivial destructor, making it possible to
delete them in batches when destroying MachineFunction. This will be
enabled in a later patch.
- Bypassing malloc() and free() can be faster, depending on the system
library.
- MachineInstr objects and their operands are allocated from the same
BumpPtrAllocator, so they will usually be next to each other in
memory, providing better locality of reference.
- Reduce MachineInstr footprint. A std::vector is 24 bytes, the new
operand array representation only uses 8+4+1 bytes in MachineInstr.
- Better control over operand array reallocations. In the old
representation, the use-def chains would be reordered whenever a
std::vector reached its capacity. The new implementation never changes
the use-def chain order.
Note that some decisions in the code generator depend on the use-def
chain orders, so this patch may cause different assembly to be produced
in a few cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171598
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Sat, 5 Jan 2013 04:38:12 +0000 (04:38 +0000)]
Add MachineRegisterInfo::moveOperands().
This function works like memmove() for MachineOperands, except it also
updates any use-def chains containing the moved operands.
The use-def chains are updated without affecting the order of operands
in the list. That isn't possible when using the
removeRegOperandFromUseList() and addRegOperandToUseList() functions.
Callers to follow soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171597
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 03:36:17 +0000 (03:36 +0000)]
Refactor the ScalarTargetTransformInfo API for querying about the
legality of an address mode to not use a struct of four values and
instead to accept them as parameters. I'd love to have named parameters
here as most callers only care about one or two of these, but the
defaults aren't terribly scary to write out.
That said, there is no real impact of this as the passes aren't yet
using STTI for this and are still relying upon TargetLowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171595
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 02:09:22 +0000 (02:09 +0000)]
Sink the AddressingModeMatcher helper class into an anonymous namespace
next to its only user. This helper relies on TargetLowering information
that shouldn't be generally used throughout the Transfoms library, and
so it made little sense as a generic utility.
This also consolidates the file where we need to remove the remaining
uses of TargetLowering in favor of the IR-layer abstract interface in
TargetTransformInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171590
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 02:08:43 +0000 (02:08 +0000)]
Rename the unittest from ArrayRecylerTest.cpp to ArrayRecyclerTest.cpp.
Fixes the CMake build. It took me cutting and pasting this before
I managed to see the missing character. =]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171589
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Sat, 5 Jan 2013 02:00:56 +0000 (02:00 +0000)]
[mips] Fix data layout string. Add 64 to the list of native integer widths
and add stack alignment information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171587
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Sat, 5 Jan 2013 01:36:54 +0000 (01:36 +0000)]
Add a method to create an AttributeSet from an AttrBuilder.
The Attribute class is eventually going to represent one attribute. So we need
this class to create the set of attributes. Add some iterator methods to the
builder to access its internal bits in a nice way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171586
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Sat, 5 Jan 2013 01:17:46 +0000 (01:17 +0000)]
Fix a typo. Remove the duplicated test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171584
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Sat, 5 Jan 2013 01:15:47 +0000 (01:15 +0000)]
iLoopVectorize: Non commutative operators can be used as reduction variables as long as the reduction chain is used in the LHS.
PR14803.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171583
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Sat, 5 Jan 2013 00:58:48 +0000 (00:58 +0000)]
Force a fixed unroll count on the target independent tests.
This should fix clang-native-arm-cortex-a9. Thanks Renato.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171582
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Sat, 5 Jan 2013 00:57:11 +0000 (00:57 +0000)]
Add an ArrayRecycler class.
This is similar to the existing Recycler allocator, but instead of
recycling individual objects from a BumpPtrAllocator, arrays of
different sizes can be allocated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171581
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 00:42:50 +0000 (00:42 +0000)]
Eric thought that Darwin was right to use -1 consistently rather than
leaving this undefined, and despite the sentence in the standard that
seems to require it, I'll cede the point and assume its a bug in the
wording. Other parts of POSIX regularly allow for things to be -1
instead of undefined, this should too. Makes things more consistent too.
This should have to real impact for folks though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171574
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 00:34:40 +0000 (00:34 +0000)]
Fix a stray 'dnl' that my editor line-wrapped into this comment. Thanks
to filcab on IRC for spotting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171573
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Sat, 5 Jan 2013 00:32:04 +0000 (00:32 +0000)]
Make this an integer so we have enumeral types in the conditional
expression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171571
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 00:29:06 +0000 (00:29 +0000)]
Finally, fix the autoconf setup to allow for a missing clock_gettime;
the source code should now be set up to handle this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171570
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 00:23:09 +0000 (00:23 +0000)]
Provide a default constructor for TimeValue. This was used, but only in
if-ed out code paths and on Windows. Hopefully restores the Windows
build. Thanks to Reid Kleckner for helping triage this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171568
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Rosenberg [Sat, 5 Jan 2013 00:21:12 +0000 (00:21 +0000)]
Fix warnings from llvm-gcc as seen on darwin10 (10.6).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171567
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 5 Jan 2013 00:11:21 +0000 (00:11 +0000)]
Try to suppress the use of clock_gettime on Darwin which apparantly
defines _POSIX_CPUTIME but doesn't support the clock_* functions.
I don't test the value of _POSIX_CPUTIME because the spec merely says
that if it is defined, the CPU-specific timers are available, whereas it
says that _POSIX_TIMERS must be defined and defined to a value greater
than zero. However, this may not work, as the POSIX spec clearly states:
"If the symbolic constant _POSIX_CPUTIME is defined, then the symbolic
constant _POSIX_TIMERS shall also be defined by the implementation to
have the value 200112L."
If this doesn't work, I'll add more hacks for Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171565
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Fri, 4 Jan 2013 23:46:04 +0000 (23:46 +0000)]
Fix an obvious typo spotted by Reid Kleckner, and breaking windows builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171559
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Fri, 4 Jan 2013 23:27:34 +0000 (23:27 +0000)]
Get rid of the 'Bits' mask in the attribute builder.
The bit mask thing will be a thing of the past. It's not extensible enough. Get
rid of its use here. Opt instead for using a vector to hold the attributes.
Note: Some of this code will become obsolete once the rewrite is further along.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171553
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Fri, 4 Jan 2013 23:19:55 +0000 (23:19 +0000)]
Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.
For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.
For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.
For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.
In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.
The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.
The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Fri, 4 Jan 2013 23:11:35 +0000 (23:11 +0000)]
tabs-to-spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171550
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakub Staszak [Fri, 4 Jan 2013 23:01:26 +0000 (23:01 +0000)]
Move 'break' to the right place to prevent fallthru. There is no test-case
because conditions in the next case prevented from doing anything nasty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171549
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 4 Jan 2013 22:35:45 +0000 (22:35 +0000)]
Special case Recycler::clear(BumpPtrAllocator).
A BumpPtrAllocator has an empty Deallocate() method, but
Recycler::clear() would still call it for every single object ever
allocated, bringing all those objects into cache. As a bonus,
iplist::remove() will also write to the Prev/Next pointers on all the
objects, so all those cache lines have to be written back to RAM before
the pages are given back to the OS.
Stop wasting time and memory bandwith by using the new
clearAndLeakUnsafely() function to jettison all the recycled objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171541
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 4 Jan 2013 22:35:42 +0000 (22:35 +0000)]
Add an iplist::clearAndLeakNodesUnsafely() function.
The iplist::clear() function can be quite expensive because it traverses
the entire list, calling deleteNode() and removeNodeFromList() on each
element. If node destruction and deallocation can be handled some other
way, clearAndLeakNodesUnsafely() can be used to jettison all nodes
without bringing them into cache.
The function name is meant to be ominous.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171540
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 4 Jan 2013 22:17:31 +0000 (22:17 +0000)]
Move an assertion so it doesn't dereference end().
The R600 target has test cases that exercises this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171538
91177308-0d34-0410-b5e6-
96231b3b80d8
Paul Redmond [Fri, 4 Jan 2013 22:10:16 +0000 (22:10 +0000)]
Do not vectorize loops with subtraction reductions
Since subtraction does not commute the loop vectorizer incorrectly vectorizes
reductions such as x = A[i] - x.
Disabling for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171537
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 4 Jan 2013 21:51:53 +0000 (21:51 +0000)]
Add a name for the anonymous type we're creating for subrange
types and a FIXME for what we should be doing. Should solve the
immediacy of PR12069 where our debug info is crashing another
tool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171536
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Fri, 4 Jan 2013 21:30:38 +0000 (21:30 +0000)]
Added DEBUG message to ObjCARC when we optimize objc_retain => objc_retainAutorelasedReturnValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171535
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Fri, 4 Jan 2013 21:29:57 +0000 (21:29 +0000)]
Fixed up some DEBUG messages where I was putting in the text of a message the method where it was being called when I should have just prefixed the actual message with Pass::Method.
Additionally I fixed some whitespace issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171534
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 4 Jan 2013 21:08:44 +0000 (21:08 +0000)]
Fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171525
91177308-0d34-0410-b5e6-
96231b3b80d8
Preston Gurd [Fri, 4 Jan 2013 20:54:54 +0000 (20:54 +0000)]
The current Intel Atom microarchitecture has a feature whereby when a function
returns early then it is slightly faster to execute a sequence of NOP
instructions to wait until the return address is ready,
as opposed to simply stalling on the ret instruction
until the return address is ready.
When compiling for X86 Atom only, this patch will run a pass, called
"X86PadShortFunction" which will add NOP instructions where less than four
cycles elapse between function entry and return.
It includes tests.
Patch by Andy Zhang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171524
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Fri, 4 Jan 2013 20:54:35 +0000 (20:54 +0000)]
General cleanups.
* Remove dead methods.
* Use the 'operator==' method instead of 'contains', which isn't needed.
* Fix some comments.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171523
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Fri, 4 Jan 2013 20:36:28 +0000 (20:36 +0000)]
[Object][ELF] Add a maximum alignment. This is used by createELFObjectFile to create a properly aligned reader.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171520
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 4 Jan 2013 20:06:01 +0000 (20:06 +0000)]
[mips] MipsTargetLowering::getSetCCResultType should return a vector type if
vectors are being compared.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171517
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 4 Jan 2013 19:38:05 +0000 (19:38 +0000)]
[mips] 80 columns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171515
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Kledzik [Fri, 4 Jan 2013 19:32:00 +0000 (19:32 +0000)]
Fix how YAML I/O detects flow sequences.
Update test case to verify flow sequence is
written as a flow sequence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171514
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 4 Jan 2013 19:25:46 +0000 (19:25 +0000)]
[mips] Reorder template parameters. Remove class shift_rotate_imm32 and
shift_rotate_imm64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171513
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Fri, 4 Jan 2013 19:19:47 +0000 (19:19 +0000)]
Memory Dependence Analysis: fix a miscompile that uses DT to approxmiate the
reachablity.
We conservatively approximate the reachability analysis by saying it is not
reachable if there is a single path starting from "From" and the path does not
reach "To".
rdar://
12801584
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171512
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 4 Jan 2013 19:16:38 +0000 (19:16 +0000)]
[mips] Refactor conditional move instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171511
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 4 Jan 2013 19:13:49 +0000 (19:13 +0000)]
[mips] Refactor instructions which move data from or to coprocessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171510
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 4 Jan 2013 19:10:34 +0000 (19:10 +0000)]
Update the gcc-loops benchmarks results with the new automatic unrolling feature.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171509
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Bendersky [Fri, 4 Jan 2013 19:09:15 +0000 (19:09 +0000)]
fix a couple of typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171508
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Bendersky [Fri, 4 Jan 2013 19:08:43 +0000 (19:08 +0000)]
Remove unused #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171507
91177308-0d34-0410-b5e6-
96231b3b80d8
Adhemerval Zanella [Fri, 4 Jan 2013 19:08:13 +0000 (19:08 +0000)]
PowerPC: Fix eh_frame relocation for PIC
This patch fixes the PPC eh_frame definitions for the personality and
frame unwinding for PIC objects. It makes PIC build correctly creates
relative relocations in the '.rela.eh_frame' segments and thus avoiding
a text relocation that generates a DT_TEXTREL segments in link phase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171506
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 4 Jan 2013 19:00:42 +0000 (19:00 +0000)]
Add linpack-pc bench
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171499
91177308-0d34-0410-b5e6-
96231b3b80d8
Joel Jones [Fri, 4 Jan 2013 18:55:24 +0000 (18:55 +0000)]
Add Textmate bundle for Tablegen syntax-highlighting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171496
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 4 Jan 2013 18:40:39 +0000 (18:40 +0000)]
Change the default number of registers to prevent unrolling on targets that dont have this hook.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171489
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 4 Jan 2013 18:30:36 +0000 (18:30 +0000)]
Add a space to the end of the line so we don't get "itsbounds" in output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171487
91177308-0d34-0410-b5e6-
96231b3b80d8
Pedro Artigas [Fri, 4 Jan 2013 18:04:42 +0000 (18:04 +0000)]
small fixes to enable the reuse of the pass manager across multiple modules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171475
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 4 Jan 2013 17:59:22 +0000 (17:59 +0000)]
Add section information for the DWARF5 split debug proposal
string offset section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171474
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 4 Jan 2013 17:59:17 +0000 (17:59 +0000)]
Make comment a bit more clear.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171473
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Fri, 4 Jan 2013 17:57:44 +0000 (17:57 +0000)]
Move the loop vectorizer from O2 to O3. It looks like the increase in code size actually hurts the performance on many programs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171471
91177308-0d34-0410-b5e6-
96231b3b80d8