summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-201-8/+1
| | | | | | | | | | This reverts commit r313722. It looks like compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc cannot be compiled because some of the functions declared in the file do not match the ones in the SDK headers (which are annotated with 'noescape'). llvm-svn: 313725
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-201-1/+8
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 llvm-svn: 313722
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-201-8/+1
| | | | | | | | This reverts r313717. I closed the wrong phabricator review. llvm-svn: 313721
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-201-1/+8
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32520 llvm-svn: 313720
* Add override for ClangDiagnosticHandler::isAnyRemarkEnabled()Adam Nemet2017-09-191-0/+6
| | | | | | | This is used by the new closure-based variant of OptimizationRemarkEmitter::emit(). llvm-svn: 313693
* Teach clang to tolerate the 'p = nullptr + n' idiom used by glibcAndrew Kaylor2017-09-191-0/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D37042 llvm-svn: 313666
* Fix ClangDiagnosticHandler::is*RemarkEnabled membersAdam Nemet2017-09-191-4/+5
| | | | | | | Apparently these weren't really working. I added test coverage and fixed the typo in the name and the parameter. llvm-svn: 313653
* [Coverage] Remove deferred region for trailing return, fixes PR34611Vedant Kumar2017-09-191-1/+7
| | | | | | | | As a special case, throw away deferred regions for trailing returns. This allows the closing curly brace to have a count, and is less distracting. llvm-svn: 313603
* [Coverage] Use a new API to label gap areasVedant Kumar2017-09-181-5/+25
| | | | | | | This will make it possible for llvm-cov to pick better line execution counts, and is part of the fix for llvm.org/PR34612. llvm-svn: 313598
* [WebAssembly] Restore __builtin_wasm_rethrow builtinHeejin Ahn2017-09-161-0/+4
| | | | | | | | | | | | | | | | Summary: Restore the `__builtin_wasm_rethrow` builtin deleted in D37931. On second thought, it appears it can be used to implement `__cxa_rethrow`. Reviewers: dschuff, sunfish Reviewed By: dschuff Subscribers: jfb, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D37942 llvm-svn: 313430
* [X86] Use native shuffle vector for the perm2f128 intrinsicsCraig Topper2017-09-151-0/+39
| | | | | | | | | | This patch replaces the perm2f128 intrinsics with native shuffle vectors. This uses a pretty simple approach to allocate source 0 to the lower half input and source 1 to the upper half input. Then its just a matter of filling in the indices to use either the lower or upper half of that specific source. This can result in the same source being used by both operands. InstCombine or SelectionDAGBuilder should be able to clean that up. Differential Revision: https://reviews.llvm.org/D37892 llvm-svn: 313418
* Remove __builtin_wasm_rethrow builtinHeejin Ahn2017-09-151-4/+0
| | | | | | | | | | | | | | | | | Summary: Remove `__builtin_wasm_rethrow` builtin. I thought it was required to implement `__cxa_rethrow` function in libcxxabi, but it turned out it will be using `__builtin_wasm_throw` instead. Reviewers: dschuff, jgravelle-google Reviewed By: jgravelle-google Subscribers: jfb, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D37931 llvm-svn: 313402
* This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 LLVM code ↵Vivek Pandya2017-09-151-9/+34
| | | | | | change is as per https://reviews.llvm.org/D33514 llvm-svn: 313389
* Mark static member functions as static in CodeViewDebugAdrian McCarthy2017-09-131-0/+2
| | | | | | | | | | | | | | Summary: To improve CodeView quality for static member functions, we need to make the static explicit. In addition to a small change in LLVM's CodeViewDebug to return the appropriate MethodKind, this requires a small change in Clang to note the staticness in the debug info metadata. Subscribers: aprantl, hiraditya Differential Revision: https://reviews.llvm.org/D37715 llvm-svn: 313192
* [OPENMP] Fix types for the target specific parameters in debug mode.Alexey Bataev2017-09-131-3/+3
| | | | | | | Used incorrect types for target specific parameters in debug mode, should use original pointers rather than the pointee types. llvm-svn: 313186
* [X86] [PATCH] [intrinsics] Lowering X86 ABS intrinsics to IR. (clang)Uriel Korach2017-09-131-0/+26
| | | | | | | | This patch, together with a matching llvm patch (https://reviews.llvm.org/D37693), implements the lowering of X86 ABS intrinsics to IR. Differential Revision: https://reviews.llvm.org/D37694 llvm-svn: 313133
* [ubsan] Function Sanitizer: Don't require writable text segmentsVedant Kumar2017-09-134-19/+60
| | | | | | | | | | | | | | | | | | This change will make it possible to use -fsanitize=function on Darwin and possibly on other platforms. It fixes an issue with the way RTTI is stored into function prologue data. On Darwin, addresses stored in prologue data can't require run-time fixups and must be PC-relative. Run-time fixups are undesirable because they necessitate writable text segments, which can lead to security issues. And absolute addresses are undesirable because they break PIE mode. The fix is to create a private global which points to the RTTI, and then to encode a PC-relative reference to the global into prologue data. Differential Revision: https://reviews.llvm.org/D37597 llvm-svn: 313096
* IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.Peter Collingbourne2017-09-121-1/+2
| | | | | | | | This allows the flag to be persisted through to LTO. Differential Revision: https://reviews.llvm.org/D37655 llvm-svn: 313078
* [MS-InlineAsm] Fix cast assertion with vector spills (PR34021)Simon Pilgrim2017-09-121-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D37448 llvm-svn: 313019
* [codeview] omit debug locations for nested exprs unless column info enabledBob Haarman2017-09-113-0/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: Microsoft Visual Studio expects debug locations to correspond to statements. We used to emit locations for expressions nested inside statements. This would confuse the debugger, causing it to stop multiple times on the same line and breaking the "step into specific" feature. This change inhibits the emission of debug locations for nested expressions when emitting CodeView debug information, unless column information is enabled. Fixes PR34312. Reviewers: rnk, zturner Reviewed By: rnk Subscribers: majnemer, echristo, aprantl, cfe-commits Differential Revision: https://reviews.llvm.org/D37529 llvm-svn: 312965
* [Lexer] Report more precise skipped regions (PR34166)Vedant Kumar2017-09-112-2/+2
| | | | | | | | | | | | | | | | | | | | This patch teaches the preprocessor to report more precise source ranges for code that is skipped due to conditional directives. The new behavior includes the '#' from the opening directive and the full text of the line containing the closing directive in the skipped area. This matches up clang's behavior (we don't IRGen the code between the closing "endif" and the end of a line). This also affects the code coverage implementation. See llvm.org/PR34166 (this also happens to be rdar://problem/23224058). The old behavior (report the end of the skipped range as the end location of the 'endif' token) is preserved for indexing clients. Differential Revision: https://reviews.llvm.org/D36642 llvm-svn: 312947
* Revert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get ↵Daniel Jasper2017-09-111-8/+8
| | | | | | | | | alignment information of the pointer used in atomic expr"." This triggers llvm.org/PR31620 in several of our internal builds. I'll forward reproduction instructions to the original author. llvm-svn: 312897
* clang fix for LLVM API change: isKnownNonNull -> isKnownNonZeroNuno Lopes2017-09-091-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D37628 llvm-svn: 312870
* CodeGen: correct arguments for NSFastEnumerationSaleem Abdulrasool2017-09-081-16/+14
| | | | | | | | | | | | | | | When performing a NSFastEnumeration, the compiler synthesizes a call to `countByEnumeratingWithState:objects:count:` where the `count` parameter is of type `NSUInteger` and the return type is a `NSUInteger`. We would previously always use a `UnsignedLongTy` for the `NSUInteger` type. On 32-bit targets, `long` is 32-bits which is the same as `unsigned int`. Most 64-bit targets are LP64, where `long` is 64-bits. However, on LLP64 targets, such as Windows, `long` is 32-bits. Introduce new `getNSUIntegerType` and `getNSIntegerType` helpers to allow us to determine the correct type for the `NSUInteger` type. Wire those through into the generation of the message dispatch to the selector. llvm-svn: 312835
* Reinstall the patch "Use EmitPointerWithAlignment to get alignment ↵Wei Mi2017-09-081-8/+8
| | | | | | | | | | | | | | information of the pointer used in atomic expr". This is to fix PR34347. EmitAtomicExpr now only uses alignment information from Type, instead of Decl, so when the declaration of an atomic variable is marked to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment to get the precise alignment information. Differential Revision: https://reviews.llvm.org/D37310 llvm-svn: 312830
* [Coverage] Precise region termination with deferred regions (reapply)Vedant Kumar2017-09-081-5/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current coverage implementation doesn't handle region termination very precisely. Take for example an `if' statement with a `return': void f() { if (true) { return; // The `if' body's region is terminated here. } // This line gets the same coverage as the `if' condition. } If the function `f' is called, the line containing the comment will be marked as having executed once, which is not correct. The solution here is to create a deferred region after terminating a region. The deferred region is completed once the start location of the next statement is known, and is then pushed onto the region stack. In the cases where it's not possible to complete a deferred region, it can safely be dropped. Testing: lit test updates, a stage2 coverage-enabled build of clang This is a reapplication but there are no changes from the original commit. With D36813, the segment builder in llvm will be able to handle deferred regions correctly. llvm-svn: 312818
* Revert rL312801 since it generated some calls from libatomic and broke some ↵Wei Mi2017-09-081-8/+8
| | | | | | tests. llvm-svn: 312805
* Use EmitPointerWithAlignment to get alignment information of the pointer ↵Wei Mi2017-09-081-8/+8
| | | | | | | | | | | | | | used in atomic expr. This is to fix PR34347. EmitAtomicExpr now only uses alignment information from Type, instead of Decl, so when the declaration of an atomic variable is marked to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment to get the precise alignment information. Differential Revision: https://reviews.llvm.org/D37310 llvm-svn: 312801
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-084-1/+9
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Updated two annotations for Store.h and CodeGenFunction.h.Krasimir Georgiev2017-09-081-2/+1
| | | | | | | | | | | | | | | | | | Summary: 1.Updated annotations for include/clang/StaticAnalyzer/Core/PathSensitive/Store.h, which belong to the old version of clang. 2.Delete annotations for CodeGenFunction::getEvaluationKind() in clang/lib/CodeGen/CodeGenFunction.h, which belong to the old version of clang. Reviewers: bkramer, krasimir, klimek Reviewed By: bkramer Subscribers: MTC Differential Revision: https://reviews.llvm.org/D36330 Contributed by @MTC! llvm-svn: 312790
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-084-9/+1
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-084-1/+9
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* [OpenCL] Add half load and store builtinsJan Vesely2017-09-071-0/+18
| | | | | | | | This enables load/stores of half type, without half being a legal type. Differential Revision: https://reviews.llvm.org/D37231 llvm-svn: 312742
* [OPENMP] Fix for PR33922: New ident_t flags forAlexey Bataev2017-09-063-7/+20
| | | | | | | | | | | | __kmpc_for_static_fini(). Added special flags for calls of __kmpc_for_static_fini(), like previous ly for __kmpc_for_static_init(). Added flag OMP_IDENT_WORK_DISTRIBUTE for distribute cnstruct, OMP_IDENT_WORK_SECTIONS for sections-based constructs and OMP_IDENT_WORK_LOOP for loop-based constructs in location flags. llvm-svn: 312642
* [OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime inAlexey Bataev2017-09-061-2/+12
| | | | | | | | | | move constructor. Previously user-defined reduction initializer was considered as an assignment expression, not as initializer. Fixed this by treating the initializer expression as an initializer. llvm-svn: 312638
* Debug info: Fixed faulty debug locations for attributed statementsKarl-Johan Karlsson2017-09-062-28/+12
| | | | | | | | | | | | | | | | | Summary: As the attributed statements are considered simple statements no stoppoint was generated before emitting attributed do/while/for/range- statement. This lead to faulty debug locations. Reviewers: echristo, aaron.ballman, dblaikie Reviewed By: dblaikie Subscribers: bjope, aprantl, cfe-commits Differential Revision: https://reviews.llvm.org/D37428 llvm-svn: 312623
* Commit changes missing from r312572Reid Kleckner2017-09-051-1/+1
| | | | llvm-svn: 312573
* [ms] Implement the __annotation intrinsicReid Kleckner2017-09-051-0/+23
| | | | llvm-svn: 312572
* Emit static constexpr member as available_externally definitionMehdi Amini2017-09-051-0/+42
| | | | | | | | | | | | | | | | | | By exposing the constant initializer, the optimizer can fold many of these constructs. This is a recommit of r311857 that was reverted in r311898 because an assert was hit when building Chromium. We have to take into account that the GlobalVariable may be first created with a different type than the initializer. This can happen for example when the variable is a struct with tail padding while the initializer does not have padding. In such case, the variable needs to be destroyed an replaced with a new one with the type of the initializer. Differential Revision: https://reviews.llvm.org/D34992 llvm-svn: 312512
* [CodeGen] Treat all vector fields as mayaliasHal Finkel2017-09-031-2/+2
| | | | | | | | | | | | | | | Because it is common to treat vector types as an array of their elements, or even some other type that's not the element type, and thus index into them, we can't use struct-path TBAA for these accesses. Even though we already treat all vector types as equivalent to 'char', we were using field-offset information for them with TBAA, and this renders undefined the intra-value indexing we intend to allow. Note that, although 'char' is universally aliasing, with path TBAA, we can still differentiate between access to s.a and s.b in struct { char a, b; } s;. We can't use this capability as-is for vector types. Fixes PR33967. llvm-svn: 312447
* [OpenCL] Do not use vararg in emitted functions for enqueue_kernelYaxun Liu2017-09-031-19/+40
| | | | | | | | | | Not all targets support vararg (e.g. amdgpu). Instead of using vararg in the emitted functions for enqueue_kernel, this patch creates a temporary array of size_t, stores the size arguments in the temporary array and passes it to the emitted functions for enqueue_kernel. Differential Revision: https://reviews.llvm.org/D36678 llvm-svn: 312441
* [CodeGen]Refactor CpuSupports/CPUIs Builtin Code Gen to better work with Erich Keane2017-09-012-114/+133
| | | | | | | | | | | | | | | | | | | | "target" implementation A small set of refactors that'll make it easier for me to implement 'target' support. First, extract the CPUSupports functionality into its own function. THis has the advantage of not wasting time in this builtin to deal with arguments. Second, pulls both CPUSupports and CPUIs implementation into a member-function, so that it can be called from the resolver generation that I'm working on. Third, creates an overload that takes simply the feature/cpu name (rather than extracting it from a callexpr), since that info isn't available later. Note that despite how the 'diff' looks, the EmitX86CPUSupports function simply takes the implementation out of the 'switch'. llvm-svn: 312355
* Reland r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI ↵Martin Storsjo2017-09-011-9/+7
| | | | | | | | | | | | | | | | | data on MinGW This fixes cases where dynamic classes produced RTTI data with external linkage, producing linker errors about duplicate symbols. This touches code close to what was changed in SVN r244266, but this change doesn't break the tests added in that revision. The previous version had missed to update CodeGenCXX/virt-dtor-key.cpp, which had a behaviour change only when running the testsuite on windows. Differential revision: https://reviews.llvm.org/D37327 llvm-svn: 312306
* Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI ↵Martin Storsjo2017-08-311-7/+9
| | | | | | | | | | | | | | data on MinGW" Breaks on buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4548/steps/test-check-all/logs/stdio The test in CodeGenCXX/virt-dtor-key.cpp tests using %itanium_abi_triple; on non-windows platforms, this resolves to the current platform triple (where there was no behaviour change), while on windows, it resolves to a mingw triple (where the behaviour was intentionally changed). llvm-svn: 312229
* [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGWMartin Storsjo2017-08-311-9/+7
| | | | | | | | | | | | This fixes cases where dynamic classes produced RTTI data with external linkage, producing linker errors about duplicate symbols. This touches code close to what was changed in SVN r244266, but this change doesn't break the tests added in that revision. Differential revision: https://reviews.llvm.org/D37206 llvm-svn: 312224
* [CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64Erich Keane2017-08-301-0/+18
| | | | | | | | | | | | | This attribute is useful in OS development when we jump from 32 to 64 bit code and expect that 64bit function forces correct stack alignment. Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html Patch By: anatol.pomozov (anatol.pomozov@gmail.com) Differential Revision:https://reviews.llvm.org/D36272 llvm-svn: 312173
* Minimal runtime for UBSan.Evgeniy Stepanov2017-08-291-22/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An implementation of ubsan runtime library suitable for use in production. Minimal attack surface. * No stack traces. * Definitely no C++ demangling. * No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general. * as simple as possible Minimal CPU and RAM overhead. * Source locations unnecessary in the presence of (split) debug info. * Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at. * above two items save 3% binary size. When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt. Reviewers: pcc, kcc Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D36810 llvm-svn: 312029
* Revert r311857 "Emit static constexpr member as available_externally definition"Hans Wennborg2017-08-281-22/+0
| | | | | | | | | | | | | It caused PR759744. > Emit static constexpr member as available_externally definition > > By exposing the constant initializer, the optimizer can fold many > of these constructs. > > Differential Revision: https://reviews.llvm.org/D34992 llvm-svn: 311898
* [X86] Add support for __builtin_cpu_initCraig Topper2017-08-281-3/+9
| | | | | | | | | | This adds builtin_cpu_init which will emit a call to cpu_indicator_init in libgcc or compiler-rt. This is needed to support builtin_cpu_supports/builtin_cpu_is in an ifunc resolver. Differential Revision: https://reviews.llvm.org/D36336 llvm-svn: 311874
* Emit static constexpr member as available_externally definitionMehdi Amini2017-08-271-0/+22
| | | | | | | | | By exposing the constant initializer, the optimizer can fold many of these constructs. Differential Revision: https://reviews.llvm.org/D34992 llvm-svn: 311857
OpenPOWER on IntegriCloud