summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Properly null-check typeid expressionsDavid Majnemer2014-07-181-6/+25
| | | | | | | | | | | | | | | Summary: Thoroughly check for a pointer dereference which yields a glvalue. Look through casts, comma operators, conditional operators, paren expressions, etc. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4416 llvm-svn: 213401
* Recommit: Handle diagnostic warnings in Frontend diagnostic handler.Tyler Nowicki2014-07-181-12/+25
| | | | | | | | | | | | | | | Clang uses a diagnostic handler to grab diagnostic messages so it can print them with the line of source code they refer to. This patch extends this to handle optimization failures that were added to llvm to produce a warning when loop vectorization is explicitly specified (using a pragma clang loop directive) but fails. Update renames warning flag name to avoid indicating the flag's severity and adds a test. Reviewed by Alp Toker llvm-svn: 213400
* [UBsan] Skip -fsanitize=vptr instrumentations when the pointer value is null.Alexey Samsonov2014-07-181-1/+1
| | | | | | | | | | Otherwise -fsanitize=vptr causes the program to crash when it downcasts a null pointer. Reviewed in http://reviews.llvm.org/D4412. Patch by Byoungyoung Lee! llvm-svn: 213393
* Make sure globals created by UBSan are not instrumented by ASan.Alexey Samsonov2014-07-183-9/+31
| | | | | | | | | | | | | | | | | | | | | | Summary: This change adds description of globals created by UBSan instrumentation (UBSan handlers, type descriptors, filenames) to llvm.asan.globals metadata, effectively "blacklisting" them. This can dramatically decrease the data section in binaries built with UBSan+ASan, as UBSan tends to create a lot of handlers, and ASan instrumentation increases the global size to at least 64 bytes. Test Plan: clang regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, byoungyoung, kcc Differential Revision: http://reviews.llvm.org/D4575 llvm-svn: 213392
* Mark C++ reference parameters as dereferenceableHal Finkel2014-07-181-4/+16
| | | | | | | | | | | | | | Because references must be initialized using some evaluated expression, they must point to something, and a callee can assume the reference parameter is dereferenceable. Taking advantage of a new attribute just added to LLVM, mark them as such. Because dereferenceability in addrspace(0) implies nonnull in the backend, we don't need both attributes. However, we need to know the size of the object to use the dereferenceable attribute, so for incomplete types we still emit only nonnull. llvm-svn: 213386
* Revert "Emit lifetime.start / lifetime.end markers for unnamed temporary ↵Arnaud A. de Grandmaison2014-07-183-51/+24
| | | | | | | | | objects." This reverts commit dbf785a6432f78a8ec229665876647c4cc610d3d, while I qm investigating a buildbot failure. llvm-svn: 213380
* Emit lifetime.start / lifetime.end markers for unnamed temporary objects.Arnaud A. de Grandmaison2014-07-183-24/+51
| | | | | | This will give more information to the optimizers so that they can reuse stack slots. llvm-svn: 213379
* [OPENMP] Initial parsing and sema analysis for 'taskwait' directive.Alexey Bataev2014-07-183-0/+8
| | | | llvm-svn: 213363
* [OPENMP] Initial parsing and sema analysis for 'barrier' directive.Alexey Bataev2014-07-183-0/+8
| | | | llvm-svn: 213360
* [ARM] Fix AAPCS regression caused by r211898Oliver Stannard2014-07-181-1/+5
| | | | | | | | | | | | | r211898 introduced a regression where a large struct, which would normally be passed ByVal, was causing padding to be inserted to prevent the backend from using some GPRs, in order to follow the AAPCS. However, the type of the argument was not being set correctly, so the backend cannot align 8-byte aligned struct types on the stack. The fix is to not insert the padding arguments when the argument is being passed ByVal. llvm-svn: 213359
* [OPENMP] Initial parsing and sema analysis of 'taskyield' directive.Alexey Bataev2014-07-183-0/+8
| | | | llvm-svn: 213355
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-8/+7
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-7/+8
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* MS compatibility: always emit dllexported in-class initialized static data ↵Hans Wennborg2014-07-174-33/+17
| | | | | | | | | | | | | | members (PR20140) This makes us emit dllexported in-class initialized static data members (which are treated as definitions in MSVC), even when they're not referenced. It also makes their special linkage reflected in the GVA linkage instead of getting massaged in CodeGen. Differential Revision: http://reviews.llvm.org/D4563 llvm-svn: 213304
* [UBSan] Add !nosanitize metadata to the code generated by UBSan.Alexey Samsonov2014-07-175-18/+64
| | | | | | | | | | This is used to mark the instructions emitted by Clang to implement variety of UBSan checks. Generally, we don't want to instrument these instructions with another sanitizers (like ASan). Reviewed in http://reviews.llvm.org/D4544 llvm-svn: 213291
* Revert "Handle diagnostic warnings in Frontend diagnostic handler."Alp Toker2014-07-171-28/+12
| | | | | | | | | | | This commit is missing tests and there are a few points that need to be addressed before a new user-facing option can be added: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140714/110198.html This reverts commit r213112. llvm-svn: 213260
* IR: update Clang to use polymorphic __fp16 conversion intrinsics.Tim Northover2014-07-171-8/+15
| | | | | | There should be no change in semantics at this stage. llvm-svn: 213249
* [OPENMP] Parsing/Sema analysis of directive 'master'Alexander Musman2014-07-173-0/+8
| | | | llvm-svn: 213237
* Track the difference betweenRichard Smith2014-07-171-0/+1
| | | | | | | | | | | | -- a constructor list initialization that unpacked an initializer list into constructor arguments and -- a list initialization that created as std::initializer_list and passed it as the first argument to a constructor in the AST. Use this flag while instantiating templates to provide the right semantics for the resulting initialization. llvm-svn: 213224
* Add basic (noop) CodeGen support for __assumeHal Finkel2014-07-161-0/+3
| | | | | | | | | | | | | | Clang supports __assume, at least at the semantic level, when MS extensions are enabled. Unfortunately, trying to actually compile code using __assume would result in this error: error: cannot compile this builtin function yet __assume is an optimizer hint, and can be ignored at the IR level. Until LLVM supports assumptions at the IR level, a noop lowering is valid, and that is what is done here. llvm-svn: 213206
* Objective-C. Introducing __attribute__((objc_runtime_name("runtimename"))Fariborz Jahanian2014-07-161-112/+144
| | | | | | | | | to be applied to class or protocols. This will direct IRGen for Objective-C metadata to use the new name in various places where class and protocol names are needed. rdar:// 17631257 llvm-svn: 213167
* Handle diagnostic warnings in Frontend diagnostic handler.Tyler Nowicki2014-07-161-13/+29
| | | | | | | | | | | | Clang uses a diagnostic handler to grab diagnostic messages so it can print them with the line of source code they refer to. This patch extends this to handle diagnostic warnings that were added to llvm to produce a warning when loop vectorization is explicitly specified (using a pragma clang loop directive) but fails. Reviewed by: Aaron Ballman llvm-svn: 213112
* Add codegen for more R600 builtinsMatt Arsenault2014-07-151-1/+46
| | | | llvm-svn: 213079
* Objective-C IRGen. Fixes an inconsistant linkage ofFariborz Jahanian2014-07-151-7/+4
| | | | | | | ObC's metaclass metadata with its class metadata which results in an assert. rdar://17633301 llvm-svn: 213076
* ARM: Implement __builtin_arm_nop intrinsicYi Kong2014-07-141-0/+6
| | | | | | | | | | | This patch implements __builtin_arm_nop intrinsic for AArch32 and AArch64, which generates hint 0x0, the alias of NOP instruction. This intrinsic is necessary to implement ACLE __nop intrinsic. Differential Revision: http://reviews.llvm.org/D4495 llvm-svn: 212947
* [CMake] Update libdeps.NAKAMURA Takumi2014-07-141-0/+1
| | | | llvm-svn: 212920
* [CMake] Reorder libdeps by alphabetical order.NAKAMURA Takumi2014-07-141-1/+1
| | | | llvm-svn: 212919
* MS ABI: Stick internal vftables in a comdat if they have RTTI dataDavid Majnemer2014-07-131-6/+4
| | | | | | | | | | | | | | | Previously, we would have a private backing variable and an internal alias pointing at it. However, -fdata-sections only fires if a global variable has non-private linkage. This means that an unreferenced vftable wouldn't get discarded, bloating the object file. Instead, stick the backing variable in a comdat even if the alias has internal linkage. This will allow the linker to drop the vftable if it is unused. llvm-svn: 212901
* CodeGen: support hint intrinsics from ACLE on AArch64Saleem Abdulrasool2014-07-121-0/+25
| | | | | | | This adds support for the ACLE hint intrinsics on AArch64 similar to ARM. This is required to properly support ACLE on AArch64. llvm-svn: 212890
* Add nonnull in CodeGen for __attribute__((returns_nonnull))Hal Finkel2014-07-121-0/+2
| | | | | | | As a follow-up to r212835, also add the LLVM nonnull function attribute when __attribute__((returns_nonnull)) is provided. llvm-svn: 212874
* [ASan] Collect unmangled names of global variables in Clang to print them in ↵Alexey Samsonov2014-07-123-16/+32
| | | | | | | | | | | | | | | | | error reports. Currently ASan instrumentation pass creates a string with global name for each instrumented global (to include global names in the error report). Global name is already mangled at this point, and we may not be able to demangle it at runtime (e.g. there is no __cxa_demangle on Android). Instead, create a string with fully qualified global name in Clang, and pass it to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata for some global, ASan will use the original algorithm. This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264. llvm-svn: 212872
* CodeGen: Don't emit a thread-wrapper if we can't touch the backing variableDavid Majnemer2014-07-111-7/+23
| | | | | | | | | | | | | | | | OS X TLS has all accesses going through the thread-wrapper function and gives the backing thread-local variable internal linkage. This means that thread-wrappers must have WeakAnyLinkage so that references to the internal thread-local variables do not get propagated to other code. It also means that translation units which do not provide a definition for the thread-local variable cannot attempt to emit a thread-wrapper because the thread wrapper will attempt to reference the backing variable. Differential Revision: http://reviews.llvm.org/D4109 llvm-svn: 212841
* MS extension: Make __noop be the integer zero, not voidReid Kleckner2014-07-111-1/+2
| | | | | | | We still don't accept '__noop;', and we don't consider __noop to be the integer literal zero. More work is needed. llvm-svn: 212839
* Add nonnull in CodeGen for __attribute__((nonnull))Hal Finkel2014-07-111-0/+11
| | | | | | | | We now have an LLVM-level nonnull attribute that can be applied to function parameters, and we emit it for reference types (as of r209723), but did not emit it when an __attribute__((nonnull)) was provided. Now we will. llvm-svn: 212835
* [OPENMP] Parsing and sema analysis for 'omp task' directive.Alexey Bataev2014-07-113-0/+8
| | | | llvm-svn: 212804
* Don't assume StringRef.data() is null-terminatedBen Langmuir2014-07-111-1/+1
| | | | llvm-svn: 212790
* [UBSan] Introduce type-based blacklisting.Alexey Samsonov2014-07-103-38/+47
| | | | | | | | | Teach UBSan vptr checker to ignore technically invalud down-casts on blacklisted types. Based on http://reviews.llvm.org/D4407 by Byoungyoung Lee! llvm-svn: 212770
* Be more specific about return types of some methods.Alexey Samsonov2014-07-102-10/+12
| | | | | | | This would allow to call addCompilerUsedGlobal on some Clang-generated globals. llvm-svn: 212767
* Fix the dtor location issues in PR20038 harder.David Blaikie2014-07-103-17/+30
| | | | | | | | | | | | | Originally committed in r211722, this fixed one case of dtor calls being emitted without locations (this causes problems for debug info if the call is then inlined), this caught only some of the cases. Instead of trying to re-enable the location before the cleanup, simply re-enable the location immediately after the unconditional branches in question using a scoped device to ensure the no-location state doesn't leak out arbitrarily. llvm-svn: 212761
* [PowerPC] ABI support for aligned by-value aggregatesUlrich Weigand2014-07-101-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for respecting the ABI and type alignment of aggregates passed by value. Currently, all aggregates are aligned at 8 bytes in the parameter save area. This is incorrect for two reasons: - Aggregates that need alignment of 16 bytes or more should be aligned at 16 bytes in the parameter save area. This is implemented by using an appropriate "byval align" attribute in the IR. - Aggregates that need alignment beyond 16 bytes need to be dynamically realigned by the caller. This is implemented by setting the Realign flag of the ABIArgInfo::getIndirect call. In addition, when expanding a va_arg call accessing a type that is aligned at 16 bytes in the argument save area (either one of the aggregate types as above, or a vector type which is already aligned at 16 bytes), code needs to align the va_list pointer accordingly. Reviewed by Hal Finkel. llvm-svn: 212743
* [PowerPC] ABI support for non-Altivec vector typesUlrich Weigand2014-07-101-1/+26
| | | | | | | | | | | | | | | | | | | | | This patch adds support for passing arguments of non-Altivec vector type (i.e. defined via attribute ((vector_size (...)))) on powerpc64-linux. While such types are not mentioned in the formal ABI document, this patch implements a calling convention compatible with GCC: - Vectors of size < 16 bytes are passed in a GPR - Vectors of size > 16 bytes are passed via reference Note that vector types with a number of elements that is not a power of 2 are not supported by GCC, so there is no pre-existing ABI to follow. We choose to pass those (of size < 16) as if widened to the next power of two, so they might end up in a vector register or in a GPR. (Sizes > 16 are always passed via reference as well.) Reviewed by Hal Finkel. llvm-svn: 212734
* MS ABI: Fix __fastcall methods that return structsReid Kleckner2014-07-101-1/+9
| | | | | | | | | The sret paramater consumes the register after the implicit 'this' parameter, as with other calling conventions. Fixes PR20278, which turned out to be very easy. llvm-svn: 212669
* Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics.Alexey Samsonov2014-07-095-11/+103
| | | | | | | | | | | | | | | | Turn llvm::SpecialCaseList into a simple class that parses text files in a specified format and knows nothing about LLVM IR. Move this class into LLVMSupport library. Implement two users of this class: * DFSanABIList in DFSan instrumentation pass. * SanitizerBlacklist in Clang CodeGen library. The latter will be modified to use actual source-level information from frontend (source file names) instead of unstable LLVM IR things (LLVM Module identifier). Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils. No functionality change. llvm-svn: 212643
* Fix 'source-level' hyphenationsAlp Toker2014-07-092-2/+2
| | | | llvm-svn: 212621
* Remove unnecessary check for NULLAlexey Samsonov2014-07-081-10/+7
| | | | llvm-svn: 212564
* Move misplaced x86_32 ABI codeRichard Sandiford2014-07-081-38/+38
| | | | | | | | | | r184166 added an X86_32 function in the middle of the SystemZ code. The SystemZ port had been added only a couple of weeks earlier and the original patch probably predated that. No behavioral change intended. llvm-svn: 212524
* [OPENMP] Parsing and sema analysis for 'omp parallel sections' directive.Alexey Bataev2014-07-083-0/+9
| | | | llvm-svn: 212516
* MS ABI: "Fix" passing non-POD structs by value to variadic functionsReid Kleckner2014-07-081-20/+25
| | | | | | | | | | Of course, such code is horribly broken and will explode on impact. That said, ATL does it, and we have to support them, at least a little bit. Fixes PR20191. llvm-svn: 212508
* [ASan] Completely remove sanitizer blacklist file from instrumentation pass.Alexey Samsonov2014-07-081-4/+1
| | | | | | | | | | | | | | | | | | | | All blacklisting logic is now moved to the frontend (Clang). If a function (or source file it is in) is blacklisted, it doesn't get sanitize_address attribute and is therefore not instrumented. If a global variable (or source file it is in) is blacklisted, it is reported to be blacklisted by the entry in llvm.asan.globals metadata, and is not modified by the instrumentation. The latter may lead to certain false positives - not all the globals created by Clang are described in llvm.asan.globals metadata (e.g, RTTI descriptors are not), so we may start reporting errors on them even if "module" they appear in is blacklisted. We assume it's fine to take such risk: 1) errors on these globals are rare and usually indicate wild memory access 2) we can lazily add descriptors for these globals into llvm.asan.globals lazily. llvm-svn: 212505
* [Sanitizer] Remove brittle cache variable and slightly simplify blacklisting ↵Alexey Samsonov2014-07-075-21/+15
| | | | | | | | | | | | code. Now CodeGenFunction is responsible for looking at sanitizer blacklist (in CodeGenFunction::StartFunction) and turning off instrumentation, if necessary. No functionality change. llvm-svn: 212501
OpenPOWER on IntegriCloud