summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Pass a GlobalDecl to SetInternalFunctionAttributes. NFC.Rafael Espindola2018-02-287-26/+27
| | | | | | | | This just reduces the noise in a followup patch. Part of D43900. llvm-svn: 326385
* [OpenMP] Extend NVPTX SPMD implementation of combined constructsCarlo Bertolli2018-02-282-21/+14
| | | | | | | | Differential Revision: https://reviews.llvm.org/D43852 This patch extends the SPMD implementation to all target constructs and guards this implementation under a new flag. llvm-svn: 326368
* CodeGenObjCXX: handle inalloca appropriately for msgSend variantSaleem Abdulrasool2018-02-281-1/+2
| | | | | | | | | | | objc_msgSend_stret takes a hidden parameter for the returned structure's address for the construction. When the function signature is rewritten for the inalloca passing, the return type is no longer marked as indirect but rather inalloca stret. This enhances the test for the indirect return to check for that case as well. This fixes the incorrect return classification for Windows x86. llvm-svn: 326362
* Fix gcc -Wreturn-type warnings after r326307.Nico Weber2018-02-281-0/+2
| | | | llvm-svn: 326355
* [CUDA] Include single GPU binary, NFCI.Jonas Hahnfeld2018-02-281-75/+60
| | | | | | | | | Binaries for multiple architectures are combined by fatbinary, so the current code was effectively not needed. Differential Revision: https://reviews.llvm.org/D43461 llvm-svn: 326342
* [ObjC] Allow declaring __strong pointer fields in structs in Objective-CAkira Hatanaka2018-02-288-71/+1076
| | | | | | | | | | | | | | | | | | | | | ARC mode. Declaring __strong pointer fields in structs was not allowed in Objective-C ARC until now because that would make the struct non-trivial to default-initialize, copy/move, and destroy, which is not something C was designed to do. This patch lifts that restriction. Special functions for non-trivial C structs are synthesized that are needed to default-initialize, copy/move, and destroy the structs and manage the ownership of the objects the __strong pointer fields point to. Non-trivial structs passed to functions are destructed in the callee function. rdar://problem/33599681 Differential Revision: https://reviews.llvm.org/D41228 llvm-svn: 326307
* Inline trivial function. NFC.Rafael Espindola2018-02-281-7/+1
| | | | llvm-svn: 326272
* Pass a GlobalDecl to setAliasAttributes. NFC.Rafael Espindola2018-02-284-6/+6
| | | | | | This just makes a followup change easier to read. llvm-svn: 326270
* Pass a GlobalDecl to setFunctionDefinitionAttributes. NFC.Rafael Espindola2018-02-273-6/+5
| | | | | | This just makes a followup patch easier to read. llvm-svn: 326265
* [DebugInfo] Support DWARF v5 source code embedding extensionScott Linder2018-02-262-5/+27
| | | | | | | | | | | | | In DWARF v5 the Line Number Program Header is extensible, allowing values with new content types. This vendor extension to DWARF v5 allows source text to be embedded directly in the line tables of the debug line section. Add new flag (-g[no-]embed-source) to Driver and CC1 which indicates that source should be passed through to LLVM during CodeGen. Differential Revision: https://reviews.llvm.org/D42766 llvm-svn: 326102
* [CodeGen][DebugInfo] Refactor duplicated code, NFCScott Linder2018-02-261-6/+2
| | | | llvm-svn: 326099
* Set Module Metadata "RtLibUseGOT" when fno-plt is used.Sriraman Tallam2018-02-231-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D42217 llvm-svn: 325961
* Bring r325915 back.Rafael Espindola2018-02-234-3/+20
| | | | | | | | | | | | | | | The tests that failed on a windows host have been fixed. Original message: Start setting dso_local for COFF. With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. llvm-svn: 325940
* Revert "Start setting dso_local for COFF."Rafael Espindola2018-02-234-20/+3
| | | | | | | | This reverts commit r325915. It will take some time to fix the failures on a windows host. llvm-svn: 325929
* Start setting dso_local for COFF.Rafael Espindola2018-02-234-3/+20
| | | | | | | | | With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. llvm-svn: 325915
* Support for the mno-stack-arg-probe flagHans Wennborg2018-02-231-10/+9
| | | | | | | | | | | | Adds support for this flag. There is also another piece for llvm (separate review). More info: https://bugs.llvm.org/show_bug.cgi?id=36221 By Ruslan Nikolaev! Differential Revision: https://reviews.llvm.org/D43108 llvm-svn: 325901
* [mips] Revert r325872Stefan Maksimovic2018-02-231-8/+0
| | | | | | | There are still outstanding issues with byVal arguments that prevent this from being committed. Revert for now. llvm-svn: 325899
* [mips] Reland r310704Stefan Maksimovic2018-02-231-0/+8
| | | | | | | | Recommit this change which was previously reverted for the 5.0.0 release since the failures identified were dealt with in r325782. llvm-svn: 325872
* Simplify setting dso_local. NFC.Rafael Espindola2018-02-233-12/+12
| | | | | | | | | | | The value of dso_local can be computed from just IR properties and global information (object file type, command line options, etc). With this patch we no longer pass in the Decl. It was almost unused and making it fully unused guarantees that dso_local is consistent with the rest of the IR. llvm-svn: 325846
* [OpenMP] Limit reduction support for pragma 'distribute' when combined with ↵Carlo Bertolli2018-02-221-19/+23
| | | | | | | | | | | pragma 'simd' Differential Revision: https://reviews.llvm.org/D43513 This is a bug fix that removes the emission of reduction support for pragma 'distribute' when found alone or in combinations without simd. Pragma 'distribute' does not have a reduction clause, but when combined with pragma 'simd' we need to emit the support for simd's reduction clause as part of code generation for distribute. This guard is similar to the one used for reduction support earlier in the same code gen function. llvm-svn: 325822
* [OPENMP] Require valid SourceLocation in function call, NFC.Alexey Bataev2018-02-222-8/+7
| | | | | | | Removed default empty SourceLocation argument from `emitCall` function and require valid location. llvm-svn: 325812
* [OpenCL] Add '-cl-uniform-work-group-size' compile optionAlexey Sotkin2018-02-221-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: OpenCL 2.0 specification defines '-cl-uniform-work-group-size' option, which requires that the global work-size be a multiple of the work-group size specified to clEnqueueNDRangeKernel and allows optimizations that are made possible by this restriction. The patch introduces the support of this option. To keep information about whether an OpenCL kernel has uniform work group size or not, clang generates 'uniform-work-group-size' function attribute for every kernel: - "uniform-work-group-size"="true" for OpenCL 1.2 and lower, - "uniform-work-group-size"="true" for OpenCL 2.0 and higher if '-cl-uniform-work-group-size' option was specified, - "uniform-work-group-size"="false" for OpenCL 2.0 and higher if no '-cl-uniform-work-group-size' options was specified. If the function is not an OpenCL kernel, 'uniform-work-group-size' attribute isn't generated. Patch by: krisb Reviewers: yaxunl, Anastasia, b-sumner Reviewed By: yaxunl, Anastasia Subscribers: nhaehnle, yaxunl, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D43570 llvm-svn: 325771
* CodeGen: handle blocks correctly when inalloca'edSaleem Abdulrasool2018-02-211-2/+5
| | | | | | | | | | When using blocks with C++ on Windows x86, it is possible to have the block literal be pushed into the inalloca'ed parameters. Teach IRGen to handle the case properly by extracting the block literal from the inalloca parameter. This fixes the use of blocks with C++ on Windows x86. llvm-svn: 325724
* [CodeGen] Fix generation of TBAA tags for may-alias accessesIvan A. Kosarev2018-02-203-7/+20
| | | | | | | | | | | This patch fixes creating TBAA access descriptors for may_alias-marked access types. Currently, for such types we generate ordinary descriptors with char as its access type. The patch changes this to produce proper may-alias descriptors. Differential Revision: https://reviews.llvm.org/D42366 llvm-svn: 325575
* [CodeGen] Initialize large arrays by copying from a globalIvan A. Kosarev2018-02-191-6/+30
| | | | | | | | | | | | | | Currently, clang compiles explicit initializers for array elements into series of store instructions. For large arrays of built-in types this results in bloated output code and significant amount of time spent on the instruction selection phase. This patch fixes the issue by initializing such arrays with global constants that store the binary image of the initializer. Differential Revision: https://reviews.llvm.org/D43181 llvm-svn: 325478
* [ThinLTO] Allow indexing to request backend to ignore the moduleVitaly Buka2018-02-161-5/+17
| | | | | | | | | | | | | | | | | | Summary: Gold plugin does not add pass to ThinLTO modules without useful symbols. In this case ThinLTO can't create corresponding index file and some features, like CFI, cannot be processes by backed correctly without index. Given that we don't need the backed output we can request it to avoid processing the module. This is implemented by this patch using new "SkipModuleByDistributedBackend" flag. Reviewers: pcc, tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42995 llvm-svn: 325411
* [ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is setVitaly Buka2018-02-162-10/+25
| | | | | | | | | | | | | | | | | Summary: ThinLTO compilation may decide not to split module and keep at as regular LTO. In this can this module already processed during indexing and already a part of merged object file. So here we can just skip it. Reviewers: pcc, tejohnson Reviewed By: tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42680 llvm-svn: 325410
* [Coverage] Handle break/continue outside of loop bodiesVedant Kumar2018-02-161-8/+16
| | | | | | | | | Teach the coverage mapping logic to handle break or continue statements within for loop increments. Fixes llvm.org/PR36406. llvm-svn: 325319
* [OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.Alexey Bataev2018-02-151-0/+2
| | | | | | | | | Codegen for ordered with doacross construct might produce incorrect code because of missing cleanup scope for the construct. Without this scope the final runtime function call could be emitted in the wrong order that leads to incorrect codegen. llvm-svn: 325304
* [OpenCL] Fix __enqueue_block for block with capturesYaxun Liu2018-02-154-39/+56
| | | | | | | | | | | | | | | | | | | | | | | | | The following test case causes issue with codegen of __enqueue_block void (^block)(void) = ^{ callee(id, out); }; enqueue_kernel(queue, 0, ndrange, block); Clang first does codegen for block expression in the first line and deletes its block info. Clang then tries to do codegen for the same block expression again for the second line, and fails because the block info is gone. The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to record llvm block invoke function and llvm block literal emitted for each AST block expression, and use the recorded information for generating the wrapper kernel. The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen of blocks. Another minor issue is that some clean up AST expression is generated for block with captures, which can be stripped by IgnoreImplicit. Differential Revision: https://reviews.llvm.org/D43240 llvm-svn: 325264
* Update for llvm change. NFC.Rafael Espindola2018-02-141-2/+2
| | | | llvm-svn: 325156
* Implement function attribute artificialErich Keane2018-02-141-1/+1
| | | | | | | | | | | | Added support in clang for GCC function attribute 'artificial'. This attribute is used to control stepping behavior of debugger with respect to inline functions. Patch By: Elizabeth Andrews (eandrews) Differential Revision: https://reviews.llvm.org/D43259 llvm-svn: 325081
* [DebugInfo] Avoid name conflict of generated VLA expression variable.Sander de Smalen2018-02-131-2/+3
| | | | | | | | | | | | | | | | | Summary: This patch also adds the 'DW_AT_artificial' flag to the generated variable. Addresses the issues mentioned in http://llvm.org/PR30553. Reviewers: CarlosAlbertoEnciso, probinson, aprantl Reviewed By: aprantl Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D43189 llvm-svn: 324988
* [X86] Reverse the operand order of the implementation of the kunpack builtins.Craig Topper2018-02-121-1/+2
| | | | | | | | The second operand needs to be in the lower bits of the concatenation. This matches llvm 5.0, gcc, and icc behavior. Fixes PR36360. llvm-svn: 324954
* [AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portionAbderrazek Zaafrani2018-02-121-17/+98
| | | | | | https://reviews.llvm.org/D42993 llvm-svn: 324940
* [DebugInfo] Update Checksum handling in CGDebugInfoScott Linder2018-02-122-12/+16
| | | | | | Update to match new DIFile API. llvm-svn: 324929
* Make attribute-target on a Definition-after-use update the LLVM attributesErich Keane2018-02-123-40/+59
| | | | | | | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=36301 The issue is that the 'use' causes the plain declaration to emit the attributes to LLVM-IR. However, if the definition added it later, these would silently disappear. This commit extracts that logic to its own function in CodeGenModule, and has the attribute-applications done during 'definition' update the attributes properly. Differential Revision: https://reviews.llvm.org/D43095 llvm-svn: 324907
* Re-commit r324490: [DebugInfo] Improvements to representation of enumeration ↵Momchil Velikov2018-02-121-5/+7
| | | | | | | | types (PR36168) Differential revision: https://reviews.llvm.org/D42736 llvm-svn: 324900
* ASan+operator new[]: Add an option for more thorough operator new[] cookie ↵Filipe Cabecinhas2018-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | poisoning Summary: Right now clang is skipping array cookie poisoning for any operator new[] which is not part of the set of replaceable global allocation functions. This commit adds a flag to tell clang to poison all operator new[] cookies. A previous review was poisoning all array cookies unconditionally, but there is an edge case which would stop working under ASan (a custom operator new[] saves whatever pointer it returned, and then accesses it). This newer revision adds a command line argument to toggle this feature. Original revision: https://reviews.llvm.org/D41301 Compiler-rt test revision with an explanation of the edge case: https://reviews.llvm.org/D41664 Reviewers: rjmccall, kcc, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43013 llvm-svn: 324884
* [X86] Change the signature of the AVX512 packed fp compare intrinsics to ↵Craig Topper2018-02-101-17/+64
| | | | | | | | | | | | | | | | return vXi1 mask. Make bitcasts to scalar explicit in IR Summary: This is the clang equivalent of r324827 Reviewers: zvi, delena, RKSimon, spatel Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43143 llvm-svn: 324828
* [CodeGen] Use the zero initializer instead of storing an all zero ↵Matt Davis2018-02-091-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | representation. Summary: This change avoids the overhead of storing, and later crawling, an initializer list of all zeros for arrays. When LLVM visits this (llvm/IR/Constants.cpp) ConstantArray::getImpl() it will scan the list looking for an array of all zero. We can avoid the store, and short-cut the scan, by detecting all zeros when clang builds-up the initialization representation. This was brought to my attention when investigating PR36030 Reviewers: majnemer, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42549 llvm-svn: 324776
* [WinEH] Put funclet bundles on inline asm callsReid Kleckner2018-02-093-16/+19
| | | | | | | | | | | | | | | | Summary: Fixes PR36247, which is where WinEHPrepare replaces inline asm in funclets with unreachable. Make getBundlesForFunclet return by value to simplify some call sites. Reviewers: smeenai, majnemer Subscribers: eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D43033 llvm-svn: 324689
* [X86] Replace kortest intrinsics with native IR.Craig Topper2018-02-081-0/+12
| | | | llvm-svn: 324647
* Fix improper indentation issue in CodeGenModule [NFC]Erich Keane2018-02-081-2/+2
| | | | llvm-svn: 324644
* Fix crash on array initializer with non-0 alloca addrspaceMatt Arsenault2018-02-081-1/+2
| | | | llvm-svn: 324641
* Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.Alexander Ivchenko2018-02-081-1/+11
| | | | | | | | | | | | | | | | Summary: This patch is a fix for following issue: https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end lowering C calling conventions without taking into account calling conventions enforced by attribute. In this case win64cc was no correctly lowered on targets other than Windows. Reviewed By: rnk (Reid Kleckner) Differential Revision: https://reviews.llvm.org/D43016 Author: belickim <mateusz.belicki@intel.com> llvm-svn: 324594
* Don't try to use copy relocations with tls variables.Rafael Espindola2018-02-071-3/+4
| | | | | | Should fix the lldb bot. llvm-svn: 324539
* Recommit r324107 again.Rafael Espindola2018-02-076-11/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | The difference from the previous try is that we no longer directly access function declarations from position independent executables. It should work, but currently doesn't with some linkers. It now includes a fix to not mark available_externally definitions as dso_local. Original message: Start setting dso_local in clang. This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324535
* Revert [DebugInfo] Improvements to representation of enumeration types ↵Momchil Velikov2018-02-071-7/+5
| | | | | | | | (PR36168)" Revert due to breaking buildbots (LLDB tests) llvm-svn: 324508
* Revert "Recommit r324107."Rafael Espindola2018-02-076-76/+11
| | | | | | | | | | | | | | This reverts commit r324500. The bots found two failures: ThreadSanitizer-x86_64 :: Linux/pie_no_aslr.cc ThreadSanitizer-x86_64 :: pie_test.cc when using gold. The issue is a limitation in gold when building pie binaries. I will investigate how to work around it. llvm-svn: 324505
OpenPOWER on IntegriCloud