summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Update Clang for D20147 ("DebugInfo: New metadata representation for global ↵Peter Collingbourne2016-09-134-10/+15
| | | | | | | | variables.") Differential Revision: http://reviews.llvm.org/D20415 llvm-svn: 281285
* [Sema] Fix PR30346: relax __builtin_object_size checks.George Burgess IV2016-09-122-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes us act more conservatively when trying to determine the objectsize for an array at the end of an object. This is in response to code like the following: ``` struct sockaddr { /* snip */ char sa_data[14]; }; void foo(const char *s) { size_t slen = strlen(s) + 1; size_t added_len = slen <= 14 ? 0 : slen - 14; struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len); strcpy(sa->sa_data, s); // ... } ``` `__builtin_object_size(sa->sa_data, 1)` would return 14, when there could be more than 14 bytes at `sa->sa_data`. Code like this is apparently not uncommon. FreeBSD's manual even explicitly mentions this pattern: https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html (section 7.5.1.1.2). In light of this, we now just give up on any array at the end of an object if we can't find the object's initial allocation. I lack numbers for how much more conservative we actually become as a result of this change, so I chose the fix that would make us as compatible with GCC as possible. If we want to be more aggressive, I'm happy to consider some kind of whitelist or something instead. llvm-svn: 281277
* Debug info: Bump the default DWARF version on Darwin to 4.Adrian Prantl2016-09-091-1/+1
| | | | | | | This is a spiritual re-commit of r201375 with only a brief delay for upgrading the green dragon builders. llvm-svn: 281094
* Implement MS _rot intrinsicsAlbert Gutowski2016-09-081-0/+181
| | | | | | | | | | Reviewers: thakis, Prazek, compnerd, rnk Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D24311 llvm-svn: 280997
* Revert "[XRay] ARM 32-bit no-Thumb support in Clang"Renato Golin2016-09-081-13/+0
| | | | | | | This reverts commit r280889, as the original LLVM commits broke the thumb buildbots. llvm-svn: 280968
* [XRay] ARM 32-bit no-Thumb support in ClangDean Michael Berris2016-09-081-0/+13
| | | | | | | | | | | | | Just a test for now, adapted from x86_64 tests of XRay. This is one of 3 commits to different repositories of XRay ARM port. The other 2 are: 1. https://reviews.llvm.org/D23931 (LLVM) 2. https://reviews.llvm.org/D23933 (compiler-rt) Differential Review: https://reviews.llvm.org/D23932 llvm-svn: 280889
* Move CHECK right before the function it describes.George Burgess IV2016-09-071-1/+1
| | | | llvm-svn: 280852
* [Sema] Compare bad conversions in overload resolution.George Burgess IV2016-09-071-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r280553 introduced an issue where we'd emit ambiguity errors for code like: ``` void foo(int *, int); void foo(unsigned int *, unsigned int); void callFoo() { unsigned int i; foo(&i, 0); // ambiguous: int->unsigned int is worse than int->int, // but unsigned int*->unsigned int* is better than // int*->int*. } ``` This patch fixes this issue by changing how we handle ill-formed (but valid) implicit conversions. Candidates with said conversions now always rank worse than candidates without them, and two candidates are considered to be equally bad if they both have these conversions for the same argument. Additionally, this fixes a case in C++11 where we'd complain about an ambiguity in a case like: ``` void f(char *, int); void f(const char *, unsigned); void g() { f("abc", 0); } ``` ...Since conversion to char* from a string literal is considered ill-formed in C++11 (and deprecated in C++03), but we accept it as an extension. llvm-svn: 280847
* [AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div ↵Craig Topper2016-09-041-40/+72
| | | | | | | | builtins and replace with native operations. We can't do the 512-bit ones because they take a rounding mode argument that we can't represent. llvm-svn: 280635
* [AVX-512] Remove masked integer mullo builtins and replace with native IR.Craig Topper2016-09-036-18/+36
| | | | llvm-svn: 280597
* [AVX-512] Remove masked integer add/sub builtins and replace with native IR.Craig Topper2016-09-034-49/+98
| | | | llvm-svn: 280596
* (clang part) Implement MASM-flavor intel syntax behavior for inline MS asm ↵Yunzhong Gao2016-09-021-12/+12
| | | | | | | | | | | | | | block. Clang tests for verifying the following syntaxes: 1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not. 0xNN and NNh may come with optional U or L suffix. 2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not. NNb may come with optional U or L suffix. Differential Revision: https://reviews.llvm.org/D22112 llvm-svn: 280556
* [Sema] Relax overloading restrictions in C.George Burgess IV2016-09-022-22/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows us to perform incompatible pointer conversions when resolving overloads in C. So, the following code will no longer fail to compile (though it will still emit warnings, assuming the user hasn't opted out of them): ``` void foo(char *) __attribute__((overloadable)); void foo(int) __attribute__((overloadable)); void callFoo() { unsigned char bar[128]; foo(bar); // selects the char* overload. } ``` These conversions are ranked below all others, so: A. Any other viable conversion will win out B. If we had another incompatible pointer conversion in the example above (e.g. `void foo(int *)`), we would complain about an ambiguity. Differential Revision: https://reviews.llvm.org/D24113 llvm-svn: 280553
* [Frontend] Fix mcount inlining bugHonggyu Kim2016-09-011-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Since some profiling tools, such as gprof, ftrace, and uftrace, use -pg option to generate a mcount function call at the entry of each function. Function invocation can be detected by this hook function. But mcount insertion is done before function inlining phase in clang, sometime a function that already has a mcount call can be inlined in the middle of another function. This patch adds an attribute "counting-function" to each function rather than emitting the mcount call directly in frontend so that this attribute can be processed in backend. Then the mcount calls can be properly inserted in backend after all the other optimizations are completed. Link: https://llvm.org/bugs/show_bug.cgi?id=28660 Reviewers: hans, rjmccall, hfinkel, rengolin, compnerd Subscribers: shenhan, cfe-commits Differential Revision: https://reviews.llvm.org/D22666 llvm-svn: 280355
* Add -fprofile-dir= to clang.Nick Lewycky2016-08-311-0/+4
| | | | | | | | | | | | | | | | | | | | | -fprofile-dir=path allows the user to specify where .gcda files should be emitted when the program is run. In particular, this is the first flag that causes the .gcno and .o files to have different paths, LLVM is extended to support this. -fprofile-dir= does not change the file name in the .gcno (and thus where lcov looks for the source) but it does change the name in the .gcda (and thus where the runtime library writes the .gcda file). It's different from a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX. To implement this we split -coverage-file into -coverage-data-file and -coverage-notes-file to specify the two different names. The !llvm.gcov metadata node grows from a 2-element form {string coverage-file, node dbg.cu} to 3-elements, {string coverage-notes-file, string coverage-data-file, node dbg.cu}. In the 3-element form, the file name is already "mangled" with .gcno/.gcda suffixes, while the 2-element form left that to the middle end pass. llvm-svn: 280306
* [AVX-512] Implement masked floating point logical operations with native IR ↵Craig Topper2016-08-312-49/+121
| | | | | | and remove the builtins. llvm-svn: 280197
* [X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.Craig Topper2016-08-311-5/+5
| | | | | | These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements. llvm-svn: 280196
* This adds new options -fdenormal-fp-math and passes through option -ffast-mathSjoerd Meijer2016-08-302-0/+20
| | | | | | | | | | to CC1, which are translated to function attributes and can e.g. be mapped on build attributes FP_exceptions and FP_denormal. Setting these build attributes allows better selection of floating point libraries. Differential Revision: https://reviews.llvm.org/D23840 llvm-svn: 280064
* [PowerPC] Update the DWARF register-size tableHal Finkel2016-08-301-0/+129
| | | | | | | | | The PPC64 DWARF register-size table did not match the ABI specification (or GCC, for that matter). Fix that, and add a regression test. Fixes PR27931. llvm-svn: 280053
* [MS] Win64 va_arg should expect large arguments to be passed indirectlyReid Kleckner2016-08-251-8/+11
| | | | | | Fixes PR20569 llvm-svn: 279774
* DebugInfo: Add flag to CU to disable emission of inline debug info into the ↵David Blaikie2016-08-243-5/+10
| | | | | | | | | | skeleton CU In cases where .dwo/.dwp files are guaranteed to be available, skipping the extra online (in the .o file) inline info can save a substantial amount of space - see the original r221306 for more details there. llvm-svn: 279651
* Revert "[X86] Add xgetbv/x[X86] Add xgetbv xsetbv intrinsics to non-windows ↵Reid Kleckner2016-08-163-125/+5
| | | | | | | | platforms" This reverts commit r278783. It breaks usage of _xgetbv on Windows. llvm-svn: 278814
* Left shifts of negative values are defined if -fwrapv is setJames Molloy2016-08-161-0/+12
| | | | | | | This means we shouldn't emit ubsan detection code or warn. Fixes PR25552. llvm-svn: 278786
* [X86] Add xgetbv/x[X86] Add xgetbv xsetbv intrinsics to non-windows platformsMarina Yatsina2016-08-163-5/+125
| | | | | | | | commit on behalf of guyblank Differential Revision: https://reviews.llvm.org/D21959 llvm-svn: 278783
* [CodeGen] Ignore unnamed bitfields before handling vector fieldsDavid Majnemer2016-08-151-0/+9
| | | | | | | | | | | | We processed unnamed bitfields after our logic for non-vector field elements in records larger than 128 bits. The vector logic would determine that the bit-field disqualifies the record from occupying a register despite the unnamed bit-field not participating in the record size nor its alignment. N.B. This behavior matches GCC and ICC. llvm-svn: 278656
* [CodeGen] Correctly implement the AVX512 psABI rulesDavid Majnemer2016-08-151-4/+5
| | | | | | | | | | | | | | An __m512 vector type wrapped in a structure should be passed in a vector register. Our prior implementation was based on a draft version of the psABI. This fixes PR28975. N.B. The update to the ABI was made here: https://github.com/hjl-tools/x86-psABI/commit/30f9c9 llvm-svn: 278655
* [X86][AVX512] lower __mm512_andnot_ps/__mm512_andnot_pd to IRLama Saba2016-08-101-2/+4
| | | | | | | Differential revision: https://reviews.llvm.org/D23262 llvm-svn: 278209
* [X86][AVX] Ensure we only match against 1-byte alignmentSimon Pilgrim2016-08-101-2/+2
| | | | llvm-svn: 278208
* [x86] Fix a really nasty bug introduced in r276417 where alignmentChandler Carruth2016-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | constraints were added to _mm256_broadcast_{pd,ps} intel intrinsics. The spec for these intrinics is ... pretty much silent on alignment. This is especially frustrating considering the amount of discussion of alignment in the load and store instrinsics. So I was forced to rely on the specification for the VBROADCASTF128 instruction. That instruction's spec is *also* completely silent on alignment. Fortunately, when it comes to the instruction's spec, silence is enough. There is no #GP fault option for an underaligned address so this instruction, and by inference the intrinsic, can read any alignment. As it happens, the old code worked exactly this way and in fact we have plenty of code that hands pointers with less than 16-byte alignment to these intrinsics. This code broke pretty spectacularly with this commit. Fortunately, the fix is super simple! Change a 16 to a 1, and ta da! Anyways, a lot of debugging for a really boring fix. =] llvm-svn: 278202
* Revert "[Attr] Add support for the `ms_hook_prologue` attribute."Charles Davis2016-08-081-7/+0
| | | | | | | This reverts commit r278050. It depends on r278048, which will be reverted. llvm-svn: 278052
* [Attr] Add support for the `ms_hook_prologue` attribute.Charles Davis2016-08-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Michael Mueller. This attribute specifies that a function can be hooked or patched. This mechanism was originally devised by Microsoft for hotpatching their binaries (which they're constantly updating to stay ahead of crackers, script kiddies, and other ne'er-do-wells on the Internet), but it's now commonly abused by Windows programs that want to hook API functions. It is for this reason that this attribute was added to GCC--hence the name, `ms_hook_prologue`. Depends on D19908. Reviewers: rnk, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D19909 llvm-svn: 278050
* [AVX512] integer comparisions enumeration.Asaf Badouh2016-08-072-39/+39
| | | | | | | | | | fix Bug 28842 https://llvm.org/bugs/show_bug.cgi?id=28842 Differential Revision: https://reviews.llvm.org/D22212 llvm-svn: 277955
* After PR28761 use -Wall with -Werror in builtins tests to identifyEric Christopher2016-08-0433-61/+61
| | | | | | possible problems in headers. llvm-svn: 277696
* CodeGen: simplify the CC handling for TLS wrappersSaleem Abdulrasool2016-08-011-0/+11
| | | | | | | | | Use the calling convention of the wrapper directly to set the calling convention to ensure that the calling convention matches. Incorrectly setting the calling convention results in the code path being entirely nullified as InstCombine + SimplifyCFG will prune the mismatched CC calls. llvm-svn: 277390
* [AArch64] Add support for Samsung Exynos M2 (NFC).Evandro Menezes2016-08-011-0/+1
| | | | llvm-svn: 277365
* CodeGen: try harder to make the CFString structure RWSaleem Abdulrasool2016-07-291-10/+18
| | | | | | | | The previous change was insufficient to mark the content as read-write as the structure itself was marked constant. Adjust this and add tests to ensure that the section is marked appropriately as being read-write. llvm-svn: 277200
* Replace preserve-as-comments CodeGen test with driver testNirav Dave2016-07-281-12/+0
| | | | llvm-svn: 276947
* Add target triple in testNirav Dave2016-07-271-2/+2
| | | | llvm-svn: 276915
* Add flags to toggle preservation of assembly commentsNirav Dave2016-07-271-0/+12
| | | | | | | | | | | | Summary: Add -fpreserve-as-comments and -fno-preserve-as-comments. Reviewers: echristo, rnk Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22883 llvm-svn: 276907
* Adjust coercion of aggregates on RenderScriptPirama Arumuga Nainar2016-07-271-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In RenderScript, the size of the argument or return value emitted in the IR is expected to be the same as the size of corresponding qualified type. For ARM and AArch64, the coercion performed by Clang can change the parameter or return value to a type whose size is different (usually larger) than the original aggregate type. Specifically, this can happen in the following cases: - Aggregate parameters of size <= 64 bytes and return values smaller than 4 bytes on ARM - Aggregate parameters and return values smaller than bytes on AArch64 This patch coerces the cases above to an integer array that is the same size and alignment as the original aggregate. A new field is added to TargetInfo to detect a RenderScript target and limit this coercion just to that case. Tests added to test/CodeGen/renderscript.c Reviewers: rsmith Subscribers: aemerson, srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D22822 llvm-svn: 276904
* Update for LLVM changesDavid Majnemer2016-07-261-5504/+3125
| | | | | | | InstSimplify has gained the ability to remove needless bitcasts which perturbed some clang codegen tests. llvm-svn: 276756
* Update for LLVM changesDavid Majnemer2016-07-2612-7113/+5018
| | | | | | | InstSimplify has gained the ability to remove needless bitcasts which perturbed some clang codegen tests. llvm-svn: 276728
* Add .rgba syntax extension to ext_vector_type typesPirama Arumuga Nainar2016-07-221-0/+37
| | | | | | | | | | | | | | | | | | Summary: This patch enables .rgba accessors to ext_vector_type types and adds tests for syntax validation and code generation. 'a' and 'b' can appear either in the point access mode or the numeric access mode (for indices 10 and 11). To disambiguate between the two usages, the accessor type is explicitly passed to relevant methods. Reviewers: rsmith Subscribers: Anastasia, bader, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D20602 llvm-svn: 276455
* [X86][AVX] Added support for lowering to VBROADCASTF128/VBROADCASTI128 with ↵Simon Pilgrim2016-07-221-2/+4
| | | | | | | | | | generic IR As discussed on D22460, I've updated the vbroadcastf128 pd256/ps256 builtins to map directly to generic IR - load+splat a 128-bit vector to both lanes of a 256-bit vector. Fix for PR28657. llvm-svn: 276417
* Reverting r275115 which caused PR28634.Wolfgang Pieb2016-07-211-36/+0
| | | | | | | When empty (forwarding) basic blocks that are referenced by user labels are removed, incorrect code may be generated. llvm-svn: 276361
* [Sema,X86] Add explicit check to ensure that builtins that require x86-64 ↵Craig Topper2016-07-211-0/+22
| | | | | | | | | | target throw an error if used on 32-bit target. If these builtins are allowed to go through on a 32-bit target they will fire assertions in the backend. Fixes PR28635. llvm-svn: 276250
* [X86] Add missing __x86_64__ qualifiers on a bunch of intrinsics that assume ↵Craig Topper2016-07-212-0/+38
| | | | | | | | 64-bit GPRs are available. Usages of these intrinsics in a 32-bit build results in assertions in the backend. llvm-svn: 276249
* [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using ↵Simon Pilgrim2016-07-204-14/+17
| | | | | | | | | | | | | | | | generic IR D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead. It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match). This patch changes both scalar and packed versions back to using x86-specific builtins. It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding. Differential Revision: https://reviews.llvm.org/D22105 llvm-svn: 276102
* Let FuncAttrs infer the 'returned' argument attributeDavid Majnemer2016-07-191-1/+1
| | | | | | This reverts commit r275756. llvm-svn: 276014
* [mips] Correct label prefixes for N32 and N64.Daniel Sanders2016-07-191-4/+4
| | | | | | | | | | | | | | | | | Summary: N32 and N64 follow the standard ELF conventions (.L) whereas O32 uses its own ($). This fixes the majority of object differences between -fintegrated-as and -fno-integrated-as. Reviewers: sdardis Subscribers: dsanders, sdardis, llvm-commits Differential Revision: https://reviews.llvm.org/D22412 llvm-svn: 275967
OpenPOWER on IntegriCloud