Commit Graph

2898 Commits

Author SHA1 Message Date
Nico Weber 6bdd9b0608 Reland __leave tests (r230717 and r230720, reverted in r230740).
The only change is that line 266 changed from
    // CHECK:  br label %[[except]]
to
    // CHECK:  br label %[[except:[^ ]*]]

llvm-svn: 230764
2015-02-27 16:40:43 +00:00
Daniel Jasper 7fe82ad80b Revert r230717 (and subsequent r230720).
The tests keeps failing on build bots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2355/testReport/junit/Clang/CodeGen/exceptions_seh_leave_c/

llvm-svn: 230740
2015-02-27 08:16:32 +00:00
Craig Topper b1bc5cf4bc [X86] Remove pblendw and pblendd builtins that aren't being used by the intrinsic headers.
llvm-svn: 230738
2015-02-27 06:54:25 +00:00
Alexey Bataev b832926176 [OPENMP] Codegen for "#pragma omp atomic write"
For global reg lvalue - use regular store through global register.
For simple lvalue - use simple atomic store.
For bitfields, vector element, extended vector elements - the original value of the whole storage (for vector elements) or of some aligned value (for bitfields) is atomically read, the part of this value for the given lvalue is modified and then use atomic compare-and-exchange operation to try to atomically write modified value (if it was not modified).
Also, changes in this patch fix the bug for '#pragma omp atomic read' applied to extended vector elements.
Differential Revision: http://reviews.llvm.org/D7369

llvm-svn: 230736
2015-02-27 06:33:30 +00:00
Nico Weber 5339a52c9a Add last missing __leave test.
llvm-svn: 230720
2015-02-27 02:26:14 +00:00
Nico Weber 497bf5587e Add another __leave test.
llvm-svn: 230717
2015-02-27 01:58:08 +00:00
Nico Weber ff62a6a0b7 Don't crash on leaving nested __finally blocks through an EH edge.
The __finally emission block tries to be clever by removing unused continuation
edges if there's an unconditional jump out of the __finally block. With
exception edges, the EH continuation edge isn't always unused though and we'd
crash in a few places.

Just don't be clever. That makes the IR for __finally blocks a bit longer in
some cases (hence small and behavior-preserving changes to existing tests), but
it makes no difference in general and it fixes the last crash from PR22553.

http://reviews.llvm.org/D7918

llvm-svn: 230697
2015-02-26 22:34:33 +00:00
Petar Jovanovic d55ae6ba37 Add support for generating MIPS legacy NaN
Currently, the NaN values emitted for MIPS architectures do not cover
non-IEEE754-2008 compliant case. This change fixes the issue.

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D7882

llvm-svn: 230653
2015-02-26 18:19:22 +00:00
Craig Topper ac0d58bc4c [X86] Remove the blendps/blendpd builtins. They aren't used by the intrinsic headers. We use appropriate shuffle vector instead.
llvm-svn: 230616
2015-02-26 08:09:05 +00:00
Nico Weber d9b8bd6b86 Make __leave test pass in -Asserts builds.
llvm-svn: 230514
2015-02-25 17:44:04 +00:00
Nico Weber e68b9f3e0a Reland r230460 with a test fix for -Asserts builds.
Original CL description:
Produce less broken basic block sequences for __finally blocks.

The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

llvm-svn: 230503
2015-02-25 16:25:00 +00:00
Daniel Jasper cd94c40b10 Revert "Produce less broken basic block sequences for __finally blocks."
The test is broken on buildbots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2279/

This reverts commit adda738b6dc533c42db5f5f5b31344098a3aba7d.

llvm-svn: 230472
2015-02-25 10:07:14 +00:00
Nico Weber 795bd2d411 Produce less broken basic block sequences for __finally blocks.
The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

llvm-svn: 230460
2015-02-25 04:05:18 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Tim Northover bc784d1caa ARM: Simplify PCS handling.
The backend should now be able to handle all AAPCS rules based on argument
type, which means Clang no longer has to duplicate the register-counting logic
and the CodeGen can be significantly simplified.

llvm-svn: 230349
2015-02-24 17:22:40 +00:00
Michael Kuperstein 4f818708a8 [WinX86_64 ABI] Treat C99 _Complex as a struct
MSVC does not support C99 _Complex.
ICC, however, does support it on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). 

Differential Revision: http://reviews.llvm.org/D7825

llvm-svn: 230315
2015-02-24 09:35:58 +00:00
Joerg Sonnenberger 096feeb741 Only lower __builtin_setjmp / __builtin_longjmp to
llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to
support them outside the Exception Handling context. The default
handling in LLVM codegen doesn't work and will create incorrect code.
The ARM backend on the other hand will assert if the intrinsics are
used.

llvm-svn: 230255
2015-02-23 20:23:47 +00:00
Rafael Espindola 6b07a1c6ee Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.

The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.

llvm-svn: 230031
2015-02-20 18:08:57 +00:00
Filipe Cabecinhas 54a2ba8b76 [Headers] Add tests for _mm256_insert_epi64 and fix its definition
Summary:
The definition for _mm256_insert_epi64 was taking an int, which would get
truncated before being inserted in the vector.

Original patch by Joshua Magee!

Reviewers: bruno, craig.topper

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7179

llvm-svn: 229811
2015-02-19 03:02:33 +00:00
Daniel Sanders 933f0a04d3 Fix test/CodeGen/atomic_ops.c failure on clang-cmake-mips builder (and others).
Not all targets generate 'store atomic' instructions for
'_Atomic(_Complex int)'. Some targets use the __atomic_store builtin instead. 

This commit makes the test accept either one.

llvm-svn: 229676
2015-02-18 15:08:37 +00:00
David Majnemer 5927e7b681 CodeGen: Relax a FileCheck line for SystemZ
llvm-svn: 229617
2015-02-18 02:28:15 +00:00
Manuel Klimek fa27b8861b Make tests independent of llvm variable naming.
llvm-svn: 229484
2015-02-17 09:49:31 +00:00
Craig Topper 96f9a573b5 [X86] Convert palignr builtin handling to use shuffle form of right shift instead of intrinsics. This should allow the instrinsics to removed from the backend.
llvm-svn: 229474
2015-02-17 07:18:01 +00:00
Craig Topper 480e2b6e43 [X86] Merge the 2 separate builtin handlers for PALIGNR into a single one that handles both.
llvm-svn: 229469
2015-02-17 06:37:58 +00:00
Sanjay Patel eb2af4e8b1 x86-64 ABI: unwrap single element structs / arrays of 256-bit vectors to pass and return in registers
This is a patch for PR22563 ( http://llvm.org/bugs/show_bug.cgi?id=22563 ).

We were not correctly unwrapping a single 256-bit AVX vector that was defined as an array of 1 inside a struct.

We would generate a <4 x float> param/return value instead of <8 x float> and lose half of the vector.

Differential Revision: http://reviews.llvm.org/D7614

llvm-svn: 229408
2015-02-16 17:26:51 +00:00
Michael Kuperstein f0e4ccffc5 Fix quoting of #pragma comment for MS compat, clang part.
For #pragma comment(linker, ...) MSVC expects the comment string to be quoted, but for #pragma comment(lib, ...) the compiler itself quotes the library name.
Since this distinction disappears by the time the directive reaches the backend, move quoting for the "lib" version to the frontend.

Differential Revision: http://reviews.llvm.org/D7653

llvm-svn: 229376
2015-02-16 11:57:43 +00:00
Craig Topper 370644f66e [X86] Teach clang to lower __builtin_ia32_psrldqi256 and __builtin_ia32_pslldqi256 to vector shuffles the backend recognizes. This is a step towards removing the corresponding intrinsics from the backend.
llvm-svn: 229348
2015-02-16 00:42:49 +00:00
David Blaikie 3e7149d2ec Remove trailing whitespace to make test compatible with typeless pointer migration
llvm-svn: 229274
2015-02-15 04:12:22 +00:00
David Majnemer ce27e42d47 CodeGen: _Atomic(_Complex) shouldn't crash
We could be a little kinder if we did a compare-exchange loop instead of
an atomic-load/store pair.

llvm-svn: 229212
2015-02-14 01:48:17 +00:00
David Majnemer a5b195a1dc Revert "Revert r229082 for a bit, it caused PR22577."
This reverts commit r229123.  It was a red herring, the bug was present
without r229082.

llvm-svn: 229205
2015-02-14 01:35:12 +00:00
David Majnemer 6866a3c6f4 CodeGen: Correctly convert atomic bool from i8 to i1
Bools are a little tricky, they are i8 in memory and must be coerced
back to i1 before further operations can be performed on them.

This fixes PR22577.

llvm-svn: 229204
2015-02-14 01:35:07 +00:00
David Blaikie 4260780552 Update test case to be compatible with auto-migration to new getelementptr syntax coming in the near future
The first change won't touch GEPOperators such as these, but the update
script only identifies them by the leading '(' after getelementptr or
'getelementptr inbounds', so update this test to at least have those
features to allow auto-migrating.

llvm-svn: 229198
2015-02-14 00:41:07 +00:00
David Blaikie f5f3253da0 Adjust test case to be compatible with future changes to explicitly pass the type to getelementptr
llvm-svn: 229196
2015-02-14 00:26:13 +00:00
Nico Weber 7ce96b853d Revert r229082 for a bit, it caused PR22577.
llvm-svn: 229123
2015-02-13 16:27:00 +00:00
David Majnemer abc482effc MS ABI: Implement /volatile:ms
The /volatile:ms semantics turn volatile loads and stores into atomic
acquire and release operations.  This distinction is important because
volatile memory operations do not form a happens-before relationship
with non-atomic memory.  This means that a volatile store is not
sufficient for implementing a mutex unlock routine.

Differential Revision: http://reviews.llvm.org/D7580

llvm-svn: 229082
2015-02-13 07:55:47 +00:00
Craig Topper 4fb4581716 [X86] Fix test cases that I foolishly copied and modified from another file that had optimizations on. This caused the check patterns to not quite match.
llvm-svn: 229073
2015-02-13 06:27:39 +00:00
Craig Topper a462482d98 [X86] Add _mm_bslli_si128 and _mm_bsrli_si128 as aliases of _mm_slli_si128 and _mm_srli_si128. This matches Intel documentation and gcc.
llvm-svn: 229066
2015-02-13 06:04:45 +00:00
NAKAMURA Takumi ed9b9f8e01 Mark clang/test/CodeGen/exceptions-seh-leave.c as REQUIRES:asserts, for now.
FIXME: Rewrite CHECKs for unnamed BBs and Insts.
llvm-svn: 228990
2015-02-13 00:24:21 +00:00
Nico Weber 5779f84000 [ms] Implement codegen for __leave.
Reviewed at http://reviews.llvm.org/D7575

llvm-svn: 228977
2015-02-12 23:16:11 +00:00
Steven Wu 15b385f854 Add InlineAsmDiagnosticHandler for bitcode input
Summary:
This patch installs an InlineAsmDiagnosticsHandler to avoid the crash
report when the input is bitcode and the bitcode contains invalid inline
assembly. The handler will simply print the same error message that will
print from the backend.

Add CHECK in test-case

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, cfe-commits

Differential Revision: http://reviews.llvm.org/D7568

llvm-svn: 228898
2015-02-12 02:06:55 +00:00
Reid Kleckner a593000f01 Add the 'noinline' attribute to call sites within __try bodies
LLVM doesn't support non-call exceptions, so inlining makes it harder to
catch such asynchronous exceptions.

llvm-svn: 228876
2015-02-11 21:40:48 +00:00
Adrian Prantl 5f66bae411 Fix PR19351. While building up a composite type it is important to use
a non-uniqueable temporary node that is only turned into a permanent
unique or distinct node after it is finished.
Otherwise an intermediate node may get accidentally uniqued with another
node as illustrated by the testcase.

Paired commit with LLVM.

llvm-svn: 228855
2015-02-11 17:45:15 +00:00
Filipe Cabecinhas 2177fc1732 Make the byte-shift SSE intrinsics emit vector shuffles which we know the backend can handle.
Also removed unused builtins.

Original patch by Andrea Di Biagio!

Reviewers: craig.topper, nadav

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7199

llvm-svn: 228481
2015-02-07 01:37:09 +00:00
Eric Christopher f5d9977600 Make this test a little less specific by removing the argument that
could change.

llvm-svn: 228438
2015-02-06 20:53:40 +00:00
Eric Christopher 79f5e4ede5 Inline asm IR input register constraints don't have early clobber
modifiers on them. If we have a matching output constraint with
an early clobber make sure we don't propagate that to the input
constraint.

llvm-svn: 228422
2015-02-06 18:44:18 +00:00
Reid Kleckner deeddeced3 Re-land r228258 and make clang-cl's /EHs- disable -fexceptions again
After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready
to deal with, even when exceptions were disabled with /EHs-. This time,
make /EHs- turn off -fexceptions while still emitting exceptional
constructs in functions using __try.  Since Sema rejects C++ exception
handling constructs before CodeGen, landingpads should only appear in
such functions as the result of a __try.

llvm-svn: 228329
2015-02-05 18:56:03 +00:00
Reid Kleckner 16f9a6b43d Fix crash on finally blocks that don't fall through
llvm-svn: 228243
2015-02-05 00:58:46 +00:00
Reid Kleckner aca01db706 Implement IRGen for SEH __finally and AbnormalTermination
Previously we would simply double-emit the body of the __finally block,
but that doesn't work when it contains any kind of Decl, which we can't
double emit.

This fixes that by emitting the block once and branching into a shared
code region and then branching back out.

llvm-svn: 228222
2015-02-04 22:37:07 +00:00
Daniel Sanders aa748a8db5 Preserve early clobber flag when using named registers in inline assembly.
Summary:
Named registers with the constraint "=&r" currently lose the early clobber flag
and turn into "=r" when converted to LLVM-IR. This patch correctly passes it on.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7346

llvm-svn: 228143
2015-02-04 14:25:47 +00:00