Commit Graph

1303 Commits

Author SHA1 Message Date
Stuart Hastings 7fdc6707ac Clang support for ARM Uv/Uy/Uq inline-asm constraints.
rdar://problem/9037836

llvm-svn: 132737
2011-06-07 23:45:05 +00:00
Galina Kistanova f56b4f6fdd These tests require particular registered targets. Declared as such.
llvm-svn: 132600
2011-06-03 22:24:54 +00:00
Galina Kistanova b38fd263bd Added registered targets for in-test dependency declarations.
llvm-svn: 132571
2011-06-03 18:36:30 +00:00
John McCall 77bdccd9bc Test case for some AVX builtins. Patch by Syoyo Fujita!
llvm-svn: 132518
2011-06-03 00:02:45 +00:00
Galina Kistanova 123363cf10 Reverted r132330, r132321, r132320, r132319 as per discussion. Will try in-test requirement declarations instead.
llvm-svn: 132491
2011-06-02 21:55:39 +00:00
Rafael Espindola fb2af643e4 Implement -fgnu89-inline. Fixes PR10041.
llvm-svn: 132460
2011-06-02 16:13:27 +00:00
Galina Kistanova 4503e20ae6 Just one for now to see how it will fly.
llvm-svn: 132321
2011-05-31 00:34:37 +00:00
Eli Friedman b857842c48 Add unnamed_addr to internal globals which are only used as an operand to memcpy. (Spotted by looking at IR.)
llvm-svn: 132226
2011-05-27 22:32:55 +00:00
Eli Friedman 6ffb623a52 Match llvm-gcc's string literals alignment by forcing alignment on string literals to 1. This can significantly impact the size of the string data, and as far as I know, the alignment doesn't help performance. rdar://9078969 .
llvm-svn: 132223
2011-05-27 22:13:20 +00:00
Eli Friedman df96819daf Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.
Originally r130717, but was backed out due to an ObjC regression.

llvm-svn: 132102
2011-05-26 00:10:27 +00:00
Chris Lattner e76b95ae15 make the x86-32 backend specify a byval alignment, even when the
code generator will do it.  With this patch, clang compiles the example
in PR9794 to not have an alloca temporary.

llvm-svn: 131881
2011-05-22 23:35:00 +00:00
Chris Lattner 44c2b90556 Fix x86-64 byval passing to specify the alignment even when the code
generator will give it something sufficient.  This is important because
the mid-level optimizer doesn't know what alignment is required otherwise.

llvm-svn: 131879
2011-05-22 23:21:23 +00:00
Nick Lewycky 2e83c4c4c3 Fix fallout from r131838.
llvm-svn: 131844
2011-05-22 06:50:05 +00:00
Eli Friedman 2f1e9e618c Make __builtin_shufflevector and -ftrapv work correctly together. PR9945.
llvm-svn: 131611
2011-05-19 00:37:32 +00:00
Joerg Sonnenberger caf8ffd8e3 Bug 8765: Honor assembler labels for builtins. Ensure that the label is
mangled to avoid doing it twice for platforms that use prefixes like
Darwin.

llvm-svn: 131311
2011-05-13 21:12:10 +00:00
Bill Wendling bb455154a1 Remove the 'unaligned load' builtins now that they're no longer used in the *mmintrin.h files.
llvm-svn: 131300
2011-05-13 18:52:28 +00:00
Bill Wendling e106c34817 LLVM doesn't always optimize away the four loads from this:
(__m128){ p[0], p[1], p[2], p[3] }

which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>

llvm-svn: 131237
2011-05-12 19:02:15 +00:00
Fariborz Jahanian b0c0cdc509 Clean up consequences of cut and paste.
llvm-svn: 131190
2011-05-11 17:07:02 +00:00
Fariborz Jahanian 783243b3ca Implenment #pack pragma and ms_struct attribute layout.
Concludes // radar://8823265.

llvm-svn: 131188
2011-05-11 16:58:31 +00:00
Fariborz Jahanian 07ceb0a1a4 Support pack pragma and ms_struct attributes. // rdar://8823265
llvm-svn: 131142
2011-05-10 19:00:50 +00:00
Fariborz Jahanian 7adbed6b4d 'long long' requires special treatment in ms_struct
structs (impacts 32-bit only though).

llvm-svn: 131103
2011-05-09 22:03:17 +00:00
Douglas Gregor 9ca5465500 Revert r130717, which caused a regression (<rdar://problem/9402621>).
llvm-svn: 131057
2011-05-07 20:12:26 +00:00
Fariborz Jahanian 307eace474 In ms_struct structs, Establish a new alignment for a
non-bitfield following a bitfield if size of their types differ.

llvm-svn: 131032
2011-05-06 22:42:22 +00:00
Fariborz Jahanian b7a2879677 Establish a new alignment for an ms_struct bitfield following
a non-bitfield if size of their types differ.

llvm-svn: 131023
2011-05-06 21:56:12 +00:00
Eli Friedman 409943efcb Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).
llvm-svn: 131000
2011-05-06 18:04:18 +00:00
Fariborz Jahanian 9f1071831f __alignof attribute on the field must consider
packed attribute on the field. //rdar://9217290

llvm-svn: 130948
2011-05-05 21:19:14 +00:00
Daniel Dunbar 6cb7f64e8b tests: Force a triple in this test (so uint128 is present).
llvm-svn: 130941
2011-05-05 18:54:06 +00:00
Devang Patel 979aba5d09 Do not drop uint128 on the floor.
llvm-svn: 130929
2011-05-05 17:06:30 +00:00
Fariborz Jahanian 9d82fea378 And a test case for my last patch.
llvm-svn: 130853
2011-05-04 18:58:27 +00:00
Fariborz Jahanian 84335f7c8e More ms_struct bitfield stuff:
Adjacent bit fields are packed into the same 1-, 2-, or
4-byte allocation unit if the integral types are the same
size. // rdar://8823265.

llvm-svn: 130851
2011-05-04 18:51:37 +00:00
Fariborz Jahanian 759e4a1add Only the first zero-length bitfield decides alignment of
the followup data member in an ms_struct struct.
// rdar:// 8823265

llvm-svn: 130795
2011-05-03 22:07:14 +00:00
Fariborz Jahanian fc0fe6eb52 Finish off rules for z-length bitfields in ms_struct
structs. // rdar://8823265

llvm-svn: 130783
2011-05-03 20:21:04 +00:00
Chad Rosier f897d3b88b Fixed test case asserts due to checkin of r130710.
llvm-svn: 130720
2011-05-02 20:39:21 +00:00
Eli Friedman 30458b51e3 Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.
llvm-svn: 130717
2011-05-02 20:24:29 +00:00
Fariborz Jahanian eb39741c0b More rule enforcement of zero bitfields for ms_struct.
llvm-svn: 130696
2011-05-02 17:20:56 +00:00
Fariborz Jahanian 99514b9168 block variables on lhs need be ir-gen'ed after the
rhs when its 'forwarding' pointer may be modified 
in rhs evaluation as result of call to Block_copy.
// rdar://9309454

llvm-svn: 130545
2011-04-29 21:53:21 +00:00
Fariborz Jahanian 8409bce4ac ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.

llvm-svn: 130451
2011-04-28 22:49:46 +00:00
Fariborz Jahanian bcb23a180b With ms_struct attribut, Zero-length bitfields following
non-bitfield members are ignore. // rdar://8823265 wip

llvm-svn: 130257
2011-04-26 23:52:16 +00:00
Fariborz Jahanian 5a866c0bf2 Ir-gen the side-effect(s) when __builtin_expect is
constant-folded. // rdar://9330105

llvm-svn: 130163
2011-04-25 22:30:02 +00:00
Bob Wilson ee674fb73d Workaround buildbot failure by hacking up this test to emit llvm IR.
This is not a real fix.  It needs some checks to make sure the IR is correct.

llvm-svn: 130012
2011-04-22 20:42:46 +00:00
Justin Holewinski bd4a3c03ff PTX: Add default PTX calling conventions
llvm-svn: 129987
2011-04-22 11:10:38 +00:00
Bob Wilson bf0cd6b83d Add a testcase for svn r129964 (Neon load/store intrinsic alignments).
llvm-svn: 129979
2011-04-22 04:06:49 +00:00
John McCall e0fda7377e The 0.98 revision of the x86-64 ABI clarified a lot of things, some
of which break strict compatibility with previous compilers.  Implement
one of them and then immediately opt out on Darwin.

llvm-svn: 129899
2011-04-21 01:20:55 +00:00
Chris Lattner 54fd1a1ad3 fix a crash on code that uses the result value of __builtin___memcpy_chk.
llvm-svn: 129892
2011-04-20 23:14:50 +00:00
Justin Holewinski 514cce8e43 PTX: Add PTX intrinsics as builtins and add ptx32 and ptx64 as valid architectures for triples, e.g. ptx32-unknown-unknown
llvm-svn: 129870
2011-04-20 19:34:15 +00:00
Chris Lattner 97bbee2fb4 Fix a miscompilation I introduced in r129652, thanks for Eli for tracking
it down.  we effectively were compile the testcase into:

void test14(int x) {
  switch (x) {
    case 11: break;
    case 42: test14(97);  // fallthrough
    default: test14(42); break;

which is not the same thing at all.  This fixes a miscompilation of 
MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot.

llvm-svn: 129679
2011-04-17 23:21:26 +00:00
Chris Lattner 38b6057a93 when assertions are disabled, labels go away. Hopefully fixes the windows build.
llvm-svn: 129660
2011-04-17 16:19:57 +00:00
Chris Lattner bc204c8043 implement rdar://9289524 - case followed immediately by break results in empty IR block,
a -O0 code quality issue.

llvm-svn: 129652
2011-04-17 00:54:30 +00:00
Chris Lattner 30107ed600 fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
are trivial.  This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.

This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0

llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Chris Lattner 56784f9de6 fix rdar://9289603 - clang should fold trivial ?: for enums as well as integer constants into select at -O0
by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant.  In particular, we now fold enums.

llvm-svn: 129649
2011-04-16 23:15:35 +00:00
Michael J. Spencer 6826eb816a Add 3DNow! Intrinsics.
llvm-svn: 129570
2011-04-15 15:07:13 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Anton Korobeynikov 231e875b5c Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.

In particular, all library functions should always be AAPCS regardless of floating point ABI used.

llvm-svn: 129534
2011-04-14 20:06:49 +00:00
Bill Wendling a865185ad6 Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Eli Friedman 493c34a86c PR9580: Handle vectors correctly in ScalarExprEmitter::EmitRem.
While I'm here, FileCheck-ize the ext-vector test, so we actually check
what it is generating.

llvm-svn: 129241
2011-04-10 04:44:11 +00:00
Eli Friedman c5b20b5283 PR8369: make __attribute((regparm(0))) work correctly. Original patch by
pageexec@freemail.hu, tweaks by me.

llvm-svn: 129206
2011-04-09 08:18:08 +00:00
Chris Lattner 9cb59fa834 add a __sync_swap builtin to fill out the rest of the __sync builtins.
Patch by Dave Zarzycki!

llvm-svn: 129189
2011-04-09 03:57:26 +00:00
John McCall 26d365e149 I can't figure out any reasonable way to make this test non-host-dependent,
so I'm killing it.

llvm-svn: 129026
2011-04-06 20:46:42 +00:00
Peter Collingbourne ba3e6667cc Do not use IR marker for LLVM intrinsics
llvm-svn: 129001
2011-04-06 12:29:09 +00:00
John McCall b1915d62a7 Make this a -cc1 test with a triple and a target feature.
llvm-svn: 128993
2011-04-06 06:48:04 +00:00
John McCall 3cacdf5dbb Anonymify this test.
llvm-svn: 128987
2011-04-06 04:29:52 +00:00
John McCall 91a528841b Implement the AVX cmp builtins as macros instead of static inlines.
Patch by Syoyo Fujita!  Reviewed by Chris Lattner!  Checked in by me!

llvm-svn: 128984
2011-04-06 03:37:51 +00:00
Daniel Dunbar 826342774e IRgen: Reapply r128691 with a fix to ensure we don't increase alignment past
that of the array element type.

llvm-svn: 128698
2011-04-01 00:49:43 +00:00
Daniel Dunbar ea6b81a2ad Revert r128691, "IRgen: Improve GCC compatibility when dealing with packed
arrays by propagating", it's breaking test in ways I don't understand yet.

llvm-svn: 128693
2011-04-01 00:13:33 +00:00
Daniel Dunbar 417bf0f147 IRgen: Improve GCC compatibility when dealing with packed arrays by propagating
the array alignment to the array access.
 - This is more or less the best we can do without having alignment present in
   the type system, but is a long way from truly matching how GCC handles this.

llvm-svn: 128691
2011-03-31 23:32:15 +00:00
Devang Patel adc35e28fc Robustify test string.
llvm-svn: 128486
2011-03-29 21:06:43 +00:00
Devang Patel 298ecb3aaf Add target triple.
llvm-svn: 128480
2011-03-29 20:00:06 +00:00
Devang Patel 6f2e41e0d4 Do not line number entry for unconditional branches. Usually, users do not want to stop at closing '}'.
llvm-svn: 128471
2011-03-29 18:35:54 +00:00
Anton Yartsev 28ccef788b supported: AltiVec vector initialization with a single literal according to PIM section 2.5.1 - after initialization all elements have the value specified by the literal
llvm-svn: 128375
2011-03-27 09:32:40 +00:00
Douglas Gregor 1baf38f5a6 On Mac OS X, the presence of an 'availability' attribute for that
platform implies default visibility. To achieve these, refactor our
lookup of explicit visibility so that we search for both an explicit
VisibilityAttr and an appropriate AvailabilityAttr, favoring the
VisibilityAttr if it is present.

llvm-svn: 128336
2011-03-26 12:10:19 +00:00
John Thompson 88903beaf5 Fixed some of the incompatibilities with gcc.
llvm-svn: 128228
2011-03-24 18:51:57 +00:00
Eli Friedman b4d3c99929 Make sure we aggressively attach nounwind (etc.) to calls to library
functions of the form __builtin_XXX.

llvm-svn: 128198
2011-03-24 05:09:45 +00:00
Rafael Espindola 0c1f098284 Switch from internal to linker_private linkage, it is sufficient to please the new linker.
llvm-svn: 127622
2011-03-14 21:08:19 +00:00
Eric Christopher cf5e83b471 __clear_cache() is varargs and people will occasionally write it without
arguments. Process only the arguments that people write, but process
all of them.

Fixes rdar://8900346

llvm-svn: 127616
2011-03-14 20:30:34 +00:00
Rafael Espindola 7a6cf01895 Fix link of libxul with LTO and the linker in xcode4. It is not clear if this
is working around a bug in ld or if the new linker has a reasonable reason
for wanting the string constant to be linker visible.

llvm-svn: 127594
2011-03-14 17:55:00 +00:00
Bill Wendling ec9d2633f1 When we adjust the inline ASM type, we need to take into account an early
clobber with the 'y' constraint. Otherwise, we get the wrong return type and an
assert, because it created a '<1 x i64>' vector type instead of the x86_mmx
type.

llvm-svn: 127185
2011-03-07 22:47:14 +00:00
Douglas Gregor 19da4e4397 Revert r126422 "Use private linkage to avoid symbol conflicts in
corner cases like the one in PR9301." which caused PR9416. 

llvm-svn: 127136
2011-03-06 23:28:21 +00:00
NAKAMURA Takumi 98835748e3 test/CodeGen/2008-07-17-no-emit-on-error.c: Use LLVM's opt instead of "test(1)" for Mingw MSYS.
Mingw MSYS does not have test.exe (only shell built-in test), and is not capable to invoke test(1) from utils/not.

llvm-svn: 127078
2011-03-05 11:15:55 +00:00
Benjamin Kramer 0f074df979 Only emit string initializers in-place if types match. Fixes PR9373.
llvm-svn: 126883
2011-03-02 21:27:44 +00:00
Eli Friedman 846ded2e53 PR9350: increment/decrement of char (and anything else narrower than int)
can't overflow due to promotion rules; emit a wrapping add for those cases.

llvm-svn: 126816
2011-03-02 01:49:12 +00:00
Douglas Gregor 1bbd2d2ece Kill off more names to fix this test
llvm-svn: 126775
2011-03-01 19:55:40 +00:00
Roman Divacky 5e1af659e9 Fix the test.
llvm-svn: 126768
2011-03-01 18:50:59 +00:00
Roman Divacky 65b88cdb3b Implement -mrtd which sets the StdCall calling convention to be the default
one.

llvm-svn: 126756
2011-03-01 17:40:53 +00:00
Chris Lattner 2e72da947c -fwrapv should turn off the inbounds markers from geps used for pointer
arithmetic.  This is part of PR9256, it would be great if someone else
wired up -fno-strict-overflow in the driver to -fwrapv.

llvm-svn: 126718
2011-03-01 00:03:48 +00:00
Chris Lattner 35d3ac5e9e Make skipping of vardecls more precise: it's ok to skip a decl if the entire
compound stmt containing the decl is skipped.

llvm-svn: 126639
2011-02-28 07:22:44 +00:00
Chris Lattner 62208c395a make switch constant folding a bit stronger, handling a missed case.
llvm-svn: 126638
2011-02-28 07:16:14 +00:00
Ken Dyck 1b4420ed42 Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.

llvm-svn: 126628
2011-02-28 02:01:38 +00:00
Chris Lattner dc2cc67e57 remove a bogus assertion, add a comment.
llvm-svn: 126603
2011-02-28 01:06:02 +00:00
Chris Lattner 0709542628 make switch condition constant folding much more aggressive, handling
compound statements and break statements.  This implements enough to 
handle PR9322 and rdar://6970405.

llvm-svn: 126602
2011-02-28 01:02:29 +00:00
Chris Lattner 0725a8b653 First tiny step to implementing PR9322: build infrastructure for only emitting the
live case of a switch statement when switching on a constant.  This is terribly
limited, but enough to handle the trivial example included.  Before we would 
emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  switch i32 1, label %sw.epilog [
    i32 1, label %sw.bb
  ]

sw.bb:                                            ; preds = %entry
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  br label %sw.epilog

sw.epilog:                                        ; preds = %sw.bb, %entry
  switch i32 0, label %sw.epilog3 [
    i32 1, label %sw.bb1
  ]

sw.bb1:                                           ; preds = %sw.epilog
  %tmp2 = load i32* %i.addr, align 4
  %add = add nsw i32 %tmp2, 2
  store i32 %add, i32* %i.addr, align 4
  br label %sw.epilog3

sw.epilog3:                                       ; preds = %sw.bb1, %sw.epilog
  ret void
}

now we emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  ret void
}

This improves -O0 compile time (less IR to generate and shove through the code 
generator) and the clever linux kernel people found a way to fail to build if we 
don't do this optimization.  This step isn't enough to handle the kernel case
though.

llvm-svn: 126597
2011-02-28 00:22:07 +00:00
John McCall 53fcbd2718 Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that.  Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct;  fixes PR9307.

llvm-svn: 126540
2011-02-26 08:07:02 +00:00
Rafael Espindola eb4fd01f7a Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

llvm-svn: 126422
2011-02-24 20:31:44 +00:00
Anders Carlsson 4fc229ef69 Move some Objective-C tests to SemaObjC and CodeGenObjC.
llvm-svn: 126175
2011-02-22 01:23:29 +00:00
Chris Lattner 93ede02045 add one more case of mismatched input/output constraints.
When the mismatch is due to a larger input operand that is
a constant, truncate it down to the size of the output.  This
allows us to accept some cases in the linux kernel and elsewhere.
Pedantically speaking, we generate different code than GCC, though
I can't imagine how it would matter:

Clang:
	movb	$-1, %al
	frob %al

GCC:

	movl	$255, %eax
	frob %al

llvm-svn: 126148
2011-02-21 22:09:29 +00:00
Stuart Hastings b6a4d3ebd2 Test case for r126127 and r126141. Radar 9012638.
llvm-svn: 126142
2011-02-21 21:08:21 +00:00
Chris Lattner b0ed51da10 implement a tiny amount of codegen support for gnu array range
designators: allowing codegen when the element initializer is a
constant or something else without a side effect.  This unblocks
enough to let process.c in the linux kernel build, PR9257.

llvm-svn: 126056
2011-02-19 22:28:58 +00:00
John McCall 8377967543 Warn about code that uses variables and functions with internal linkage
without defining them.  This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition.  I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake.  Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.

llvm-svn: 126016
2011-02-19 02:53:41 +00:00
Devang Patel 1728c232d5 If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.
llvm-svn: 125672
2011-02-16 18:40:36 +00:00
Rafael Espindola d62acb569c Add a hack to avoid adding '\01' to asm names when possible. It would be
better for clang to always compute the right name, but for now this hack
fixes PR9177 and lets us build firefox with LTO :-)

llvm-svn: 125607
2011-02-15 22:23:51 +00:00
Peter Collingbourne e91b2dbdf1 OpenCL: standardise naming of test cases
llvm-svn: 125590
2011-02-15 19:46:41 +00:00
Roman Divacky 5bc5151299 Add a testcase for the mcount profiling.
llvm-svn: 125283
2011-02-10 16:52:35 +00:00
Daniel Dunbar 0bb0331d95 Driver/Frontend: Wire up -mregparm=.
llvm-svn: 125201
2011-02-09 17:54:19 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
Anton Yartsev 85129b8a86 pre/post ++/-- for AltiVec vectors. (with builtins-ppc-altivec.c failure fixed)
llvm-svn: 125000
2011-02-07 02:17:30 +00:00
Nick Lewycky fe719128e9 Fix test by fully specifying the platform.
llvm-svn: 124719
2011-02-02 07:17:02 +00:00
Douglas Gregor dbe3927026 Basic support for -mms-bitfields, from Carl Norum!
llvm-svn: 124661
2011-02-01 15:15:22 +00:00
Argyrios Kyrtzidis 0d349f9b8a When initializing struct members, the important thing is that the "initializing" expression is
compatible, not having the same type.

Fix rdar://8183908 in which compatible vector types weren't initialized properly leading to a crash.

llvm-svn: 124637
2011-02-01 00:52:10 +00:00
Eric Christopher 23ec82fa47 Revert r124146 for now. It appears to be failing on a few platforms.
llvm-svn: 124153
2011-01-24 23:07:03 +00:00
Anton Yartsev 3bad9afaba pre/post increase/decrease for AltiVec vectors
llvm-svn: 124146
2011-01-24 20:55:22 +00:00
John McCall 4e81961a1e Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.

llvm-svn: 123904
2011-01-20 07:57:12 +00:00
Douglas Gregor d763b3e014 Comment a wacky test case
llvm-svn: 123758
2011-01-18 18:38:18 +00:00
Rafael Espindola 2e217d6555 More unnamed_addr.
llvm-svn: 123681
2011-01-17 22:22:52 +00:00
Rafael Espindola e79d43da3b Add unnamed_addr to the special strings created by
__builtin___CFStringMakeConstantString
This fixes PR8993. A darwin expert might want to check that this is safe.

llvm-svn: 123658
2011-01-17 16:31:00 +00:00
John McCall 294c2db42b Ensure an insertion point at the end of a statement-expression.
Fixes PR8967.

llvm-svn: 123360
2011-01-13 02:03:06 +00:00
John McCall 20f6ab828a Fix a latent bug where, after emitting an expression statement, we would
delete the block we began emitting into if it had no predecessors.  We never
want to do this, because there are several valid cases during statement
emission where an existing block has no known predecessors but will acquire
some later.  The case in my test case doesn't inherently fall into this 
category, because we could safely emit the case-range code before the statement
body, but there are examples with labels that can't be fallen into 
that would also demonstrate this bug.

rdar://problem/8837067

llvm-svn: 123303
2011-01-12 03:41:02 +00:00
Rafael Espindola b7f60e3474 Add unnamed_addr when creating artificial string globals. For example, in
static const char foo[] = "foo";
static const char *bar = "bar";

the global created to hold "bar" will have it, but foo will not.

llvm-svn: 123192
2011-01-10 22:34:03 +00:00
Roman Divacky 7e96295fb5 Use -check-prefix to make it clear the test is SVR4/DARWINPPC specific.
llvm-svn: 123005
2011-01-07 19:01:39 +00:00
Roman Divacky 1b805a0bc9 Drop the _darwin/_svr4 suffixes.
llvm-svn: 123004
2011-01-07 19:00:05 +00:00
Roman Divacky 965b0b72b1 PowerPC fixes.
Fix the width and align of bool type on Darwin to be 32bits
while keeping it 8 everywhere else.

Change the definition of va_list to default to SV4 ABI one
and let darwin subtarget override this.

Both changes submitted by Nathan Whitehorn and reviewed
by Rafael Espindola.

llvm-svn: 122956
2011-01-06 08:27:10 +00:00
Rafael Espindola 47731fe3f1 Add support for passing variables declared to use a xmm register to asm
statements using the "x" constraint.

llvm-svn: 122679
2011-01-02 03:59:13 +00:00
Rafael Espindola c56f847a96 Add support for declaring register contraints in variables. They are only used
in asm statements:

register int foo asm("rdi");

asm("..." : ... "r" (foo) ...

We also only accept these variables if the constraint in the asm statement is "r".

This fixes most of PR3933.

llvm-svn: 122643
2010-12-30 22:59:32 +00:00
Chris Lattner ad3467ee89 The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.

llvm-svn: 122558
2010-12-25 23:25:43 +00:00
Dan Gohman f99dbb9e77 Generalize this test to work without instruction names.
llvm-svn: 121742
2010-12-14 01:33:14 +00:00
Dan Gohman c2897692c3 Implement CodeGen support for the may_alias attribute.
llvm-svn: 121734
2010-12-13 23:51:08 +00:00
Devang Patel 00afcbe366 Start using DIBuilder. It provides cleaner interface.
llvm-svn: 121302
2010-12-08 22:42:58 +00:00
Rafael Espindola 0017c5fa92 Fix PR8720 by printing an error message with a substring that the gcc testsuite searches for.
llvm-svn: 121137
2010-12-07 15:23:23 +00:00
John McCall 594827281c Silly special case: never load when dereferencing void*.
llvm-svn: 120905
2010-12-04 12:43:24 +00:00
John McCall ca61b6567b First pass at implementing the intent of ANSI C DR106.
llvm-svn: 120904
2010-12-04 12:29:11 +00:00
John McCall a6f59318c7 Fix this test case on no-asserts builds by not trying to match the basic
block line.

llvm-svn: 120893
2010-12-04 05:19:12 +00:00
John McCall 34376a68c4 Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ.  So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.

llvm-svn: 120890
2010-12-04 03:47:34 +00:00
Peter Collingbourne 0b69e1a628 Implement -cl-single-precision-constant
llvm-svn: 120877
2010-12-04 01:50:56 +00:00
Peter Collingbourne 31587c86c1 Implement -cl-opt-disable
llvm-svn: 120876
2010-12-04 01:50:45 +00:00
Fariborz Jahanian 50198098b9 IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).

llvm-svn: 120713
2010-12-02 17:02:11 +00:00
Chris Lattner 27a3631bac Improve codegen for initializer lists to use memset more aggressively
when an initializer is variable (I handled the constant case in a previous
patch).  This has three pieces:

1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that
   the memory being stored into has previously been memset to zero.
2. Teach CGExprAgg to not emit stores of zero to isZeroed memory.
3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine
   whether they are profitable to emit a memset + inividual stores vs
   stores for everything.

The heuristic used is that a global has to be more than 16 bytes and
has to be 3/4 zero to be candidate for this xform.  The two testcases
are illustrative of the scenarios this catches.  We now codegen test9 into:

 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false)
 %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0
 %tmp = load i32* %X.addr, align 4
 store i32 %tmp, i32* %.array

and test10 into:

  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false)
  %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0
  %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0
  %tmp2 = load i32* %X.addr, align 4
  store i32 %tmp2, i32* %tmp1, align 4
  %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3
  %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4
  %tmp11 = load i32* %X.addr, align 4
  store i32 %tmp11, i32* %tmp10, align 4

Previously we produced 99 stores of zero for test9 and also tons for test10.
This xforms should substantially speed up -O0 builds when it kicks in as well
as reducing code size and optimizer heartburn on insane cases.  This resolves
PR279.

llvm-svn: 120692
2010-12-02 07:07:26 +00:00
Eric Christopher 8a2ee390be Add support for the common and nocommon attributes.
rdar://8560647

llvm-svn: 120650
2010-12-02 02:45:55 +00:00
Eric Christopher c629a5c7d0 FileCheckize.
llvm-svn: 120648
2010-12-02 02:30:43 +00:00
Eric Christopher 690c2d1ed6 FileCheckize.
llvm-svn: 120647
2010-12-02 02:13:27 +00:00
Chris Lattner e6af88628f Enhance the init generation logic to emit a memset followed by a few stores when
a global is larger than 32 bytes and has fewer than 6 non-zero values in the
initializer.  Previously we'd turn something like this:

char test8(int X) {
  char str[10000] = "abc";

into a 10K global variable which we then memcpy'd from.  Now we generate:

  %str = alloca [10000 x i8], align 16
  %tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0
  call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false)
  store i8 97, i8* %tmp, align 16
  %0 = getelementptr [10000 x i8]* %str, i64 0, i64 1
  store i8 98, i8* %0, align 1
  %1 = getelementptr [10000 x i8]* %str, i64 0, i64 2
  store i8 99, i8* %1, align 2

Which is much smaller in space and also likely faster.

This is part of PR279

llvm-svn: 120645
2010-12-02 01:58:41 +00:00
Fariborz Jahanian 3a4ea9a76c Declaring local static in global block
literal declaration caused crash in CodeGen.
This patch fixes it. pr8707

llvm-svn: 120486
2010-11-30 23:07:14 +00:00
Nick Lewycky 5421621d2b Replace \r\n with \n. No functional change.
llvm-svn: 120379
2010-11-30 01:47:38 +00:00
Anders Carlsson 0c75b49dc1 Fix a (probably very old) regression where we weren't using the typedef name for anonymous tag types.
llvm-svn: 120113
2010-11-24 21:05:09 +00:00
John McCall 20c00e0e7b This test does not need to test the alignment of pointers. Make it pass
on 64-bit systems.

llvm-svn: 120014
2010-11-23 10:15:48 +00:00
Francois Pichet ce87a7e45c long => int to make the test pass on system where sizeof(long) = 64.
llvm-svn: 120005
2010-11-23 07:15:13 +00:00
Francois Pichet 0c71f6c5d3 Microsoft C anonymous struct implementation.
Documentation: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx

llvm-svn: 120000
2010-11-23 06:07:27 +00:00
Anton Yartsev 3f8f2886c1 comparison of AltiVec vectors now gives bool result (fix for 7533)
llvm-svn: 119678
2010-11-18 03:19:30 +00:00
Bob Wilson db04141f9a Re-enable test with modifications for Neon vector changes in clang.
I mistakenly thought that this was checking for vector name mangling, but
it is not.  Since we're no longer wrapping Neon vectors in structs, this
test can just return a vector directly.  There are already other tests for
that, so just to make this interesting, change the test to return a struct
of two vectors.

llvm-svn: 119434
2010-11-17 00:44:53 +00:00
Bob Wilson 849857445f Temporarily disable this check for Neon vector type mangling.
I'll reenable it soon when I'm done reworking <arm_neon.h>.

llvm-svn: 119366
2010-11-16 19:08:19 +00:00
Chandler Carruth b19289331d This really seems like a boring set of fixes to our tests to make them more
independent of the underlying system. Let me know if any of these are too
aggressive.

llvm-svn: 119345
2010-11-16 10:26:08 +00:00
John McCall 07bb19667a Simplify some complex emission and implement correct semantics for
assignment to volatiles in C.  This in effect reverts some of mjs's
work in and around r72572.  Basically, the C++ standard is quite
clear, except that it lies about volatile behavior approximating
C's, whereas the C standard is almost actively misleading.

llvm-svn: 119344
2010-11-16 10:08:07 +00:00
Fariborz Jahanian c961119dcd Restore these tests. I think I fixed the problem.
We shall see.

llvm-svn: 119158
2010-11-15 17:06:17 +00:00
John McCall 83fe49d1e1 Always emit full loads from volatile complex l-values.
Return the result of a complex assignment with the original values,
not by performing a load from the l-value;  this is the correct
semantics in C, although not in C++.

llvm-svn: 119037
2010-11-14 09:40:28 +00:00
Fariborz Jahanian 9b4dc09746 Removing these test till redo them so they won't depend
on the built compiler.

llvm-svn: 119013
2010-11-13 23:04:46 +00:00
Argyrios Kyrtzidis 8b4cf00cdc Fix the test for Release.
llvm-svn: 118483
2010-11-09 03:43:49 +00:00
Argyrios Kyrtzidis 8909686b22 Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
Fixes rdar://8644873 & http://llvm.org/PR8567.

llvm-svn: 118468
2010-11-09 01:30:48 +00:00
John McCall 2faab302e0 ARM EH uses a different personality function in C.
llvm-svn: 118366
2010-11-07 02:35:25 +00:00
John Thompson 6c2afc8d5d Tests for inline asm constraints, generic and x86.
llvm-svn: 118108
2010-11-02 23:03:52 +00:00
John McCall 23032653d7 Unbreak private_extern, which apparently we had zero tests for.
llvm-svn: 118034
2010-11-02 18:38:13 +00:00
John McCall 565141612f When emitting l-values for bool non-__block decl references, make a pointer
using the memory type;  fixes an assert.

Fixes rdar://problem/8605032

llvm-svn: 117610
2010-10-28 21:37:57 +00:00
John McCall b7139c43ae When computing visibility, use the latest declaration's explicit visibility
attribute.

Part of rdar://problem/8595231

llvm-svn: 117526
2010-10-28 04:18:25 +00:00
John McCall 3a7f6926d1 Restore r117403 (fixing IR gen for bool atomics), this time being less
aggressive about the form we expect bools to be in.  I don't really have
time to fix all the sources right now.

llvm-svn: 117486
2010-10-27 20:58:56 +00:00
Rafael Espindola 9d798a07e4 Revert r117403 as it caused PR8480.
llvm-svn: 117456
2010-10-27 17:13:49 +00:00
John McCall 6bde954f47 Extract procedures to do scalar-to-memory and memory-to-scalar conversions
in IR gen, and use those to fix a correctness issue with bool atomic
intrinsics.  rdar://problem/8461234

llvm-svn: 117403
2010-10-26 22:09:15 +00:00
John McCall 5fe84129e2 A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden
  - functions and variables with explicit visibility attributes should
    ignore the linkage of their types
Either of these should be sufficient to fix PR8457.

Also, FileCheck-ize a test case.

llvm-svn: 117351
2010-10-26 04:59:26 +00:00
Peter Collingbourne a99fdcf93e Implement GNU C extension: two types are compatible if they appear
as a function argument, one of the types is a transparent union type
and the other type is compatible with a union member

llvm-svn: 117243
2010-10-24 18:30:18 +00:00
Bill Wendling 67c5621742 Linux still needs these hacks.
llvm-svn: 116888
2010-10-20 00:12:59 +00:00
Bill Wendling 2bb7c59356 Now that mm_malloc.h was rewritten to *not* include errno.h (see
http://llvm.org/viewvc/llvm-project?rev=116771&view=rev) we can get rid of these
hacks.

llvm-svn: 116853
2010-10-19 20:08:12 +00:00
Michael J. Spencer 8d3f5db7e5 test: FileCheck'ize and document test.
llvm-svn: 116799
2010-10-19 06:39:49 +00:00
Bill Wendling 5cd41c4b13 Reapply r116684 with fixes. The test cases needed to be updated.
llvm-svn: 116696
2010-10-18 03:41:31 +00:00
Anton Yartsev 73d4023114 support for AltiVec extensions from the Cell architecture
llvm-svn: 116478
2010-10-14 14:37:46 +00:00
Chris Lattner 001b29ccc1 Allow a string literal to initialize a tail array (PR8217), patch
by Pierre Habouzit!

llvm-svn: 116165
2010-10-10 17:49:49 +00:00
Argyrios Kyrtzidis 073c9cb592 Implement __builtin_ia32_vec_ext_v2si function (required by Qt).
llvm-svn: 116162
2010-10-10 03:19:11 +00:00
Nico Weber a6bde81bc8 Add support for UCNs for character literals
llvm-svn: 116129
2010-10-09 00:27:47 +00:00
Douglas Gregor 559c9fb134 This patch fixes multiple issues in clang's designated init builder and
completes support for C1X anonymous struct/union init features:

 * Indexed anonymous member initializers should not be expanded. Doing so makes
little sense and would cause unresolvable semantic ambiguity in valid code
(regression introduced by r69153).

 * Subobject initialization of (possibly nested) anonymous members are now
referred to with paths relative to the naming record context, eliminating the
synthesis of incorrect implicit InitListExprs that caused CodeGen to assert.

 * Field lookup was missing a null check in IdentifierInfo comparison which
caused lookup for a known (already resolved) field to match the first unnamed
data member it encountered leading to silent miscompilation.

 * Subobject paths are no longer built using the general purpose
Sema::BuildAnonymousStructUnionMemberPath(). If any corner cases crop up, we
will now assert earlier in Sema instead of passing invalid InitListExprs
through to CodeGen.

Fixes PR6955, from Alp Toker!

llvm-svn: 116098
2010-10-08 20:44:28 +00:00
Daniel Dunbar 29b8fb1771 tests: Force a triple to avoid wchar_t differences.
llvm-svn: 115970
2010-10-07 20:16:00 +00:00
Nico Weber 9762e0a234 Add support for 4-byte UCNs like \U12345678. Warn about UCNs in c90 mode.
llvm-svn: 115743
2010-10-06 04:57:26 +00:00
Bill Wendling 964f521e85 Erm...this isn't the same as PR6658.
llvm-svn: 115737
2010-10-06 03:33:37 +00:00
Bill Wendling 6153d2c7bd MMX conversion work is done. We can remove the FIXMEs.
llvm-svn: 115736
2010-10-06 03:31:26 +00:00
Bill Wendling 8700d39139 Add same hack to mmx-builtins.c as in Headers/c89.c to get it to pass on Win32. PR6658.
llvm-svn: 115735
2010-10-06 03:31:09 +00:00
Bill Wendling a76cdeb783 Do x86_64.
llvm-svn: 115460
2010-10-03 08:34:05 +00:00
Bill Wendling 4a58223401 Test to verify that all of the MMX builtins are handled by the front-end.
llvm-svn: 115459
2010-10-03 03:39:54 +00:00
Dale Johannesen 39d6f4b95c Clang part of MMX rewrite (goes with 115243).
llvm-svn: 115244
2010-09-30 23:57:50 +00:00
Daniel Dunbar 8caf6415a8 Add support for attribute((naked)), patch by Zoxc on cfe-commits!
- Minor style tweaks by me.

llvm-svn: 115056
2010-09-29 18:20:25 +00:00
Fariborz Jahanian 1db5c941ad vla expressions used in __typeof__ must be evaluated.
Fixes rdar://8476159.

llvm-svn: 114982
2010-09-28 20:42:35 +00:00
Fariborz Jahanian 8fb87aec78 Patch implements passing arrays to functions expecting
vla. Implements pr7827.

llvm-svn: 114737
2010-09-24 17:30:16 +00:00
Argyrios Kyrtzidis 719a46bbf1 Don't crash on _Imaginary.
llvm-svn: 114637
2010-09-23 09:40:31 +00:00
Daniel Dunbar 1fae17a8e5 Tweak test to pass -ffreestanding, to avoid platform dependent header issues.
llvm-svn: 114627
2010-09-23 04:40:10 +00:00
Daniel Dunbar 19964dbe3b IRgen/ABI/ARM: Return large vectors in memory.
llvm-svn: 114619
2010-09-23 01:54:32 +00:00
Daniel Dunbar b34b08098c IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
   directly. This makes a huge difference in the cleanliness of the IR after
   optimization.
 - I will trust, but verify, via future ABITest testing (for APCS-GNU, at
   least).

llvm-svn: 114618
2010-09-23 01:54:28 +00:00
Devang Patel f063cb49d8 Testcase for r114585.
llvm-svn: 114586
2010-09-22 21:13:48 +00:00
Chris Lattner b2f659b7a0 fix the rest of rdar://8461279 - clang miscompiles address-space qualified atomics
llvm-svn: 114503
2010-09-21 23:40:48 +00:00
Chris Lattner c9066d3072 same bug as before, this time with __sync_val_compare_and_swap.
llvm-svn: 114502
2010-09-21 23:35:30 +00:00
Chris Lattner 7cf46bfda0 fix __sync_bool_compare_and_swap to work with address-space qualified types.
llvm-svn: 114498
2010-09-21 23:24:52 +00:00
Chris Lattner 65dce5eeee filecheckize.
llvm-svn: 114497
2010-09-21 23:22:41 +00:00
Fariborz Jahanian 521c72c756 Fixes an IRgen ICE due to cast of null pointer to
a vla type (fixes pr7827).

llvm-svn: 114495
2010-09-21 22:53:33 +00:00
Fariborz Jahanian 8162d4ad31 Implements in IRgen gnu extensions missing LHS for
complex conditionals. Radar 8453812.

llvm-svn: 114376
2010-09-20 23:50:22 +00:00
Fariborz Jahanian 2b1d88abfb Problem with gnu conditional extension with missing
LHS and when conditional expression is an array. Since
it will be decayed, saved expression must be saved with
decayed expression. This is necessary to preserve semantics
of this extension (and prevent an IRGen crash which expects
an array to always be decayed). I am sure there will be other
cases in c++ (aggregate conditionals for example) when saving of the 
expression must happen after some transformation on conditional
expression has happened. 
Doug, please review.  Fixes // rdar://8446940

llvm-svn: 114296
2010-09-18 19:38:38 +00:00
John Thompson 1224061281 Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
llvm-svn: 114253
2010-09-18 01:15:13 +00:00
Bill Wendling cbacefd36f Testcase for r114239.
llvm-svn: 114247
2010-09-18 00:26:29 +00:00
Daniel Dunbar 60785eb0f2 Sema/transparent_union: Make sure to add implicit cast when constructing
implicit union values for the transparent_union extension.

llvm-svn: 114236
2010-09-17 23:21:43 +00:00
David Chisnall dd84ef1e62 Add a -ftrapv-handler= option which allows a handler to invoke instead of simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit.
llvm-svn: 114192
2010-09-17 18:29:54 +00:00