summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge part of r246985, which disables this assertionupstream/release_37Reid Kleckner2015-11-171-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_37@253380 91177308-0d34-0410-b5e6-96231b3b80d8
* Respect alignment when loading up a coerced function argumentUlrich Weigand2015-07-101-36/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | Code in CGCall.cpp that loads up function arguments that need to be coerced to a different type may in some cases ignore the fact that the source of the argument is not naturally aligned. This may cause incorrect code to be generated. In some places in CreateCoercedLoad, we already have setAlignment calls to address this, but I ran into one where it was missing, causing wrong code generation on SystemZ. However, in that location, we do not actually know what alignment of the source location we can rely on; the callers do not pass anything to this routine. This is already an issue in other places in CreateCoercedLoad; and the same problem exists for CreateCoercedStore. To avoid pessimising code, and to fix the FIXMEs already in place, this patch also adds an alignment argument to the CreateCoerced* routines and uses it instead of forcing an alignment of 1. The callers are changed to pass in the best information they have. This actually requires changes in a number of existing test cases since we now get better alignment in many places. Differential Revision: http://reviews.llvm.org/D11033 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241898 91177308-0d34-0410-b5e6-96231b3b80d8
* Update target attribute support for post-commit feedback.Eric Christopher2015-07-061-1/+1
| | | | | | | Use const auto rather than duplicating the type name and fix the error message when the attribute is applied to an incorrect entity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241526 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle arbitrary whitespace in the target attribute support.Eric Christopher2015-07-061-1/+5
| | | | | | | This allows us to deal a bit more gracefully with inclusions done by macros, token pasting, or just code layout/formatting. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241525 91177308-0d34-0410-b5e6-96231b3b80d8
* Attach attribute "trap-func-name" to call sites of llvm.trap and llvm.debugtrap.Akira Hatanaka2015-07-021-0/+2
| | | | | | | | | | | | This is needed to use clang's command line option "-ftrap-function" for LTO and enable changing the trap function name on a per-call-site basis. rdar://problem/21225723 Differential Revision: http://reviews.llvm.org/D10831 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241306 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Use llvm::join to simplify string joining.Benjamin Kramer2015-07-021-8/+2
| | | | | | | While there replace stable_sort of std::string with just sort, stability is not necessary for "simple" value types. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241299 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a stable sort to guarantee target feature ordering in the IREric Christopher2015-07-011-0/+1
| | | | | | | in order to make testing somewhat more feasible. Has the advantage of making it easier to find target features as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241134 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a TODO dealing with canonicalizing attributes on functions byEric Christopher2015-07-011-9/+21
| | | | | | | | using a string map to canonicalize. Fix up a couple of testcases that needed changing since we are no longer simply appending features to the list, but all of their mask dependencies as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241129 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240110 91177308-0d34-0410-b5e6-96231b3b80d8
* [CGCall] Fix potential invalid iterator decrement in ↵Alexey Samsonov2015-06-121-5/+4
| | | | | | | | | | | findDominatingStoreToReturnValue. If llvm.lifetime.end turns out to be the first instruction in the last basic block, we can decrement the iterator twice, going past rend. At the moment, this can never happen because llvm.lifetime.end always goes immediately after bitcast, but relying on this is very brittle. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239638 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle fpmath= in the target attribute.Eric Christopher2015-06-121-0/+5
| | | | | | | | | | Right now we're ignoring the fpmath attribute since there's no backend support for a feature like this and to do so would require checking the validity of the strings and doing general subtarget feature parsing of valid and invalid features with the target attribute feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239582 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle -mno-<feature> in target attribute strings by replacing theEric Christopher2015-06-121-2/+4
| | | | | | | -mno- with a -<feature> to match how we handle this in the rest of the frontend. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239581 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for tune= to the target attribute support by ignoring it.Eric Christopher2015-06-121-0/+3
| | | | | | | We don't currently support the -mtune option in any useful way so ignoring the annotation is fine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239580 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for the the target attribute.Eric Christopher2015-06-121-11/+39
| | | | | | | | | | | | | | | Modeled after the gcc attribute of the same name, this feature allows source level annotations to correspond to backend code generation. In llvm particular parlance, this allows the adding of subtarget features and changing the cpu for a particular function based on source level hints. This has been added into the existing support for function level attributes without particular verification for any target outside of whether or not the backend will support the features/cpu given (similar to section, etc). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239579 91177308-0d34-0410-b5e6-96231b3b80d8
* Attach attribute "disable-tail-calls" to the functions in the IR.Akira Hatanaka2015-06-091-0/+2
| | | | | | | | | | | | This commit adds back the code that seems to have been dropped unintentionally in r176985. rdar://problem/13752163 Differential Revision: http://reviews.llvm.org/D10100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239426 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Reuse stack space from unused function results (with more accurate ↵Leny Kholodov2015-06-081-3/+20
| | | | | | | | | | | | unused result detection) This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743. Differential Revision: http://reviews.llvm.org/D10042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239294 91177308-0d34-0410-b5e6-96231b3b80d8
* ubsan: Check for null pointers given to certain builtins, suchNuno Lopes2015-05-301-12/+13
| | | | | | | | | | | | as memcpy, memset, memmove, and bzero. Reviewed by: Richard Smith Differential Revision: http://reviews.llvm.org/D9673 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238657 91177308-0d34-0410-b5e6-96231b3b80d8
* [MIPS] Re-land the change r238200 to fix extension of integer typesPetar Jovanovic2015-05-261-2/+6
| | | | | | | | | Re-land the change r238200, but with modifications in the tests that should prevent new failures in some environments as reported with the original change on the mailing list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238253 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r238200: "[MIPS] fix extension of integer types (function calls)"Hans Wennborg2015-05-261-6/+2
| | | | | | mips-unsigned-ext-var.c and mips-unsigned-extend.c fail in some builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238237 91177308-0d34-0410-b5e6-96231b3b80d8
* [MIPS] fix extension of integer types (function calls)Petar Jovanovic2015-05-261-2/+6
| | | | | | | | | | | On MIPS unsigned int type should not be zero extended but sign-extended. Patch by Strahinja Petrovic. Differential Revision: http://reviews.llvm.org/D9198 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238200 91177308-0d34-0410-b5e6-96231b3b80d8
* API update for streamlining of IRBuilder::CreateCall to just use ↵David Blaikie2015-05-181-1/+1
| | | | | | ArrayRef/initializer_list+braced init git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237625 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r237385, "[CodeGen] Reuse stack space from unused function results"NAKAMURA Takumi2015-05-151-20/+3
| | | | | | It broke clang stage2, at least tblgen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237418 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Reuse stack space from unused function resultsSergey Dmitrouk2015-05-141-3/+20
| | | | | | | | | | | | | | | | | | | | Summary: Space on stack allocated for unused structures returned by functions was unused even when it's lifetime didn't intersect with lifetime of any other objects that could use the same space. The test added also checks for named and auto objects. It seems to make sense to have this all in one place. Reviewers: aadg, rsmith, rjmccall, rnk Reviewed By: rnk Subscribers: asl, cfe-commits Differential Revision: http://reviews.llvm.org/D9743 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237385 91177308-0d34-0410-b5e6-96231b3b80d8
* InstrProf: This call does nothing, remove itJustin Bogner2015-05-011-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236298 91177308-0d34-0410-b5e6-96231b3b80d8
* Always add the target-cpu and target-features sets if they're non-null.Eric Christopher2015-04-271-9/+9
| | | | | | | | This makes sure that the front end is specific about what they're expecting the backend to produce. Update a FIXME with the idea that the target-features could be more precise using backend knowledge. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235936 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Fix the preferred alignment of member pointersDavid Majnemer2015-04-241-2/+1
| | | | | | | Member pointers in the MS ABI have different alignment depending on whether they were created on the stack or live in a record. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235681 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert r234581, it might have caused a few miscompiles in Chromium."David Majnemer2015-04-221-2/+26
| | | | | | | | This reverts commit r234700. It turns out that the lifetime markers were not the cause of Chromium failing but a bug which was uncovered by optimizations exposed by the markers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235553 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r234581, it might have caused a few miscompiles in Chromium.Nico Weber2015-04-111-26/+2
| | | | | | | | If the revert helps, I'll get a repro this Monday. Else I'll put the change back in. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234700 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't rely on implicit CallSite construction.Benjamin Kramer2015-04-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234600 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove threshold for inserting lifetime markers for named temporariesArnaud A. de Grandmaison2015-04-101-2/+26
| | | | | | | | | | | | | | | | | | | Now that TailRecursionElimination has been fixed with r222354, the threshold on size for lifetime marker insertion can be removed. This only affects named temporary though, as the patch for unnamed temporaries is still in progress. My previous commit (r222993) was not handling debuginfo correctly, but this could only be seen with some asan tests. Basically, lifetime markers are just instrumentation for the compiler's usage and should not affect debug information; however, the cleanup infrastructure was assuming it contained only destructors, i.e. actual code to be executed, and was setting the breakpoint for the end of the function to the closing '}', and not the return statement, in order to show some destructors have been called when leaving the function. This is wrong when the cleanups are only lifetime markers, and this is now fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234581 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format my last commitDavid Blaikie2015-04-051-8/+13
| | | | | | (sorry, keep forgetting that) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234129 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] More GEP API migrationsDavid Blaikie2015-04-051-9/+10
| | | | | | | Looks like the VTable code in particular will need some work to pass around the pointee type explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234128 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] More GEP API migrationsDavid Blaikie2015-04-041-7/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234109 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] Explicitly specify some types for GEPDavid Blaikie2015-04-031-4/+5
| | | | | | | Not all of them (there's still a fallback for this specific function that omits the type parameter) but it's some I bothered to do now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234063 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Use new LLVM API for DebugLocDuncan P. N. Exon Smith2015-03-301-1/+1
| | | | | | | Use the new API for `DebugLoc` added in r233573 before the old one disappears. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233589 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r232888 after applying a fix for -msse4 code generation.Eric Christopher2015-03-251-0/+21
| | | | | | | As a note, any target that uses fake target features via command line options will have similar problems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233227 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add CodeGen support for adding cpu attributes on functions based on"Daniel Jasper2015-03-231-21/+0
| | | | | | | This breaks CodeGen for an internal target. I'll get repro instructions to you. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232930 91177308-0d34-0410-b5e6-96231b3b80d8
* Add CodeGen support for adding cpu attributes on functions based onEric Christopher2015-03-211-0/+21
| | | | | | | | | | | | | the target-cpu, if different from the triple's cpu, and target-features as they're written that are passed down from the driver. Together with LLVM r232885 this should allow the LTO'ing of binaries that contain modules compiled with different code generation options on a subset of architectures with full backend support (x86, powerpc, aarch64). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232888 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Generate default constructor closuresDavid Majnemer2015-03-131-2/+6
| | | | | | | | | | | | | | | | | | | | The MS ABI utilizes a compiler generated function called the "vector constructor iterator" to construct arrays of objects with non-trivial constructors/destructors. For this to work, the constructor must follow a specific calling convention. A thunk must be created if the default constructor has default arguments, is variadic or is otherwise incompatible. This thunk is called the default constructor closure. N.B. Default constructor closures are only generated if the default constructor is exported because clang itself does not utilize vector constructor iterators. Failing to export the default constructor closure will result in link/load failure if a translation unit compiled with MSVC is on the import side. Differential Revision: http://reviews.llvm.org/D8331 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232229 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Implement copy-ctor closures, finish implementing throwDavid Majnemer2015-03-111-0/+16
| | | | | | | | | | | | | | | This adds support for copy-constructor closures. These are generated when the C++ runtime has to call a copy-constructor with a particular calling convention or with default arguments substituted in to the call. Because the runtime has no mechanism to call the function with a different calling convention or know-how to evaluate the default arguments at run-time, we create a thunk which will do all the appropriate work and package it in a way the runtime can use. Differential Revision: http://reviews.llvm.org/D8225 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231952 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for LLVM API change: getOrEnforceKnownAlignment() requires a DataLayoutMehdi Amini2015-03-101-2/+2
| | | | | | From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231739 91177308-0d34-0410-b5e6-96231b3b80d8
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-4/+2
| | | | | | Same functionality, but hoists the vector growth out of the loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229508 91177308-0d34-0410-b5e6-96231b3b80d8
* SEH: Use the SEHTryEpilogueStack instead of a separate boolReid Kleckner2015-02-121-1/+1
| | | | | | We don't need a bool to track this now that we have a stack for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228982 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the 'noinline' attribute to call sites within __try bodiesReid Kleckner2015-02-111-0/+6
| | | | | | | LLVM doesn't support non-call exceptions, so inlining makes it harder to catch such asynchronous exceptions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228876 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit landing pads for SEH even if nounwind is presentReid Kleckner2015-02-111-1/+2
| | | | | | | Disabling exceptions applies nounwind to lots of functions. SEH catches asynch exceptions, so emit the landing pad anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228769 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Refactor default arg handling into a common place (instead of ↵David Blaikie2015-02-091-0/+14
| | | | | | handling in repeatedly for aggregate, complex, and scalar types) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228591 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Move DebugLocs.Benjamin Kramer2015-02-071-1/+1
| | | | | | | | It's slightly cheaper than copying it, if the DebugLoc points to replaceable metadata every copy is recorded in a DenseMap, moving reduces the peak size of that map. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228492 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Add support for __declspec(restrict)David Majnemer2015-02-041-1/+1
| | | | | | | | | | __declspec(restrict) and __attribute(malloc) are both handled identically by clang: they are allowed to the noalias LLVM attribute. Seeing as how noalias models the C99 notion of 'restrict', rename the internal clang attribute to Restrict from Malloc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228120 91177308-0d34-0410-b5e6-96231b3b80d8