summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.Tim Shen2016-06-091-0/+6
| | | | | | | | | | | These ExprWithCleanups are added for holding a RunCleanupsScope not for destructor calls; rather, they are for lifetime marks. This requires ExprWithCleanups to keep a bit to indicate whether it have cleanups with side effects (e.g. dtor calls). Differential Revision: http://reviews.llvm.org/D20498 llvm-svn: 272296
* [X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation ↵Craig Topper2016-06-091-52/+0
| | | | | | directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 equivalents as well. llvm-svn: 272246
* [X86] Reuse the EmitX86Select routine to handle the select for masked ↵Craig Topper2016-06-091-16/+7
| | | | | | palignr too. llvm-svn: 272245
* [DebugInfo] Add calling conventions to DISubroutineTypeReid Kleckner2016-06-082-15/+57
| | | | | | | | | | | | | | | | | | | | | | | Summary: This should have been a very simple change, but it was greatly complicated by the construction of new Decls during IR generation. In particular, we reconstruct the AST function type in order to get the implicit 'this' parameter into C++ method types. We also have to worry about FunctionDecls whose types are not FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls with 'void' type. Depends on D21114 Reviewers: aprantl, dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21141 llvm-svn: 272198
* [OpenCL] Fix __builtin_astype for vec3 types.Yaxun Liu2016-06-081-38/+36
| | | | | | | | __builtin_astype does not generate correct LLVM IR for vec3 types. This patch inserts bitcasts to/from vec4 when necessary in addition to generating vector shuffle. Sema and codegen tests are added. Differential Revision: http://reviews.llvm.org/D20133 llvm-svn: 272153
* [Sparc] Complex return value ABI compliance.Chris Dewhurst2016-06-081-0/+45
| | | | | | | | | | | | According to the Sparc V8 ABI, complex numbers should be passed and returned as pairs of registers: https://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html This fix ensures this is the case. Without this, complex numbers are returned as a struct of two floats, which breaks the ABI rules. Differential Review: http://reviews.llvm.org/D20955 llvm-svn: 272149
* [AVX512] Emit select instruction instead of using x86 specific instrinsics.Igor Breger2016-06-081-33/+59
| | | | | | | | This will allow us to remove the x86 instrinics from the backend. Differential Revision: http://reviews.llvm.org/D21060 llvm-svn: 272141
* Reapply [Coverage] Fix an assertion failure if the definition of an unused ↵Igor Kudrin2016-06-071-11/+31
| | | | | | | | | | | | | | | function spans multiple files. We have an assertion failure if, for example, the definition of an unused inline function starts in one macro and ends in another. This patch fixes the issue by finding the common ancestor of the start and end locations of that function's body and changing the locations accordingly. Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows. Differential Revision: http://reviews.llvm.org/D20997 llvm-svn: 271995
* Revert [Coverage] Fix an assertion failure if the definition of an unused ↵Igor Kudrin2016-06-071-31/+11
| | | | | | | | function spans multiple files. r271969 The test case fails on Windows. llvm-svn: 271976
* [Coverage] Fix an assertion failure if the definition of an unused function ↵Igor Kudrin2016-06-071-11/+31
| | | | | | | | | | | | | spans multiple files. We have an assertion failure if, for example, the definition of an unused inline function starts in one macro and ends in another. This patch fixes the issue by finding the common ancestor of the start and end locations of that function's body and changing the locations accordingly. Differential Revision: http://reviews.llvm.org/D20997 llvm-svn: 271969
* [AVX512] Convert masked palignr builtins directly to native IR similar to ↵Craig Topper2016-06-061-5/+23
| | | | | | the other palignr builtins, but with a select to handle masking. llvm-svn: 271873
* CodeGen: correct assertionSaleem Abdulrasool2016-06-031-2/+3
| | | | | | | The assertion added earlier was overly strict. We need to strip the pointer casts (as when constructing the GV). Correct the types (Function or Variable). llvm-svn: 271750
* [asan] Added -fsanitize-address-use-after-scope flagVitaly Buka2016-06-022-17/+31
| | | | | | | | | | | | | | | | Summary: Also emit lifetime markers for -fsanitize-address-use-after-scope. Asan uses life-time markers for use-after-scope check. PR27453 Reviewers: kcc, eugenis, aizatsky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20759 llvm-svn: 271451
* CodeGen: tweak CFString emission for COFF targetsSaleem Abdulrasool2016-06-011-0/+21
| | | | | | | | | The `isa' member was previously not given the correct DLL Storage. Ensure that we give the `isa' constant `__CFConstantStringClassReference' the correct DLL storage. Default to dllimport unless an explicit specification gives it a dllexport storage. llvm-svn: 271361
* [CUDA] Conservatively mark inline asm as convergent.Justin Lebar2016-05-311-0/+8
| | | | | | | | | | | | | | Summary: This is particularly important because a some convergent CUDA intrinsics (e.g. __shfl_down) are implemented in terms of inline asm. Reviewers: tra Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20836 llvm-svn: 271336
* [Coverage] Remove redundant handleFileExit() call (NFC)Vedant Kumar2016-05-311-3/+1
| | | | | | | | | I added this call in r271308. It's redundant because it's dominated by a call to extendRegion(). Thanks to Justin Bogner for pointing this out! llvm-svn: 271331
* [Coverage] Fix crash on a switch partially covered by a macro (PR27948)Vedant Kumar2016-05-311-2/+6
| | | | | | | We have to handle file exits before and after visiting regions in the switch body. Fixes PR27948. llvm-svn: 271308
* [AVX512] Convert masked load builtins to generic masked load intrinsics ↵Craig Topper2016-05-311-0/+67
| | | | | | | | instead of the x86 specific ones. This will allow the x86 intrinsics to be removed from the backend. llvm-svn: 271253
* [AVX512] Emit generic masked store instrinsics instead of using x86 specific ↵Craig Topper2016-05-311-0/+68
| | | | | | | | intrinsics. This will allow us to remove the x86 instrinics from the backend. llvm-svn: 271246
* CodeGen: address post-commit review commentsSaleem Abdulrasool2016-05-301-1/+1
| | | | | | David Majnemer pointed out that isOSBinFormatMachO is more compact. NFC. llvm-svn: 271221
* CodeGen: tweak CFConstantStrings for COFF and ELFSaleem Abdulrasool2016-05-301-20/+31
| | | | | | | | Adjust the constant CFString emission to emit into more appropriate sections on ELF and COFF targets. It would previously try to use MachO section names irrespective of the file format. llvm-svn: 271211
* [OPENMP 4.5] Additional codegen for statically scheduled loops withAlexey Bataev2016-05-301-6/+22
| | | | | | | | 'simd' modifier. Runtime library defines new schedule constant kmp_sch_static_balanced_chunked = 45 for static loop-based directives static with chunk adjustment (e.g., simd). Added codegen for this kind of schedule. llvm-svn: 271204
* [OPENMP 4.5] Fixed codegen for 'priority' and destructors in task-basedAlexey Bataev2016-05-302-15/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | directives. 'kmp_task_t' record type added a new field for 'priority' clause and changed the representation of pointer to destructors for privates used within loop-based directives. Old representation: typedef struct kmp_task { /* GEH: Shouldn't this be aligned somehow? */ void *shareds; /**< pointer to block of pointers to shared vars */ kmp_routine_entry_t routine; /**< pointer to routine to call for executing task */ kmp_int32 part_id; /**< part id for the task */ kmp_routine_entry_t destructors; /* pointer to function to invoke deconstructors of firstprivate C++ objects */ /* private vars */ } kmp_task_t; New representation: typedef struct kmp_task { /* GEH: Shouldn't this be aligned somehow? */ void *shareds; /**< pointer to block of pointers to shared vars */ kmp_routine_entry_t routine; /**< pointer to routine to call for executing task */ kmp_int32 part_id; /**< part id for the task */ kmp_cmplrdata_t data1; /* Two known optional additions: destructors and priority */ kmp_cmplrdata_t data2; /* Process destructors first, priority second */ /* future data */ /* private vars */ } kmp_task_t; Also excessive initialization of 'destructors' fields to 'null' was removed from codegen if it is known that no destructors shal be used. Currently a special bit is used in 'kmp_tasking_flags_t' bitfields ('destructors_thunk' bitfield). llvm-svn: 271201
* [X86] Simplify alignr builtin support by recognizing that NumLaneElts is ↵Craig Topper2016-05-291-9/+7
| | | | | | always 16. NFC llvm-svn: 271176
* [CodeGen] Use the ArrayRef form CreateShuffleVector instead of building ↵Craig Topper2016-05-291-48/+39
| | | | | | ConstantVectors or ConstantDataVectors and calling the other form. llvm-svn: 271165
* Handle -Wa,--mrelax-relocations=[no|yes].Rafael Espindola2016-05-291-0/+1
| | | | llvm-svn: 271162
* CodeGen: support blocks on COFF targets in DLLsSaleem Abdulrasool2016-05-281-3/+29
| | | | | | | | | | | This extends the blocks support to support blocks with a dynamically linked blocks runtime. The previous code generation would work only for static builds of the blocks runtime. Mark the block "isa" pointers and functions as dllimport if no explicit declaration marked with __declspec(dllexport) is found. This additional check allows for the use of the functionality in the runtime library if desired. llvm-svn: 271138
* AMDGPU: Add fract builtinMatt Arsenault2016-05-281-0/+3
| | | | llvm-svn: 271080
* Add instcombine pass if sampleprofile pass is enabled.Dehao Chen2016-05-271-2/+10
| | | | | | | | | | | | Summary: Sample profile pass need to have instcombine pass. A related change is http://reviews.llvm.org/D17742. But we should not explicitly add dependency between to non-analysis passes. So we add the dependency here. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20502 llvm-svn: 271010
* Apply clang-tidy's misc-move-constructor-init throughout Clang.Benjamin Kramer2016-05-271-1/+2
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270996
* [CodeGen] Don't crash when sizeof(long) != 4 for some intrinsDavid Majnemer2016-05-271-6/+9
| | | | | | | | | | _InterlockedIncrement and _InterlockedDecrement have 'long' in their prototypes. We assumed 'long' was the same size as an i32 which is incorrect for other targets. This fixes PR27892. llvm-svn: 270953
* [OpenMP] Codegen for target update directive.Samuel Antao2016-05-263-27/+86
| | | | | | | | | | | | Summary: This patch implements the code generation for the `target update` directive. The implemntation relies on the logic already in place for target data standalone directives, i.e. target enter/exit data. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20650 llvm-svn: 270886
* [OpenMP] Parsing and sema support for the from clauseSamuel Antao2016-05-261-0/+1
| | | | | | | | | | | | | | | Summary: The patch contains the parsing and sema support for the `from` clause. Patch based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18488 llvm-svn: 270882
* [OpenMP] Parsing and sema support for the to clauseSamuel Antao2016-05-261-0/+1
| | | | | | | | | | | | | | | Summary: The patch contains the parsing and sema support for the `to` clause. Patch based on the original post by Kelvin Li. Reviewers: carlo.bertolli, hfinkel, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18597 llvm-svn: 270880
* [OpenMP] Parsing and sema support for target update directiveSamuel Antao2016-05-263-0/+10
| | | | | | | | | | | | | | | Summary: This patch is to add parsing and sema support for `target update` directive. Support for the `to` and `from` clauses will be added by a different patch. This patch also adds support for other clauses that are already implemented upstream and apply to `target update`, e.g. `device` and `if`. This patch is based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D15944 llvm-svn: 270878
* [OpenMP] Add support for the 'private pointer' flag to signal variables ↵Samuel Antao2016-05-261-71/+117
| | | | | | | | | | | | | | captured in target regions and used in first-private clauses. Summary: If a variable is implicitly mapped (doesn't show in a map clause), the runtime library has to be informed if the corresponding capture shows up in first-private clause, so that the storage previously allocated in the device is used. This patch adds the support for that. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20112 llvm-svn: 270870
* [OpenMP] Adjust map type bits according to latest spec and use zero size ↵Samuel Antao2016-05-261-31/+40
| | | | | | | | | | | | | | array sections for pointers. Summary: This patch changes the bits used to specify the map types according to the latest version of the libomptarget document and add the support for zero size array section when pointers are being implicitly mapped. This completes the missing new 4.5 map semantics. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20111 llvm-svn: 270868
* [ObjC] Remove _Atomic from return type and parameter type ofAkira Hatanaka2016-05-261-5/+12
| | | | | | | | | | | | | | objective-c properties. This fixes an assert in CodeGen that fires when the getter and setter functions for an objective-c property of type _Atomic(_Bool) are synthesized. rdar://problem/26322972 Differential Revision: http://reviews.llvm.org/D20407 llvm-svn: 270808
* Add a loop's debug location to its llvm.loop metadataHal Finkel2016-05-254-17/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Getting accurate locations for loops is important, because those locations are used by the frontend to generate optimization remarks. Currently, optimization remarks for loops often appear on the wrong line, often the first line of the loop body instead of the loop itself. This is confusing because that line might itself be another loop, or might be somewhere else completely if the body was an inlined function call. This happens because of the way we find the loop's starting location. First, we look for a preheader, and if we find one, and its terminator has a debug location, then we use that. Otherwise, we look for a location on an instruction in the loop header. The fallback heuristic is not bad, but will almost always find the beginning of the body, and not the loop statement itself. The preheader location search often fails because there's often not a preheader, and even when there is a preheader, depending on how it was formed, it sometimes carries the location of some preceeding code. I don't see any good theoretical way to fix this problem. On the other hand, this seems like a straightforward solution: Put the debug location in the loop's llvm.loop metadata. When emitting debug information, this commit causes us to add the debug location as an operand to each loop's llvm.loop metadata. Thus, we now generate this metadata for all loops (not just loops with optimization hints) when we're otherwise generating debug information. The remark test case changes depend on the companion LLVM commit r270771. llvm-svn: 270772
* Use new triple API to check comdat /NFCXinliang David Li2016-05-251-1/+1
| | | | llvm-svn: 270728
* [OPENMP 4.5] Codegen for dacross loop synchronization constructs.Alexey Bataev2016-05-253-2/+188
| | | | | | | OpenMP 4.5 adds support for doacross loop synchronization. Patch implements codegen for this construct. llvm-svn: 270690
* [esan|wset] Add working set tool driver flagsDerek Bruening2016-05-251-0/+2
| | | | | | | | | | | | | | Summary: Adds a new -fsanitize=efficiency-working-set flag to enable esan's working set tool. Adds appropriate tests for the new flag. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits Differential Revision: http://reviews.llvm.org/D20484 llvm-svn: 270641
* [MS Volatile] Don't make volatile loads/stores to underaligned objects atomicDavid Majnemer2016-05-243-31/+9
| | | | | | | | | | Underaligned atomic LValues require libcalls which MSVC doesn't have. MSVC doesn't seem to consider such operations as requiring a barrier anyway. This fixes PR27843. llvm-svn: 270576
* [OPENMP] Fixed codegen for firstprivate vars in standalone worksharingAlexey Bataev2016-05-241-1/+3
| | | | | | | | directives. If firstprivate variable is is captured by value in outlined region and then used as firstprivate variable in inner worksharing directive, the copy for this firstprivate variable was not created. Fixed this bug. llvm-svn: 270536
* CodeGen: indicate to the backend the exception modelSaleem Abdulrasool2016-05-241-0/+3
| | | | | | | Thread through -fsjlj-exceptions to the backend via the TargetOptions. This is in preparation for supporting SjLj exceptions on x86 (e.g. for MinGW). llvm-svn: 270528
* [OpenCL] Add to_{global|local|private} builtin functions.Yaxun Liu2016-05-201-0/+23
| | | | | | | | | | | | | | | | | | OpenCL builtin functions to_{global|local|private} accepts argument of pointer type to arbitrary pointee type, and return a pointer to the same pointee type in different addr space, i.e. global gentype *to_global(gentype *p); It is not desirable to declare it as global void *to_global(void *); in opencl header file since it misses diagnostics. This patch implements these builtin functions as Clang builtin functions. In the builtin def file they are defined to have signature void*(void*). When handling call expressions, their declarations are re-written to have correct parameter type and return type corresponding to the call argument. In codegen call to addr void *to_addr(void*) is generated with addrcasts or bitcasts to facilitate implementation in builtin library. Differential Revision: http://reviews.llvm.org/D19932 llvm-svn: 270261
* Add all the avx512 flavors to __builtin_cpu_supports's list.Benjamin Kramer2016-05-201-0/+21
| | | | | | | | This is matching what trunk gcc is accepting. Also adds a missing ssse3 case. PR27779. The amount of duplication here is annoying, maybe it should be factored into a separate .def file? llvm-svn: 270224
* CodeGen: address -Wcast-qual warningSaleem Abdulrasool2016-05-201-1/+1
| | | | | | Add a const_cast rather than the C-style cast. NFC. llvm-svn: 270180
* [CUDA] Implement __ldg using intrinsics.Justin Lebar2016-05-191-0/+45
| | | | | | | | | | | | | | | | | | Summary: Previously it was implemented as inline asm in the CUDA headers. This change allows us to use the [addr+imm] addressing mode when executing ld.global.nc instructions. This translates into a 1.3x speedup on some benchmarks that call this instruction from within an unrolled loop. Reviewers: tra, rsmith Subscribers: jhen, cfe-commits, jholewinski Differential Revision: http://reviews.llvm.org/D19990 llvm-svn: 270150
* Check for nullptr argument.Artem Belevich2016-05-191-2/+2
| | | | | | | | Addresses static analysis report in PR15492. Differential Revision: http://reviews.llvm.org/D20141 llvm-svn: 270086
OpenPOWER on IntegriCloud