summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [mips] Add test case to check ABI flag emissions in case of inline assemblerSimon Atanasyan2015-09-141-0/+12
| | | | | | Follow up to r247546. The test case reproduces the problem fixed by this commit. llvm-svn: 247548
* Always_inline codegen rewrite.Evgeniy Stepanov2015-09-126-12/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation may end up emitting an undefined reference for an "inline __attribute__((always_inline))" function by generating an "available_externally alwaysinline" IR function for it and then failing to inline all the calls. This happens when a call to such function is in dead code. As the inliner is an SCC pass, it does not process dead code. Libc++ relies on the compiler never emitting such undefined reference. With this patch, we emit a pair of 1. internal alwaysinline definition (called F.alwaysinline) 2a. A stub F() { musttail call F.alwaysinline } -- or, depending on the linkage -- 2b. A declaration of F. The frontend ensures that F.inlinefunction is only used for direct calls, and the stub is used for everything else (taking the address of the function, really). Declaration (2b) is emitted in the case when "inline" is meant for inlining only (like __gnu_inline__ and some other cases). This approach, among other nice properties, ensures that alwaysinline functions are always internal, making it impossible for a direct call to such function to produce an undefined symbol reference. This patch is based on ideas by Chandler Carruth and Richard Smith. llvm-svn: 247494
* Revert "Specify target triple in alwaysinline tests."Evgeniy Stepanov2015-09-116-162/+12
| | | | | | | | | Revert "Always_inline codegen rewrite." Breaks gdb & lldb tests. Breaks on Fedora 22 x86_64. llvm-svn: 247491
* Specify target triple in alwaysinline tests.Evgeniy Stepanov2015-09-111-2/+2
| | | | | | This should fix the tests on Windows (failing due to mangling differencies). llvm-svn: 247473
* Always_inline codegen rewrite.Evgeniy Stepanov2015-09-116-12/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation may end up emitting an undefined reference for an "inline __attribute__((always_inline))" function by generating an "available_externally alwaysinline" IR function for it and then failing to inline all the calls. This happens when a call to such function is in dead code. As the inliner is an SCC pass, it does not process dead code. Libc++ relies on the compiler never emitting such undefined reference. With this patch, we emit a pair of 1. internal alwaysinline definition (called F.alwaysinline) 2a. A stub F() { musttail call F.alwaysinline } -- or, depending on the linkage -- 2b. A declaration of F. The frontend ensures that F.inlinefunction is only used for direct calls, and the stub is used for everything else (taking the address of the function, really). Declaration (2b) is emitted in the case when "inline" is meant for inlining only (like __gnu_inline__ and some other cases). This approach, among other nice properties, ensures that alwaysinline functions are always internal, making it impossible for a direct call to such function to produce an undefined symbol reference. This patch is based on ideas by Chandler Carruth and Richard Smith. llvm-svn: 247465
* Record function attribute "stackrealign" instead of using backend optionAkira Hatanaka2015-09-111-0/+8
| | | | | | | | | | | | -force-align-stack. Also, make changes to the driver so that -mno-stack-realign is no longer an option exposed to the end-user that disallows stack realignment in the backend. Differential Revision: http://reviews.llvm.org/D11815 llvm-svn: 247451
* Update test expectations for LLVM asm printing changeReid Kleckner2015-09-111-4/+7
| | | | llvm-svn: 247434
* [SEH] Port __try / __leave test to new IRReid Kleckner2015-09-111-0/+347
| | | | | | | It turns out that the IR we already generate for __leave is fine, so no code changes were needed. llvm-svn: 247424
* [opaque pointer type] update test cases for explicit pointee types on global ↵David Blaikie2015-09-114-22/+22
| | | | | | aliases llvm-svn: 247380
* [SEH] Use cleanupendpad so that WinEHPrepare gets the coloring rightReid Kleckner2015-09-101-1/+5
| | | | | | | Cleanupendpad is a lot like catchendpad, so we can reuse the same EHScopeStack type. llvm-svn: 247349
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Piotr Padlewski2015-09-101-1/+1
| | | | | | | | It seems that there is small bug, and we can't generate assume loads when some virtual functions have internal visibiliy This reverts commit 982bb7d966947812d216489b3c519c9825cacbf2. llvm-svn: 247332
* [SEH] Use catchret in the new EH IR like we do for C++Reid Kleckner2015-09-102-1/+252
| | | | | | Also add tests for SEH with the new IRGen. llvm-svn: 247318
* CFI: Introduce -fsanitize=cfi-icall flag.Peter Collingbourne2015-09-101-0/+20
| | | | | | | | | | This flag causes the compiler to emit bit set entries for functions as well as runtime bitset checks at indirect call sites. Depends on the new function bitset mechanism. Differential Revision: http://reviews.llvm.org/D11857 llvm-svn: 247238
* Don't crash when emitting a block under returns_nonnull.John McCall2015-09-101-0/+13
| | | | | | rdar://22071955 llvm-svn: 247228
* convert builtin_unpredictable on a switch into metadata for LLVMSanjay Patel2015-09-091-3/+11
| | | | llvm-svn: 247203
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-09-091-1/+1
| | | | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. After this patch got reverted because of ScalarEvolution bug (D12719) Merged after John McCall big patch (Added Address). http://reviews.llvm.org/D11859 llvm-svn: 247199
* [ARM] "cortex-r5f" and "cortex-m4f" are unknown names for clang.Alexandros Lamprineas2015-09-091-7/+2
| | | | | | | | | | | | The tests in test/CodeGen/arm-target-features.c are currently passing but warning messages are suppressed. These tests are now synchronized with the corresponding changes in Target Parser. This patch will fix the regressions in clang caused by r247136 Differential Revision: http://reviews.llvm.org/D12722 llvm-svn: 247138
* Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.Michael Zolotukhin2015-09-081-0/+48
| | | | | | | | | | | | | Summary: Currently clang provides no general way to generate nontemporal loads/stores. There are some architecture specific builtins for doing so (e.g. in x86), but there is no way to generate non-temporal store on, e.g. AArch64. This patch adds generic builtins which are expanded to a simple store with '!nontemporal' attribute in IR. Differential Revision: http://reviews.llvm.org/D12313 llvm-svn: 247104
* Collect SEH captures in a set instead of a vector to avoidJohn McCall2015-09-081-0/+30
| | | | | | | | doing redundant work if a variable is used multiple times. Fixes PR24751. llvm-svn: 247075
* clang/test/CodeGen/complex-convert.c: Appease for targeting powerpc64-*.NAKAMURA Takumi2015-09-081-0/+2
| | | | llvm-svn: 247015
* findDominatingStoreToReturn in CGCall.cpp didn't check if a candidate storeJakub Kuderski2015-09-081-0/+17
| | | | | | | | | | | | | | instruction used the ReturnValue as pointer operand or value operand. This led to wrong code gen - in later stages (load-store elision code) the found store and its operand would be erased, causing ReturnValue to become a <badref>. The patch adds a check that makes sure that ReturnValue is a pointer operand of store instruction. Regression test is also added. This fixes PR24386. Differential Revision: http://reviews.llvm.org/D12400 llvm-svn: 247003
* Fix clang/test/CodeGen/mips-varargs.c for -Asserts, possibly typo.NAKAMURA Takumi2015-09-081-1/+1
| | | | llvm-svn: 246994
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-0828-623/+551
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. llvm-svn: 246985
* [X86][SSE4A] Added SSE4A IR + assembly codegen builtin testsSimon Pilgrim2015-09-071-14/+25
| | | | llvm-svn: 246974
* [X86][SSSE3] Added SSSE3 IR + assembly codegen builtin testsSimon Pilgrim2015-09-062-10/+127
| | | | | | Transferred SSSE3 instructions from sse-builtins.c llvm-svn: 246948
* [X86]][SSE3] Added SSE41 IR + assembly codegen builtin testsSimon Pilgrim2015-09-062-162/+433
| | | | | | Transferred SSE41 instructions from sse-builtins.c llvm-svn: 246947
* Refactoring of how ARMTargetInfo handles default target features.Alexandros Lamprineas2015-09-061-2/+25
| | | | | | Differential Revision: http://reviews.llvm.org/D11299 llvm-svn: 246946
* [X86]][SSE3] Added SSE3 IR + assembly codegen builtin testsSimon Pilgrim2015-09-061-0/+85
| | | | llvm-svn: 246945
* [X86]][SSE42] Added SSE42 IR + assembly codegen builtin testsSimon Pilgrim2015-09-061-0/+141
| | | | llvm-svn: 246944
* Fix a bug in __builtin_object_size cast removalGeorge Burgess IV2015-09-041-0/+30
| | | | | | | | | | | Apparently there are many cast kinds that may cause implicit pointer arithmetic to happen. In light of this, the cast ignoring logic introduced in r246877 has been changed to only ignore a small set of cast kinds, and a test for this behavior has been added. Thanks to Richard for catching this before it became a bug report. :) llvm-svn: 246890
* Increase accuracy of __builtin_object_size.George Burgess IV2015-09-041-4/+115
| | | | | | | | | | | | | | | | | | | Improvements: - For all types, we would give up in a case such as: __builtin_object_size((char*)&foo, N); even if we could provide an answer to __builtin_object_size(&foo, N); We now provide the same answer for both of the above examples in all cases. - For type=1|3, we now support subobjects with unknown bases, as long as the designator is valid. Thanks to Richard Smith for the review + design planning. Review: http://reviews.llvm.org/D12169 llvm-svn: 246877
* [X86-64] Allow additional register names in inline assembler.Alexey Bataev2015-09-041-0/+53
| | | | | | | Patch allows to recognize additional registers x8d, x8b, x8w - x15d, x15b, x15w in inline assembler, already recognized by backend Differential Revision: http://reviews.llvm.org/D12594 llvm-svn: 246835
* [WebAssembly] Initial WebAssembly support in clangDan Gohman2015-09-035-0/+128
| | | | | | | | | | This implements basic support for compiling (though not yet assembling or linking) for a WebAssembly target. Note that ABI details are not yet finalized, and may change. Differential Revision: http://reviews.llvm.org/D12002 llvm-svn: 246814
* [ARM] Allow passing/returning of __fp16 argumentsOliver Stannard2015-09-031-0/+21
| | | | | | | | | | | | | | | | | | | | | The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be used as a functon argument or return type (ACLE 1.1 did not). The current public release of the AAPCS (2.09) states that __fp16 values should be converted to single-precision before being passed or returned, but AAPCS 2.10 (to be released shortly) changes this, so that they are passed in the least-significant 16 bits of either a GPR (for base AAPCS) or a single-precision register (for AAPCS-VFP). This does not change how arguments are passed if they get passed on the stack. This patch brings clang up to compliance with the latest versions of both of these specs. We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support the alternative format). llvm-svn: 246764
* Revert 246755 as it breaks buildbotsOliver Stannard2015-09-031-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | Original commit message: [ARM] Allow passing/returning of __fp16 arguments The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be used as a functon argument or return type (ACLE 1.1 did not). The current public release of the AAPCS (2.09) states that __fp16 values should be converted to single-precision before being passed or returned, but AAPCS 2.10 (to be released shortly) changes this, so that they are passed in the least-significant 16 bits of either a GPR (for base AAPCS) or a single-precision register (for AAPCS-VFP). This does not change how arguments are passed if they get passed on the stack. This patch brings clang up to compliance with the latest versions of both of these specs. We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support the alternative format). llvm-svn: 246760
* [ARM] Allow passing/returning of __fp16 argumentsOliver Stannard2015-09-031-0/+21
| | | | | | | | | | | | | | | | | | | | | The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be used as a functon argument or return type (ACLE 1.1 did not). The current public release of the AAPCS (2.09) states that __fp16 values should be converted to single-precision before being passed or returned, but AAPCS 2.10 (to be released shortly) changes this, so that they are passed in the least-significant 16 bits of either a GPR (for base AAPCS) or a single-precision register (for AAPCS-VFP). This does not change how arguments are passed if they get passed on the stack. This patch brings clang up to compliance with the latest versions of both of these specs. We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support the alternative format). llvm-svn: 246755
* add __builtin_unpredictable and convert to metadataSanjay Patel2015-09-021-0/+38
| | | | | | | | | | | | | | | | | | | | | | | This patch depends on r246688 (D12341). The goal is to make LLVM generate different code for these functions for a target that has cheap branches (see PR23827 for more details): int foo(); int normal(int x, int y, int z) { if (x != 0 && y != 0) return foo(); return 1; } int crazy(int x, int y) { if (__builtin_unpredictable(x != 0 && y != 0)) return foo(); return 1; } Differential Revision: http://reviews.llvm.org/D12458 llvm-svn: 246699
* [PowerPC] Support __builtin_ppc_get_timebaseHal Finkel2015-08-311-0/+7
| | | | | | | | | | GCC 4.8+ has a PowerPC-specific intrinsic, __builtin_ppc_get_timebase, to do what Clang's __builtin_readcyclecounter does. For compatibility with code that uses GCC's spelling (including glibc), support it as well. Partially fixes PR23681. llvm-svn: 246510
* Fix CHECK directives that weren't checking.Hans Wennborg2015-08-314-16/+17
| | | | llvm-svn: 246492
* [CUDA] fix codegen for __nvvm_atom_min/max_gen_u*Jingyue Wu2015-08-311-10/+10
| | | | | | | | | | | | Summary: Clang should emit "atomicrmw umin/umax" instead of "atomicrmw min/max". Reviewers: eliben, tra Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12487 llvm-svn: 246455
* Fix test for Release builds, the label form is <label>:14, not <label>14.Yaron Keren2015-08-301-6/+6
| | | | llvm-svn: 246391
* Make test resistant to false matches of numbered (unnamed) labels inside ↵Yaron Keren2015-08-301-4/+9
| | | | | | | | | | | other numbers. In release builds labels are numbers. Matching just the number may result in false matches where the label is contained in other numbers, such as 14 inside [114 x i8]. A stricter match requiring start of line or > character before the label avoids these false matches. llvm-svn: 246385
* [X86] Reapplied r246204, r246206, r246211, r246223Simon Pilgrim2015-08-294-4/+136
| | | | | | | | (Re)added debug codegen test for F16C, FMA4, XOP + 3DNow! intrinsics Part of PR24590 llvm-svn: 246363
* Add a check for a function we're not testing.Eric Christopher2015-08-291-0/+1
| | | | llvm-svn: 246355
* Revert "[X86][3DNow] Added debug codegen test for 3DNow! intrinsics"Renato Golin2015-08-281-26/+1
| | | | | | This reverts commit r246223, as it broke all ARM/AArch64 bots. llvm-svn: 246323
* Revert "[X86][XOP] Added debug codegen test for XOP intrinsics"Renato Golin2015-08-281-66/+1
| | | | | | This reverts commit r246211, as it broke all ARM/AArch64 bots. llvm-svn: 246321
* Revert "[X86][FMA4] Added debug codegen test for FMA4 intrinsics"Renato Golin2015-08-281-34/+1
| | | | | | This reverts commit r246206, as it broke all ARM/AArch64 bots. llvm-svn: 246320
* Revert "[X86][F16C] Added debug codegen test for F16C intrinsics"Renato Golin2015-08-281-6/+1
| | | | | | This reverts commit r246204, as it was breaking all ARM/AArch64 bots. llvm-svn: 246319
* Revert r246214 and r246213Steven Wu2015-08-281-1/+1
| | | | | | These two commits causes llvm LTO bootstrap to hang in ScalarEvolution. llvm-svn: 246282
* [X86] Bump Darwin MaxVectorAlign to 64 when AVX512 is enabled.Ahmed Bougacha2015-08-271-0/+10
| | | | | | | | | | | Without this, 64-byte vector types (__m512), specified to be 64-byte aligned in the AVX512 draft SysV ABI, will only be 32-byte aligned. This is analoguous to AVX, for which we accept 32-byte max alignment. Differential Revision: http://reviews.llvm.org/D10724 llvm-svn: 246230
OpenPOWER on IntegriCloud