summaryrefslogtreecommitdiff
path: root/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [ubsan] Save a ptrtoint when emitting alignment checksVedant Kumar2017-10-031-5/+10
| | | | | | | The alignment check emits a ptrtoint instruction which can be reused in the call to the diagnostic handler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314749 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Capture argument of `device` clause for target-basedAlexey Bataev2017-10-021-0/+4
| | | | | | | | | | directives. The argument of the `device` clause in target-based executable directives must be captured to support codegen for the `target` directives with the `depend` clauses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314686 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Simplify codegen for non-offloading code.Alexey Bataev2017-10-021-31/+20
| | | | | | | Simplified and generalized codegen for non-offloading part that works if offloading is failed or condition of the `if` clause is `false`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314670 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Have a special function to get TBAA info for may-alias accessesIvan A. Kosarev2017-10-025-8/+23
| | | | | | | | | | This is part of D37826 reworked to be a separate patch to simplify review. Differential Revision: https://reviews.llvm.org/D38408 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314660 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Do not refer to complete TBAA info where we actually deal with ↵Ivan A. Kosarev2017-10-029-58/+62
| | | | | | | | | | | | | | | just TBAA access types This patch fixes misleading names of entities related to getting, setting and generation of TBAA access type descriptors. This is effectively an attempt to provide a review for D37826 by breaking it into smaller pieces. Differential Revision: https://reviews.llvm.org/D38404 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314657 91177308-0d34-0410-b5e6-96231b3b80d8
* [DWARF] Allow forward declarations of a class template instantiationPaul Robinson2017-09-281-0/+4
| | | | | | | | | | to have child entries describing the template parameters. This will be on by default for SCE tuning. Differential Revision: https://reviews.llvm.org/D14358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314444 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Handle address space conversion while setting type alignment.Anastasia Stulova2017-09-272-2/+12
| | | | | | | | | | | Added missing addrspacecast case in alignment computation logic of pointer type emission in IR generation. Differential Revision: https://reviews.llvm.org/D37804 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314304 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit section information for extern variables. Erich Keane2017-09-261-0/+6
| | | | | | | | | | | | | | | | | | | Currently, if _attribute_((section())) is used for extern variables, section information is not emitted in generated IR when the variables are used. This is expected since sections are not generated for external linkage objects. However NiosII requires this information as it uses special GP-relative accesses for any objects that use attribute section (.sdata). GCC keeps this attribute in middle-end. This change emits the section information for all targets. Patch By: Elizabeth Andrews Differential Revision:https://reviews.llvm.org/D36487 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314262 91177308-0d34-0410-b5e6-96231b3b80d8
* [NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.Artem Belevich2017-09-261-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D38191 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314223 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix TBAA information for reference accessesIvan A. Kosarev2017-09-261-2/+2
| | | | | | | | | | This patch fixes clang to decorate reference accesses as pointers and not as "omnipotent chars". Differential Revision: https://reviews.llvm.org/D38074 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314209 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Generate implicit map|firstprivate clauses for target-basedAlexey Bataev2017-09-263-46/+62
| | | | | | | | | | directives. If the variable is used in the target-based region but is not found in any private|mapping clause, then generate implicit firstprivate|map clauses for these implicitly mapped variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314205 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGenModule: Adapt to LLVM TargetLibraryInfo changesMatthias Braun2017-09-261-8/+2
| | | | | | | | Adapt to LLVM TargetLibraryInfo changes in r314185. See also https://reviews.llvm.org/D38106 and https://reviews.llvm.org/D37891 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314187 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow specifying sanitizers in blacklistsVlad Tsyrklevich2017-09-256-48/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the follow-up patch to D37924. This change refactors clang to use the the newly added section headers in SpecialCaseList to specify which sanitizers blacklists entries should apply to, like so: [cfi-vcall] fun:*bad_vcall* [cfi-derived-cast|cfi-unrelated-cast] fun:*bad_cast* The SanitizerSpecialCaseList class has been added to allow querying by SanitizerMask, and SanitizerBlacklist and its downstream users have been updated to provide that information. Old blacklists not using sections will continue to function identically since the blacklist entries will be placed into a '[*]' section by default matching against all sanitizers. Reviewers: pcc, kcc, eugenis, vsk Reviewed By: eugenis Subscribers: dberris, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D37925 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314171 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstall the patch "Use EmitPointerWithAlignment to get alignment ↵Wei Mi2017-09-251-8/+8
| | | | | | | | | | | | | | | information of the pointer used in atomic expr" after fixing PR31620. 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314145 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[NVPTX] added match.{any,all}.sync instructions, intrinsics & ↵Justin Lebar2017-09-251-15/+0
| | | | | | | | | | | | | | | builtins.", rL314135. Causing assertion failures on macos: > Assertion failed: (Num < NumOperands && "Invalid child # of SDNode!"), > function getOperand, file > /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm/include/llvm/CodeGen/SelectionDAGNodes.h, > line 835. http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42739/testReport/LLVM/CodeGen_NVPTX/surf_read_cuda_ll/ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314142 91177308-0d34-0410-b5e6-96231b3b80d8
* [NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.Artem Belevich2017-09-251-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D38191 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314135 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence unused variable warning in Release builds.Benjamin Kramer2017-09-231-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314066 91177308-0d34-0410-b5e6-96231b3b80d8
* Promote storage-only __fp16 vector operands to float vectors.Akira Hatanaka2017-09-231-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a bug in the handling of storage-only __fp16 vectors where clang didn't promote __fp16 vector operands to float vectors. Conceptually, it performs the following transformation on the AST in CreateBuiltinBinOp and CreateBuiltinUnaryOp: (Before) typedef __fp16 half4 __attribute__ ((vector_size (8))); typedef float float4 __attribute__ ((vector_size (16))); half4 hv0, hv1, hv2, hv3; hv0 = hv1 + hv2 + hv3; (After) float4 t0 = (float4)hv1 + (float4)hv2; float4 t1 = t0 + (float4)hv3; hv0 = (half4)t1; Note that this commit fixes the bug for targets that set HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics such as llvm.convert.to.fp16 to handle __fp16 are still broken. rdar://problem/20625184 Differential Revision: https://reviews.llvm.org/D32520 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314056 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-231-4/+3
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314050 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen][ObjC] Build the global block structure before emitting theAkira Hatanaka2017-09-222-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | body of global block invoke functions. This commit fixes an infinite loop in IRGen that occurs when compiling the following code: void FUNC2() { static void (^const block1)(int) = ^(int a){ if (a--) block1(a); }; } This is how IRGen gets stuck in the infinite loop: 1. GenerateBlockFunction is called to emit the body of "block1". 2. GetAddrOfGlobalBlock is called to get the address of "block1". The function calls getAddrOfGlobalBlockIfEmitted to check whether the global block has been emitted. If it hasn't been emitted, it then tries to emit the body of the block function by calling GenerateBlockFunction, which goes back to step 1. This commit prevents the inifinite loop by building the global block in GenerateBlockFunction before emitting the body of the block function. rdar://problem/34541684 Differential Revision: https://reviews.llvm.org/D38118 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314029 91177308-0d34-0410-b5e6-96231b3b80d8
* [Coverage] Add an option to emit limited coverage infoVedant Kumar2017-09-221-0/+8
| | | | | | | | | | | | | | | | | | | | | Add an option to emit limited coverage info for unused decls. It's just a cl::opt for now to allow us to experiment quickly. When building llc, this results in an 84% size reduction in the llvm_covmap section, and a similar size reduction in the llvm_prf_names section. In practice I expect the size reduction to be roughly quadratic with the size of the program. The downside is that coverage for headers will no longer be complete. This will make the line/function/region coverage metrics incorrect, since they will be artificially high. One mitigation would be to somehow disable those metrics when using limited-coverage=true. This is related to: llvm.org/PR34533 (make SourceBasedCodeCoverage scale) Differential Revision: https://reviews.llvm.org/D38107 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314002 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Handle re-declaration of captured variables in CodeGen.Alexey Bataev2017-09-221-3/+3
| | | | | | | | | If the captured variable has re-declaration we may end up with the situation where the captured variable is the re-declaration while the referenced variable is the canonical declaration (or vice versa). In this case we may generate wrong code. Patch fixes this situation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313995 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-221-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. This recommits r313722, which was reverted in r313725 because clang couldn't build compiler-rt. It failed to build because there were function declarations that were missing 'noescape'. That has been fixed in r313929. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313945 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSan] Disable sanitization for __sanitizer_dtor_callback.Matt Morehouse2017-09-201-0/+1
| | | | | | | | | | | | | | | | Summary: Eliminate unnecessary instrumentation at __sanitizer_dtor_callback call sites. Fixes https://github.com/google/sanitizers/issues/861. Reviewers: eugenis, kcc Reviewed By: eugenis Subscribers: vitalybuka, llvm-commits, cfe-commits, hiraditya Differential Revision: https://reviews.llvm.org/D38063 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313831 91177308-0d34-0410-b5e6-96231b3b80d8
* 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'). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313725 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313722 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-201-8/+1
| | | | | | | | This reverts r313717. I closed the wrong phabricator review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313721 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313720 91177308-0d34-0410-b5e6-96231b3b80d8
* Add override for ClangDiagnosticHandler::isAnyRemarkEnabled()Adam Nemet2017-09-191-0/+6
| | | | | | | This is used by the new closure-based variant of OptimizationRemarkEmitter::emit(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313693 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach clang to tolerate the 'p = nullptr + n' idiom used by glibcAndrew Kaylor2017-09-191-0/+24
| | | | | | | | Differential Revision: https://reviews.llvm.org/D37042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313666 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313653 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313603 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313598 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313430 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313418 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313402 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313389 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313192 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313186 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313133 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313096 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313078 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS-InlineAsm] Fix cast assertion with vector spills (PR34021)Simon Pilgrim2017-09-121-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D37448 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313019 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312965 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312947 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312897 91177308-0d34-0410-b5e6-96231b3b80d8
* clang fix for LLVM API change: isKnownNonNull -> isKnownNonZeroNuno Lopes2017-09-091-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D37628 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312870 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312835 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312830 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312818 91177308-0d34-0410-b5e6-96231b3b80d8