summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: Optimize emssion of zeroinitialzied arraysDavid Majnemer2014-12-281-12/+24
| | | | | | | | | Create an ConstantAggregateZero upfront if we see that it is viable. This saves us from having to manually push_back each and every initializer and then looping back over them to determine if they are 'null'. llvm-svn: 224908
* [x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse ↵Craig Topper2014-12-271-2/+150
| | | | | | | | | | intrinsic files. This still lower to the same intrinsics as before. This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc. llvm-svn: 224879
* Initialize BackendConsumer::Context in constructor.Yaron Keren2014-12-251-1/+1
| | | | llvm-svn: 224836
* Initialize CodeGeneratorImpl::Ctx in constructor.Yaron Keren2014-12-251-1/+1
| | | | llvm-svn: 224835
* Debug Info: Pass the pointer size into createMemberPointerType().Adrian Prantl2014-12-231-2/+3
| | | | | | Paired commit with LLVM. llvm-svn: 224781
* Tweak the assert in ModuleBuilder from r224533 (PR21989)Hans Wennborg2014-12-191-2/+3
| | | | | | | Turns out there will be left-over deferred inline methods if there have been errors, because in that case HandleTopLevelDecl bails out early. llvm-svn: 224649
* Fix an address space id reset with array decay'sPekka Jaaskelainen2014-12-191-1/+2
| | | | | | | | | | implicit conversion. The issue was produced with OpenCL C code that called a function with a constant string literal argument. llvm-svn: 224592
* Fix a typo.Adrian Prantl2014-12-191-1/+1
| | | | llvm-svn: 224557
* ModuleBuilder: assert that all deferred inline method defs get handledHans Wennborg2014-12-181-4/+7
| | | | | | | While we're here, also move the declaration of DeferredInlineMethodDefinitions closer to the other member vars and make it a SmallVector. NFC. llvm-svn: 224533
* [Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.Fariborz Jahanian2014-12-181-6/+2
| | | | | | Patch by Alex Denisov. NFC. llvm-svn: 224525
* Fix for PR21915: assert on multidimensional VLA in function arguments.Alexey Bataev2014-12-181-22/+7
| | | | | | | Fixed assertion on type checking for arguments and parameters on function call if arguments are pointers to VLA Differential Revision: http://reviews.llvm.org/D6655 llvm-svn: 224504
* Update for llvm front end change and use the TargetOptions structEric Christopher2014-12-181-0/+1
| | | | | | for ABI. llvm-svn: 224493
* CGDebugInfo: Use DIBuilder API for self-referencing DICompositeTypesDuncan P. N. Exon Smith2014-12-181-9/+10
| | | | | | | | | | | Use new `DIBuilder` API from LLVM r224482 to mutate `DICompositeType`s, rather than changing them directly. This allows `DIBuilder` to track otherwise orphaned cycles when `CollectContainingType()` creates a self-reference. Fixes PR21941. llvm-svn: 224483
* InstrProf: Simplify/reduce state in CoverageMapping (NFC)Justin Bogner2014-12-171-38/+2
| | | | | | | | This state object makes things harder to reason about and isn't really useful, since we can just emit the mappings before the state changes rather than holding on to it. llvm-svn: 224476
* Revert "Put static local variables of inline functions in the function comdat."Rafael Espindola2014-12-171-4/+2
| | | | | | | | | This reverts commit r224369. Thanks to Reid Kleckner for pointing out that we need a bigger gun to fix this case. llvm-svn: 224475
* Revert "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-1715-92/+184
| | | | | | | | | Fails an ASan bootstrap - I'll try to reproduce locally & sort that out before recommitting. This reverts commit r224385. llvm-svn: 224441
* CodeGen: implement __emit intrinsicSaleem Abdulrasool2014-12-171-0/+22
| | | | | | | | | | | | | | | For MSVC compatibility, add the `__emit' builtin. This is used in the Windows SDK headers, and must therefore be implemented as a builtin rather than an intrinsic. The `__emit' builtin provides a mechanism to emit a 16-bit opcode instruction into the stream. The value must be a compile time constant expression. No guarantees are made about the CPU and memory states after the execution of the instruction. Due to the unchecked nature of the builtin, only support this on Windows on ARM. llvm-svn: 224438
* s/ScheduleKind/SchedKind/ in \param. [-Wdocumentation]NAKAMURA Takumi2014-12-171-1/+1
| | | | llvm-svn: 224431
* PR21909: Don't try (and crash) to generate debug info for explicit ↵David Blaikie2014-12-161-1/+2
| | | | | | instantiations of explicit specializations. llvm-svn: 224394
* DebugInfo: Generalize debug info location handlingDavid Blaikie2014-12-1615-184/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 224385
* Put static local variables of inline functions in the function comdat.Rafael Espindola2014-12-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | The variable (and the GV) is only ever used if the function is. Putting it in the function's comdat make it easier for the linker to discard them. The motivating example is struct S { static const int x; }; // const int S::x = 42; inline const int *f() { static const int y = S::x; return &y; } const int *g() { return f(); } With S::x commented out, _ZZ1fvE1y is a variable with a guard variable that is initialized by f. With S::x present, _ZZ1fvE1y is a constant. llvm-svn: 224369
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-161-4/+5
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* [OPENMP] Bugfix for processing of global variables in OpenMP regions.Alexey Bataev2014-12-163-19/+53
| | | | | | | | Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region. This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region. Differential Revision: http://reviews.llvm.org/D6259 llvm-svn: 224323
* Warn when attribute 'optnone' conflicts with attributes on aPaul Robinson2014-12-151-3/+4
| | | | | | different declaration of the same function. llvm-svn: 224256
* First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2014-12-154-4/+351
| | | | | | | | | | | | | | | the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 llvm-svn: 224233
* Bugfix for Codegen of atomic load/store/other ops.Alexey Bataev2014-12-153-82/+161
| | | | | | | Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations. Differential Revision: http://reviews.llvm.org/D6499 llvm-svn: 224230
* DebugInfo: More accurate line information for placement new.David Blaikie2014-12-141-0/+3
| | | | | | | | | | | This actually came up as a break in UBSan tests (look for a follow-up commit to this one to see the UBSan test fallout) when I tried a broader fix to location information. I have some other ideas about how to do that broader change & will keep looking into it. llvm-svn: 224221
* CodeGen: Compound literals with funny types shouldn't crashDavid Majnemer2014-12-142-3/+6
| | | | | | | | | | | | | | | | | CodeGen assumed that a compound literal with array type should have a corresponding LLVM IR array type. We had two bugs in this area: - Zero sized arrays in compound literals would lead to the creation of an opaque type. This is unnecessary, we should just create an array type with a bound of zero. - Funny record types (like unions) lead to exotic IR types for compound literals. In this case, CodeGen must be prepared to deal with the possibility that it might not have an array IR type. This fixes PR21912. llvm-svn: 224219
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-129-69/+119
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatileDavid Majnemer2014-12-121-7/+10
| | | | | | | | | Don't inherit the volatile-ness of the input pointer to the volatile operation for memory allocated on the side. This fixes PR17306. llvm-svn: 224110
* Instead of having -Os/-Oz add OptimizeForSize/MinSize first, and laterPaul Robinson2014-12-112-6/+16
| | | | | | | | | | having OptimizeNone remove them again, just don't add them in the first place if the function already has OptimizeNone. Note that MinSize can still appear due to attributes on different declarations; a future patch will address that. llvm-svn: 224047
* DebugInfo: Location information for scalar new expressionsDavid Blaikie2014-12-101-5/+7
| | | | llvm-svn: 223937
* OpenCL C: Add support for a set of floating point Pekka Jaaskelainen2014-12-101-0/+6
| | | | | | | | | | | | | | arithmetic relaxation flags: -cl-no-signed-zeros -cl-unsafe-math-optimizations -cl-finite-math-only -cl-fast-relaxed-math Propagate the info to FP instruction flags as well as function attributes where they are available. llvm-svn: 223928
* DebugInfo: Correct location information for array accesses to elements of ↵David Blaikie2014-12-101-0/+3
| | | | | | variable array type. llvm-svn: 223902
* DebugInfo: Fix another case of array access line informationDavid Blaikie2014-12-101-0/+3
| | | | llvm-svn: 223897
* DebugInfo: Correct the location of array accessesDavid Blaikie2014-12-101-0/+2
| | | | | | | Especially relevant to ASan when dealing with complex expressions containing multiple array accesses. See PR21737. llvm-svn: 223872
* DebugInfo: Correct location of aggregate assignmentDavid Blaikie2014-12-091-0/+2
| | | | llvm-svn: 223854
* DebugInfo: Correct location of initialization of auto __complexDavid Blaikie2014-12-091-1/+1
| | | | llvm-svn: 223842
* DebugInfo: Correct the location of initializations of auto.David Blaikie2014-12-093-4/+6
| | | | llvm-svn: 223839
* DebugInfo: Correct location for compound complex assignmentDavid Blaikie2014-12-091-2/+1
| | | | llvm-svn: 223835
* DebugInfo: Accurate location information for complex assignmentDavid Blaikie2014-12-091-4/+4
| | | | llvm-svn: 223828
* DebugInfo: Emit the correct location for initialization of a complex variableDavid Blaikie2014-12-093-11/+19
| | | | | | Especially useful for sanitizer reports. llvm-svn: 223825
* Fix a GCC error from r223803Duncan P. N. Exon Smith2014-12-091-3/+5
| | | | llvm-svn: 223814
* IR: Update clang for Metadata/Value split in r223802Duncan P. N. Exon Smith2014-12-0914-274/+266
| | | | | | Match LLVM API changes from r223802. llvm-svn: 223803
* DebugInfo: Correctly identify the location of C++ member initializer list ↵David Blaikie2014-12-094-23/+31
| | | | | | | | | | | | | elements This particularly helps the fidelity of ASan reports (which can occur even in these examples - if, for example, one uses placement new over a buffer of insufficient size - now ASan will correctly identify which member's initialization went over the end of the buffer). This doesn't cover all types of members - more coming. llvm-svn: 223726
* DebugInfo: Ensure the store for an assignment is attributed to the beginning ↵David Blaikie2014-12-081-0/+2
| | | | | | of the assignment expression llvm-svn: 223699
* InstrProf: Use LLVM's -instrprof pass for profilingJustin Bogner2014-12-088-274/+54
| | | | | | | | The logic for lowering profiling counters has been moved to an LLVM pass. Emit the intrinsics rather than duplicating the whole pass in clang. llvm-svn: 223683
* No memcpy for copy ctor with -fsanitize-address-field-padding=1Kostya Serebryany2014-12-061-2/+3
| | | | | | | | | | | | | | | | | | | Summary: When -fsanitize-address-field-padding=1 is present don't emit memcpy for copy constructor. Thanks Nico for the extra test case. Test Plan: regression tests Reviewers: thakis, rsmith Reviewed By: rsmith Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D6515 llvm-svn: 223563
* [OPENMP] Codegen for 'omp barrier' directive.Alexey Bataev2014-12-053-42/+48
| | | | | | | | | Adds generation of call to "i32 kmpc_cancel_barrier(ident_t *, i32)" libcall for explicitly specified barriers (OMP_IDENT_BARRIER_EXPL flag is added to "flags" field of "ident_t" structure). Also this patch replaces all calls to "kmpc_barrier" function by calls of "__kmpc_cancel_barrier" function which provides additional functionality for OpenMP 4.0. Also, library specific enum OpenMPLocationFlags moved to private section of CGOpenMPRuntime class to make it more independent from library implementation. Differential Revision: http://reviews.llvm.org/D6447 llvm-svn: 223444
* Add attributes for AMDGPU register limits.Matt Arsenault2014-12-041-0/+42
| | | | | | | This is a performance hint that can be applied to kernels to attempt to limit the number of used registers. llvm-svn: 223384
OpenPOWER on IntegriCloud