summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* add __builtin_unpredictable and convert to metadataSanjay Patel2015-09-022-1/+24
| | | | | | | | | | | | | | | | | | | | | | | This patch depends on r246688 (D12341). The goal is to make LLVM generate different code for these functions for a target that has cheap branches (see PR23827 for more details): int foo(); int normal(int x, int y, int z) { if (x != 0 && y != 0) return foo(); return 1; } int crazy(int x, int y) { if (__builtin_unpredictable(x != 0 && y != 0)) return foo(); return 1; } Differential Revision: http://reviews.llvm.org/D12458 llvm-svn: 246699
* [OpenMP] Make helper functoin static. NFC.Benjamin Kramer2015-09-021-1/+1
| | | | llvm-svn: 246657
* Migrate the target attribute parsing code into an extension off ofEric Christopher2015-09-021-29/+8
| | | | | | | | | | the main attribute and cache the results so we don't have to parse a single attribute more than once. This reapplies r246596 with a fix for an uninitialized class member, and a couple of cleanups and formatting changes. llvm-svn: 246610
* Revert "Migrate the target attribute parsing code into an extension off of"Eric Christopher2015-09-011-8/+29
| | | | | | | | This is failing in release mode. Revert while I figure out what's happening. This reverts commit r246596. llvm-svn: 246598
* Migrate the target attribute parsing code into an extension off ofEric Christopher2015-09-011-29/+8
| | | | | | | the main attribute and cache the results so we don't have to parse a single attribute more than once. llvm-svn: 246596
* Use hasAttr, not getAttr if we're just checking for presence.Eric Christopher2015-09-011-1/+1
| | | | llvm-svn: 246595
* [PowerPC] Support __builtin_ppc_get_timebaseHal Finkel2015-08-311-0/+5
| | | | | | | | | | GCC 4.8+ has a PowerPC-specific intrinsic, __builtin_ppc_get_timebase, to do what Clang's __builtin_readcyclecounter does. For compatibility with code that uses GCC's spelling (including glibc), support it as well. Partially fixes PR23681. llvm-svn: 246510
* Revert "Pull the target attribute parsing out of CGCall and onto TargetInfo."Eric Christopher2015-08-311-9/+35
| | | | | | This reverts commit r246468 while we figure out what to do about Basic and AST. llvm-svn: 246508
* Pull the target attribute parsing out of CGCall and onto TargetInfo.Eric Christopher2015-08-311-35/+9
| | | | | | | | | Also: - Add a typedef to make working with the result easier. - Update callers to use the new function. - Make initFeatureMap out of line. llvm-svn: 246468
* [CUDA] fix codegen for __nvvm_atom_min/max_gen_u*Jingyue Wu2015-08-311-2/+6
| | | | | | | | | | | | Summary: Clang should emit "atomicrmw umin/umax" instead of "atomicrmw min/max". Reviewers: eliben, tra Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12487 llvm-svn: 246455
* PR17829: Proper diagnostic of mangled names conflictsAndrey Bokhanko2015-08-314-98/+154
| | | | | | | | | | Proper diagnostic and resolution of mangled names conflicts between C++ methods and C functions. This patch implements support for functions/methods only; support for variables is coming separately. Differential Revision: http://reviews.llvm.org/D11297 llvm-svn: 246438
* [OPENMP 4.0] Codegen for array sections.Alexey Bataev2015-08-313-7/+193
| | | | | | Added codegen for array section in 'depend' clause of 'task' directive. It emits to pointers, one for the begin of array section and another for the end of array section. Size of the section is calculated as (end + 1 - start) * sizeof(basic_element_type). llvm-svn: 246422
* [OpenMP] Make the filetered clause iterator a real iterator and type safe.Benjamin Kramer2015-08-301-64/+42
| | | | | | | | | This replaces the filtered generic iterator with a type-specfic one based on dyn_cast instead of comparing the kind enum. This allows us to use range-based for loops and eliminates casts. No functionality change intended. llvm-svn: 246384
* Allow TLS vars in dllimport/export functions; only inline dllimport ↵Hans Wennborg2015-08-281-0/+38
| | | | | | | | | | | | | | | | | | | | | functions when safe (PR24593) This patch does two things: 1) Don't error about dllimport/export on thread-local static local variables. We put those attributes on static locals in dllimport/export functions implicitly in case the function gets inlined. Now, for TLS variables this is a problem because we can't import such variables, but it's a benign problem becase: 2) Make sure we never inline a dllimport function TLS static locals. In fact, never inline a dllimport function that references a non-imported function or variable (because these are not defined in the importing library). This seems to match MSVC's behaviour. Differential Revision: http://reviews.llvm.org/D12422 llvm-svn: 246338
* Revert "[OPENMP 4.0] Codegen for array sections."Daniel Jasper2015-08-283-169/+7
| | | | | | | The test is currently failing on bots: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/12747/ llvm-svn: 246288
* Revert r246214 and r246213Steven Wu2015-08-287-235/+120
| | | | | | These two commits causes llvm LTO bootstrap to hang in ScalarEvolution. llvm-svn: 246282
* [OPENMP 4.0] Codegen for array sections.Alexey Bataev2015-08-283-7/+169
| | | | | | Added codegen for array section in 'depend' clause of 'task' directive. It emits to pointers, one for the begin of array section and another for the end of array section. Size of the section is calculated as (end + 1 - start) * sizeof(basic_element_type). llvm-svn: 246278
* Merge the two feature map setting functions into a single functionEric Christopher2015-08-281-2/+1
| | | | | | and replace all callers. llvm-svn: 246259
* CGDebugInfo: Instead of uniquing RetainedTypes, just refrain from retainingAdrian Prantl2015-08-271-6/+7
| | | | | | them more than once. (NFC) llvm-svn: 246231
* Use an explicit assignment.Eric Christopher2015-08-271-2/+2
| | | | llvm-svn: 246225
* Assume loads fix #2Piotr Padlewski2015-08-275-11/+18
| | | | | | | | | | | | | There was linker problem, and it turns out that it is not always safe to refer to vtable. If the vtable is used, then we can refer to it without any problem, but because we don't know when it will be used or not, we can only check if vtable is external or it is safe to to emit it speculativly (when class it doesn't have any inline virtual functions). It should be fixed in the future. http://reviews.llvm.org/D12385 llvm-svn: 246214
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-276-110/+218
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 246213
* CGDebugInfo: Factor out a getOrCreateStandaloneType() method.Adrian Prantl2015-08-272-3/+18
| | | | | | | | | | | Usually debug info is created on the fly while during codegen. With this API it becomes possible to create standalone debug info for types that are not referenced by any code, such as emitting debug info for a clang module or for implementing something like -gfull. Because on-the-fly debug info generation may still insert retained types on top of them, all RetainedTypes are uniqued in CGDebugInfo::finalize(). llvm-svn: 246210
* Target attribute syntax compatibility fix - gcc uses no- rather than mno-.Eric Christopher2015-08-271-1/+1
| | | | llvm-svn: 246197
* Rewrite the code generation handling for function feature and cpu attributes.Eric Christopher2015-08-271-62/+70
| | | | | | | | | | | | | | | | | | | | A couple of changes here: a) Do less work in the case where we don't have a target attribute on the function. We've already canonicalized the attributes for the function - no need to do more work. b) Use the newer canonicalized feature adding functions from TargetInfo to do the work when we do have a target attribute. This enables us to diagnose some warnings in the case of conflicting written attributes (only ppc does this today) and also make sure to get all of the features for a cpu that's listed rather than just change the cpu. Updated all testcases accordingly and added a new testcase to verify that we'll error out on ppc if we have some incompatible options using the existing diagnosis framework there. llvm-svn: 246195
* Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1Adrian Prantl2015-08-273-0/+3
| | | | | | | | | | | | | to enable the use of external type references in the debug info (a.k.a. module debugging). The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs" and passes that to cc1. All this does at the moment is set a flag codegenopts. http://reviews.llvm.org/D11958 llvm-svn: 246192
* DI: Clarify meaning of createTempFunctionFwdDecl() arg, NFCDuncan P. N. Exon Smith2015-08-261-1/+1
| | | | | | | | I stared at `false /*declaration*/` for quite some time before giving up and checking the actual function to see what it meant. Replacing with `/* isDefinition = */ false` to save myself effort later. llvm-svn: 246095
* [X86][SSE] Add _mm_undefined_* intrinsicsSimon Pilgrim2015-08-261-0/+4
| | | | | | | | | | | | | | | | Added missing SSE/AVX 'undefined' intrinsics (PR24040): _mm_undefined_pd, _mm_undefined_ps + _mm_undefined_si128 _mm256_undefined_pd, _mm256_undefined_ps + _mm256_undefined_si256 _mm512_undefined, _mm512_undefined_ps, _mm512_undefined_pd + _mm512_undefined_epi32 Added builtin intrinsicss: __builtin_ia32_undef128, __builtin_ia32_undef256 + __builtin_ia32_undef512 Differential Revision: http://reviews.llvm.org/D12052 llvm-svn: 246083
* Revert r245879. Speculative, might have caused crbug.com/524604Nico Weber2015-08-252-1/+16
| | | | llvm-svn: 245965
* Convert SampleProfile pass into a Module pass.Diego Novillo2015-08-251-12/+3
| | | | | | | | | | | Eventually, we will need sample profiles to be incorporated into the inliner's cost models. To do this, we need the sample profile pass to be a module pass. This patch makes no functional changes beyond the mechanical adjustments needed to run SampleProfile as a module pass. llvm-svn: 245941
* [ARM NEON] Use CGF cached Types instead of llvm::Type::get. NFC.Ahmed Bougacha2015-08-241-13/+11
| | | | llvm-svn: 245906
* [ARM NEON] Replace redundant code with a new GetFloatNeonType. NFC.Ahmed Bougacha2015-08-241-63/+22
| | | | llvm-svn: 245904
* [MS ABI] Don't emit stackrestore in cleanupsDavid Majnemer2015-08-242-16/+1
| | | | | | The stackrestore intrinsic isn't meaningful inside of a cleanup funclet. llvm-svn: 245879
* [WinEH] Update to new EH pad/ret signatures (with tokens required)Joseph Tremoulet2015-08-233-8/+6
| | | | | | | | | | | | | | | Summary: The signatures of the methods in LLVM for creating EH pads/rets are changing to require token arguments on rets and assume token return type on pads. Update creation code accordingly. Reviewers: majnemer, rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12109 llvm-svn: 245798
* [CUDA] Change initializer for CUDA device code based on CUDA documentation.Jingyue Wu2015-08-221-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: According to CUDA documentation, global variables declared with __device__, __constant__ can be initialized from host code, so mark them as externally initialized. Because __shared__ variables cannot have an initialization as part of their declaration and since the value maybe kept across different kernel invocation, the value of __shared__ is effectively undefined instead of zero initialized. Wrongly using zero initializer may cause illegitimate optimization, e.g. removing unused __constant__ variable because it's not updated in the device code and the value is initialized with zero. Test Plan: test/CodeGenCUDA/address-spaces.cu Patch by Xuetian Weng Reviewers: jholewinski, eliben, tra, jingyue Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12241 llvm-svn: 245786
* [ARM NEON] Use the common naming scheme for vcvt f16 builtins. NFC.Ahmed Bougacha2015-08-211-2/+2
| | | | | | | | | | | We had "vcvt_f16" and "VCVT_HIGH_F16": for other FP types, this naming is used for intrinsics with integer overloads. The FP->FP conversions, on the other hand, use the full "vcvt_f32_f64" name instead. Use the same naming convention for the f16<->f32 conversions. While there, reorder the definitions a little bit. llvm-svn: 245763
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Piotr Padlewski2015-08-216-218/+110
| | | | | | | | Reverting because of 245721 This reverts commit 552658e2b60543c928030b09cc9b5dfcb40c3f28. llvm-svn: 245727
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-216-110/+218
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 245721
* Properly provide alignment of 'byval' arguments down to llvm.James Y Knight2015-08-211-3/+18
| | | | | | | | | This is important in the case that the LLVM-inferred llvm-struct alignment is not the same as the clang-known C-struct alignment. Differential Revision: http://reviews.llvm.org/D12243 llvm-svn: 245719
* [OPENMP 4.1] Add codegen for 'simdlen' clause.Alexey Bataev2015-08-211-4/+14
| | | | | | | | | Add emission of metadata for simd loops in presence of 'simdlen' clause. If 'simdlen' clause is provided without 'safelen' clause, the vectorizer width for the loop is set to value of 'simdlen' clause + all read/write ops in loop are marked with '!llvm.mem.parallel_loop_access' metadata. If 'simdlen' clause is provided along with 'safelen' clause, the vectorizer width for the loop is set to value of 'simdlen' clause + all read/write ops in loop are not marked with '!llvm.mem.parallel_loop_access' metadata. If 'safelen' clause is provided without 'simdlen' clause, the vectorizer width for the loop is set to value of 'safelen' clause + all read/write ops in loop are not marked with '!llvm.mem.parallel_loop_access' metadata. llvm-svn: 245697
* [OPENMP 4.1] Initial support for 'simdlen' clause.Alexey Bataev2015-08-211-0/+1
| | | | | | Add parsing/sema analysis for 'simdlen' clause in simd directives. Also add check that if both 'safelen' and 'simdlen' clauses are specified, the value of 'simdlen' parameter is less than the value of 'safelen' parameter. llvm-svn: 245692
* Generating available_externally vtables bugfixPiotr Padlewski2015-08-191-6/+4
| | | | | | | | Bugfix revealed in r245264. http://reviews.llvm.org/D12128 llvm-svn: 245489
* [modules] Don't eagerly deserialize so many ImportDecls. CodeGen basically ↵Richard Smith2015-08-191-5/+2
| | | | | | ignores ImportDecls imported from modules, so only eagerly deserialize the ones from a PCH / preamble. llvm-svn: 245406
* Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed ↵David Blaikie2015-08-1813-44/+44
| | | | | | polymorphically llvm-svn: 245378
* Fix for MSVCDavid Blaikie2015-08-181-1/+1
| | | | llvm-svn: 245368
* Wdeprecated: Support movability of EHScopeStack::Cleanup objects as they are ↵David Blaikie2015-08-181-0/+5
| | | | | | move constructed in ConditionalCleanup::restore llvm-svn: 245367
* Initialize the AST consumer as soon as we have both an ASTConsumer and anRichard Smith2015-08-182-9/+3
| | | | | | | ASTContext. Fixes some cases where we could previously initialize the AST consumer more than once. llvm-svn: 245346
* [OPENMP 4.1] Allow variables with reference types in private clauses.Alexey Bataev2015-08-181-6/+9
| | | | | | OpenMP 4.1 allows to use variables with reference types in all private clauses (private, firstprivate, lastprivate, linear etc.). Patch allows to use such variables and fixes codegen for linear variables with reference types. llvm-svn: 245268
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Justin Bogner2015-08-186-218/+110
| | | | | | | | | | | Bootstrap bots were failing: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/6382/ http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/2969 This reverts r245264. llvm-svn: 245267
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-186-110/+218
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 245264
OpenPOWER on IntegriCloud