Commit Graph

13675 Commits

Author SHA1 Message Date
Eric Christopher
0891d99b87 Fix unused param warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128005 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:06:32 +00:00
Jay Foad
b963e2320f Fix typos in assert messages.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128002 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 16:38:22 +00:00
Bill Wendling
a5c177e70a We need to pass the TargetMachine object to the InstPrinter if we are printing
the alias of an InstAlias instead of the thing being aliased. Because we need to
know the features that are valid for an InstAlias.

This is part of a work-in-progress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 04:13:46 +00:00
Evan Cheng
485fafc840 Re-apply r127953 with fixes: eliminate empty return block if it has no predecessors; update dominator tree if cfg is modified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127981 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 01:19:09 +00:00
Argyrios Kyrtzidis
b518c25b3e If a class inherits from RefCountedBaseVPTR allow all its subclasses to be used with IntrusiveRefCntPtr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127966 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 06:14:56 +00:00
Daniel Dunbar
7a90e04fc7 Revert r127953, "SimplifyCFG has stopped duplicating returns into predecessors
to canonicalize IR", it broke a lot of things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127954 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 21:47:14 +00:00
Evan Cheng
ae16d6b972 SimplifyCFG has stopped duplicating returns into predecessors to canonicalize IR
to have single return block (at least getting there) for optimizations. This
is general goodness but it would prevent some tailcall optimizations.
One specific case is code like this:
int f1(void);
int f2(void);
int f3(void);
int f4(void);
int f5(void);
int f6(void);
int foo(int x) {
  switch(x) {
  case 1: return f1();
  case 2: return f2();
  case 3: return f3();
  case 4: return f4();
  case 5: return f5();
  case 6: return f6();
  }
}

=>
LBB0_2:                                 ## %sw.bb
  callq   _f1
  popq    %rbp
  ret
LBB0_3:                                 ## %sw.bb1
  callq   _f2
  popq    %rbp
  ret
LBB0_4:                                 ## %sw.bb3
  callq   _f3
  popq    %rbp
  ret

This patch teaches codegenprep to duplicate returns when the return value
is a phi and where the phi operands are produced by tail calls followed by
an unconditional branch:

sw.bb7:                                           ; preds = %entry
  %call8 = tail call i32 @f5() nounwind
  br label %return
sw.bb9:                                           ; preds = %entry
  %call10 = tail call i32 @f6() nounwind
  br label %return
return:
  %retval.0 = phi i32 [ %call10, %sw.bb9 ], [ %call8, %sw.bb7 ], ... [ 0, %entry ]
  ret i32 %retval.0

This allows codegen to generate better code like this:

LBB0_2:                                 ## %sw.bb
        jmp     _f1                     ## TAILCALL
LBB0_3:                                 ## %sw.bb1
        jmp     _f2                     ## TAILCALL
LBB0_4:                                 ## %sw.bb3
        jmp     _f3                     ## TAILCALL

rdar://9147433


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 17:17:39 +00:00
Stuart Hastings
65c8bca788 Reapply 127939 since Daniel fixed the breakage. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127944 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 02:42:31 +00:00
Stuart Hastings
825dd96918 Revert 127939. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 02:33:56 +00:00
Stuart Hastings
7257897402 Revise r126127 to address Daniel's comments. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 01:32:01 +00:00
Ted Kremenek
1a06d5721a Tweak CrashRecoveryContextCleanup to provide an easy method for clients to select between 'delete' and 'destructor' cleanups, and allow the destructor of CrashRecoveryContextCleanupRegister to be pseudo re-entrant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 00:59:37 +00:00
Devang Patel
36fae67831 If an AllocaInst referred by DbgDeclareInst is used by a LoadInst then the LoadInst should also get a corresponding llvm.dbg.value intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127924 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 23:45:43 +00:00
Jim Grosbach
31649e61bc Beginnings of MC-JIT code generation.
Proof-of-concept code that code-gens a module to an in-memory MachO object.
This will be hooked up to a run-time dynamic linker library (see: llvm-rtdyld
for similarly conceptual work for that part) which will take the compiled
object and link it together with the rest of the system, providing back to the
JIT a table of available symbols which will be used to respond to the
getPointerTo*() queries.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127916 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 22:48:41 +00:00
Andrew Trick
5fd5b125ff Avoid creating canonical induction variables for non-native types.
For example, on 32-bit architecture, don't promote all uses of the IV
to 64-bits just because one use is a 64-bit cast.
Alternate implementation of the patch by Arnaud de Grandmaison.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127884 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 16:50:32 +00:00
Jim Grosbach
84161c2f68 Tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127883 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 16:39:36 +00:00
Ted Kremenek
289bdccddf Tweak CrashRecoveryContextCleanup::createCleanup() to use the 'delete' cleanup as opposed to the 'destructor' cleanup (reclaims more memory).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127865 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 03:46:21 +00:00
Ted Kremenek
0597234028 Add new CrashRecoveryContextCleanup subclass: CrashRecoveryContextDeleteCleanup. This deletes the object, not just calls its destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127855 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 03:04:18 +00:00
Ted Kremenek
a4f9839701 Augment CrashRecoveryContext to have registered "cleanup" objects that can be used to release resources during a crash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 02:05:11 +00:00
Andrew Trick
b12a754cce Added isValidRewrite() to check the result of ScalarEvolutionExpander.
SCEV may generate expressions composed of multiple pointers, which can
lead to invalid GEP expansion. Until we can teach SCEV to follow strict
pointer rules, make sure no bad GEPs creep into IR.
Fixes rdar://problem/9038671.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127839 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 23:51:11 +00:00
Rafael Espindola
9916d2ac39 Use RequiresNullTerminator to create buffers without a null terminator
instead of copying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 22:18:42 +00:00
Devang Patel
813c9a0f19 Try to not lose variable's debug info during instcombine.
This is done by lowering dbg.declare intrinsic into dbg.value intrinsic.
Radar 9143931.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127834 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 22:18:16 +00:00
Devang Patel
5ee20680c7 Refactor into a separate utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127832 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 21:58:19 +00:00
Benjamin Kramer
d9103df51b Add an argument to APInt's magic udiv calculation to specify the number of bits that are known zero in the divided number.
This will come in handy soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127828 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 20:39:06 +00:00
Jakob Stoklund Olesen
6a3dbd3b25 Dead code elimination may separate the live interval into multiple connected components.
I have convinced myself that it can only happen when a phi value dies. When it
happens, allocate new virtual registers for the components.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 20:37:07 +00:00
Richard Osborne
11bd0784d9 Add XCore intrinsic for setpsc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127821 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 18:42:05 +00:00
Cameron Zwarich
7bbf0ee97c Move more logic into getTypeForExtArgOrReturn.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 14:53:37 +00:00
Cameron Zwarich
4457968011 Rename getTypeForExtendedInteger() to getTypeForExtArgOrReturn().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 14:21:56 +00:00
Jakob Stoklund Olesen
2254227791 Rewrite instructions as part of ConnectedVNInfoEqClasses::Distribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 00:23:45 +00:00
Cameron Zwarich
ebe8173941 The x86-64 ABI says that a bool is only guaranteed to be sign-extended to a byte
rather than an int. Thankfully, this only causes LLVM to miss optimizations, not
generate incorrect code.

This just fixes the zext at the return. We still insert an i32 ZextAssert when
reading a function's arguments, but it is followed by a truncate and another i8
ZextAssert so it is not optimized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127766 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:20:18 +00:00
Richard Osborne
e17139b3e9 Add XCore intrinsics for setclk, setrdy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 21:56:00 +00:00
Richard Osborne
bb057453db Add checkevent intrinsic to check if any resources owned by the current thread
can event.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 18:34:00 +00:00
Cameron Zwarich
82bae7dafc Add TargetData::fitsInLegalInteger().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 00:13:28 +00:00
John Thompson
6046cffbaf Add scei vendor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127705 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 21:51:56 +00:00
Richard Osborne
5aad8b3e78 Add XCore intrinsics for getps, setps, setsr and clrsr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127678 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 13:45:47 +00:00
Justin Holewinski
625eec10fe PTX: Set PTX 2.0 as the minimum supported version
- Remove PTX 1.4 code generation
- Change type of intrinsics to .v4.i32 instead of .v4.i16
- Add and/or/xor integer instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127677 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 13:24:15 +00:00
Evan Cheng
0f040a258f - Add "Bitcast" target instruction property for instructions which perform
nothing more than a bitcast.
- Teach tablegen to automatically infer "Bitcast" property.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 05:09:26 +00:00
John McCall
b121bfcc22 Version N of the llvm_unreachable patch: VC++ doesn't recognize that abort()
doesn't return, so just go back to using the old runtime function instead
of trying to use abort() when __builtin_unreachable (or an equivalent) isn't
supported.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127629 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 22:41:50 +00:00
Jakob Stoklund Olesen
cf03e35d90 Place context in member variables instead of passing around pointers.
Use the opportunity to get rid of the trailing underscore variable names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:57:14 +00:00
John McCall
fb32507d09 Okay, some compilers complain if you provide the exception-specification
where none was before.  Just don't declare it and hope it's declared
in every translation unit that needs it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:20:29 +00:00
John McCall
f32b3c54f0 Fix the exception-specification of abort() when declaring it in C++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127610 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:10:50 +00:00
John McCall
2f9a9ed785 Make llvm_unreachable evaluate to __builtin_unreachable() in -Asserts
builds, which was the apparent consensus of PR8973 and llvmdev.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127608 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:01:21 +00:00
Andrew Trick
3228cc259b Added SCEV::NoWrapFlags to manage unsigned, signed, and self wrap
properties.
Added the self-wrap flag for SCEV::AddRecExpr.
A slew of temporary FIXMEs indicate the intention of the no-self-wrap flag
without changing behavior in this revision.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127590 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 16:50:06 +00:00
Mikhail Glushenkov
046d0bdaf0 Emacs mode string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 04:20:57 +00:00
Duncan Sands
ba9934648f Speculatively revert commit 127478 (jsjodin) in an attempt to fix the
llvm-gcc-i386-linux-selfhost and llvm-x86_64-linux-checks buildbots.
The original log entry:
Remove optimization emitting a reference insted of label difference, since
it can create more relocations. Removed isBaseAddressKnownZero method,
because it is no longer used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127540 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 13:07:37 +00:00
Owen Anderson
2ce5bf188d Teach FastISel to support register-immediate-immediate instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 21:33:55 +00:00
Jim Grosbach
2a09f878ef 80 columns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127495 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 21:02:27 +00:00
Jim Grosbach
108e4dbecb Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127493 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 20:59:19 +00:00
Jan Sjödin
e4f6d7461a Remove optimization emitting a reference insted of label difference, since it can create more relocations. Removed isBaseAddressKnownZero method, because it is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 19:37:02 +00:00
Rafael Espindola
f7fdad15d9 Add r127409 back now that the windows file was updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:33:29 +00:00
Jakob Stoklund Olesen
4b0e1f1278 Revert r127409 which broke all the Windows bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:01:43 +00:00