Commit Graph

44241 Commits

Author SHA1 Message Date
Duncan Sands 0397cd2ec4 When simplifying a call to a bitcast function, tighten up
the conditions for performing the transform when only the
function declaration is available: no longer allow turning
i32 into i64 for example.  Only allow changing between
pointer types, and between pointer types and integers of
the same size.  For return values ptr -> intptr was already
allowed; I added ptr -> ptr and intptr -> ptr while there.
As shown by a recent objc testcase, changing the way
parameters/return values are passed can be fatal when calling
code written in assembler that directly manipulates call
arguments and return values unless the transform has no
impact on the way they are passed at the codegen level.
While it is possible to imagine an ABI that treats integers
of pointer size differently to pointers, I don't think LLVM
supports any so the transform should now be safe while still
being useful.

llvm-svn: 51834
2008-06-01 07:38:42 +00:00
Bruno Cardoso Lopes bdedc148a8 Fixed flag issue that was generating infinite loop while in list scheduling.
llvm-svn: 51833
2008-06-01 03:49:39 +00:00
Steve Naroff e643e12313 Tweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types on the RHS.
This eliminates a bogus warning identified in the test below.

This fixes <rdar://problem/5968256> clang on xcode: error: incompatible type initializing 'NSObject<XCSelectionSource> *', expected 'id<NSObject,XCSelectionSource>'

llvm-svn: 51832
2008-06-01 02:43:50 +00:00
Nick Lewycky fb75d42faa Add a standard for control-flow unreachable assertions in functions that return
values, so as to avoid warnings on some platforms.

llvm-svn: 51831
2008-05-31 23:54:55 +00:00
Steve Naroff 09efde0ae7 Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.
llvm-svn: 51830
2008-05-31 23:10:15 +00:00
Gabor Greif a834b52256 updates to some svn:ignore properties
llvm-svn: 51829
2008-05-31 22:59:42 +00:00
Steve Naroff 524011f389 Teach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes a bogus error.
<rdar://problem/5967036> clang on xcode: error: incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream *')

llvm-svn: 51828
2008-05-31 22:33:45 +00:00
Chris Lattner d3f3231a07 Two identifiers are not the same unless they have the same identifier info.
llvm-svn: 51827
2008-05-31 22:01:01 +00:00
Eli Friedman 252e5f1b29 Calculate alignment for local variables.
llvm-svn: 51826
2008-05-31 21:20:41 +00:00
Ted Kremenek 380df93fd6 Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).

Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls.  This is a workaround for: <rdar://problem/5966749>

llvm-svn: 51825
2008-05-31 20:11:04 +00:00
Chris Lattner c5156a932e update this patch to handle an extraneous &1. This should be pulled
into the 2.3 release branch.

llvm-svn: 51824
2008-05-31 19:50:53 +00:00
Dan Gohman a76f0f7031 AsmWriter support for insertvalue/extractvalue. These instructions can
now round-trip through assembly and bitcode.

llvm-svn: 51823
2008-05-31 19:12:39 +00:00
Dan Gohman ca0256abb2 Improved bitcode support for insertvalue/extractvalue.
llvm-svn: 51822
2008-05-31 19:11:15 +00:00
Dan Gohman 4b1c1a46a6 Fix a copy+paste error in a comment.
llvm-svn: 51821
2008-05-31 19:09:47 +00:00
Dan Gohman 7bb04509f2 Fix some bugs with the handling of indices in insertvalue/extractvalue.
llvm-svn: 51820
2008-05-31 19:09:08 +00:00
Nick Lewycky 035fe6f716 Peer through sext/zext when looking for not(cmp).
llvm-svn: 51819
2008-05-31 19:01:33 +00:00
Nick Lewycky 69a51cbd6d Yay us! Every one of these examples turns into icmp/zext/ret.
llvm-svn: 51818
2008-05-31 18:20:26 +00:00
Nick Lewycky 26b8cd84b3 Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.
llvm-svn: 51817
2008-05-31 17:59:52 +00:00
Nick Lewycky df9242a833 Adding i1 is always Xor.
llvm-svn: 51816
2008-05-31 17:10:28 +00:00
Steve Naroff cd92aebd1f Fix <rdar://problem/5917992> clang ObjC rewriter: #end from #if statement lost in translation.
Some fancy footwork to accommodate embedded preprocessor directives within an interface.

llvm-svn: 51815
2008-05-31 14:15:04 +00:00
Mikhail Glushenkov f970edf9b7 Callback was not executed on OS X when it was a function.
llvm-svn: 51814
2008-05-31 13:43:21 +00:00
Chris Lattner 666d664595 Fix the CBE's handling of instructions whose result is an i1. Previously,
we did not truncate the value down to i1 with (x&1).  This caused a problem
when the computation of x was nontrivial, for example, "add i1 1, 1" would 
return 2 instead of 0.

This makes the testcase compile into:

...
  llvm_cbe_t = (((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u))&1);
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

instead of:

...
  llvm_cbe_t = ((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u));
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

This fixes a miscompilation of mediabench/adpcm/rawdaudio/rawdaudio and
403.gcc with the CBE, regressions from LLVM 2.2. Tanya, please pull 
this into the release branch.

llvm-svn: 51813
2008-05-31 09:23:55 +00:00
Steve Naroff 930e099b90 Fix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously commented out
This fix involved tightening up needToScanForQualifiers(), which predated ObjCQualifiedIdType.
It also includes a minor tweak to the code that searches for the beginning of the qualified type. If the AST contained the correct beginning of the declaration (i.e. the beginning of the declaration specifiers), this code would be more robust. Since it doesn't, we apply an adhoc heuristic. Note that DeclSpec contains this info...we just don't propagate it to the AST (at present).

llvm-svn: 51812
2008-05-31 05:02:17 +00:00
Steve Naroff a6141f0780 Hack RewriteObjC::RewriteObjCStringLiteral() to include the filename in the generated code (replacing any non-alphanumeric characters with "_"). This allows header files to contain ObjCStringLiterals.
llvm-svn: 51811
2008-05-31 03:35:42 +00:00
Dan Gohman 4e72438ef1 Factor several methods, including getInversePredicate and
getSwappedPredicate, from ICmpInst and FCmpInst into common
methods in CmpInst. This allows CmpInsts to be manipulated
generically.

llvm-svn: 51810
2008-05-31 02:47:54 +00:00
Steve Naroff a326bae77a Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
llvm-svn: 51809
2008-05-31 02:19:15 +00:00
Dan Gohman bd3390c73a Teach the DAGISelEmitter to not compute the variable_ops operand
index for the input pattern in terms of the output pattern. Instead
keep track of how many fixed operands the input pattern actually
has, and have the input matching code pass the output-emitting
function that index value. This simplifies the code, disentangles
variables_ops from the support for predication operations, and
makes variable_ops more robust.

llvm-svn: 51808
2008-05-31 02:11:25 +00:00
Dan Gohman 9a19f33842 Remove an unused variable.
llvm-svn: 51807
2008-05-31 01:44:25 +00:00
Dan Gohman 1ecaf45cf1 IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.

llvm-svn: 51806
2008-05-31 00:58:22 +00:00
Ted Kremenek a3774667d3 Correctly preserve the order between -F and -I options.
llvm-svn: 51803
2008-05-31 00:27:00 +00:00
Steve Naroff 66002283e6 Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.
llvm-svn: 51800
2008-05-30 23:23:16 +00:00
Evan Cheng 215c528565 Revert 51775.
llvm-svn: 51795
2008-05-30 22:47:19 +00:00
Dan Gohman 82c85c8435 Add an isAggregateType predicate.
llvm-svn: 51794
2008-05-30 22:40:06 +00:00
Evan Cheng fe3ec48bc4 Fix indentation.
llvm-svn: 51793
2008-05-30 22:39:32 +00:00
Evan Cheng 864541aa7b Fix indentation.
llvm-svn: 51792
2008-05-30 22:39:18 +00:00
Dan Gohman 52227dbfdb Add an operator< for SmallVector.
llvm-svn: 51791
2008-05-30 22:37:47 +00:00
Owen Anderson c5e21e4f38 The coalescer doesn't need LiveVariables now that we have register use iterators.
llvm-svn: 51790
2008-05-30 22:37:27 +00:00
Gabor Greif 5df4326d78 rewrite operand loops to use iterators
llvm-svn: 51789
2008-05-30 21:24:22 +00:00
Mikhail Glushenkov 7640cca259 Make all help strings start in upper case.
llvm-svn: 51788
2008-05-30 21:14:10 +00:00
Eli Friedman 6859a1b961 PR1893: Fix up the type of tentative definitions of incomplete array
types so that they end up the correct size.

llvm-svn: 51787
2008-05-30 20:39:54 +00:00
Owen Anderson 8269c9b1c9 Forgot to commit this file.
llvm-svn: 51786
2008-05-30 20:14:04 +00:00
Eli Friedman 34994cbcbf Fix and enable generating general union initializers. Essentially, what
this does is reconstruct the type for structs and arrays if the type 
wouldn't be compatible otherwise.

The assertion about packing in the struct type reconstruction code 
sucks, but I don't see any obvious way to fix it.  Maybe we need a general
utility method to take a list of types and alignments and try to construct an
unpacked type if possible?

llvm-svn: 51785
2008-05-30 19:58:50 +00:00
Mikhail Glushenkov b6725054b8 Fix the -opt switch and add a test case for it.
llvm-svn: 51784
2008-05-30 19:56:27 +00:00
Eli Friedman c18d9d53bb Allow the type of a global to be different from the type of its
associated declaration. This is a prerequisite to handling
general union initializations; for example, an array of unions involving 
pointers has to be turned into a struct because the elements can have 
incompatible types.

I refactored the code a bit to make it more readable; now, the logic for 
definitions is all in EmitGlobalVarInit.

The second parameter for GetAddrOfGlobalVar is now dead; I'll remove it 
separately.

By itself, this patch should not cause any visible changes.

llvm-svn: 51783
2008-05-30 19:50:47 +00:00
Mikhail Glushenkov 48b9f4be9d Fix indentation.
llvm-svn: 51782
2008-05-30 18:53:09 +00:00
Mikhail Glushenkov 241042b700 Add a --dry-run option to llvmc2. Patch by Holger Schurig.
llvm-svn: 51781
2008-05-30 18:48:52 +00:00
Owen Anderson e785fb639c Preserve the register coallescer, and update live intervals more correctly by triggering a renumbering after phi elimination.
llvm-svn: 51780
2008-05-30 18:38:26 +00:00
Eli Friedman 66572afde4 Allow a pointer implicitly cast to a bool as a constant expression, as
required by the standard (the standard doesn't know anything about 
implicit casts).

Disallow pointers cast to non-integral arithmetic types as constant 
expressions.  This was previously allowed by accident. 

llvm-svn: 51779
2008-05-30 18:14:48 +00:00
Eli Friedman 3360d898ec Make sure to allow assigning a pointer to a bool.
llvm-svn: 51778
2008-05-30 18:07:22 +00:00
Owen Anderson 1f59d9937f Since LCSSA switched over to DenseMap, we have to be more careful to avoid iterator invalidation. Fixes PR2385.
llvm-svn: 51777
2008-05-30 17:31:01 +00:00