summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Reapply^3 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-192-9/+12
| | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". llvm-svn: 270021
* Update for llvm change.Rafael Espindola2016-05-181-1/+1
| | | | llvm-svn: 269989
* Various improvements to the public IRGen interface.John McCall2016-05-182-32/+62
| | | | llvm-svn: 269880
* [Sema,CodeGen] Remove comment from SemaChecking about a ↵Craig Topper2016-05-181-18/+2
| | | | | | | | builtin_shufflevector form that it doesn't support. Remove CodeGen support for the same form since it could never have been used due to the missing support in Sema. I couldn't find any documentation that this form existed either. Nor is there documentation for one of the remaining two forms, but there is a testcase that uses it. llvm-svn: 269879
* [OPENMP] Pass scalar firstprivate vars by value.Alexey Bataev2016-05-173-23/+43
| | | | | | | | For better performance and to unify code with offloading part we pass scalar firstprivate values by value, instead of by reference. It will remove some extra copying operations. llvm-svn: 269751
* Revert "Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and ↵Vedant Kumar2016-05-162-12/+9
| | | | | | | | Coverage, NFC"" This reverts commit r269695. The llvm commit does not pass the MSVC bot. llvm-svn: 269701
* Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-162-9/+12
| | | | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". Differential Revision: http://reviews.llvm.org/D19902 llvm-svn: 269695
* Change embed-bitcode linkage typeSteven Wu2016-05-161-22/+51
| | | | | | | | | | | Embedded bitcode should have private linkage instead of appending or external. Otherwise, it will cause link failure due to duplicated symbols. Also add llvm.embedded.module and llvm.cmdline to llvm.compiler.used so they don't get optimized out. rdar://problem/21555860 llvm-svn: 269679
* CodeGen: convert some const char * to StringRefSaleem Abdulrasool2016-05-161-33/+21
| | | | | | Convert some use of const char * to StringRef. NFC. llvm-svn: 269630
* Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, ↵Chandler Carruth2016-05-142-12/+9
| | | | | | | | | | NFC"" This reverts commit r269492 as the corresponding LLVM commit was reverted due to lots of warnings. See the review thread for the original LLVM commit (r269491) for details. llvm-svn: 269549
* Fix some typos.Richard Smith2016-05-141-7/+7
| | | | llvm-svn: 269528
* Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-132-9/+12
| | | | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". Differential Revision: http://reviews.llvm.org/D19902 llvm-svn: 269492
* Revert "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-132-12/+9
| | | | | | This reverts commit r269463. It fails two llvm-profdata tests. llvm-svn: 269468
* [MS ABI] Delegating constructors should not assume they are most derivedDavid Majnemer2016-05-131-9/+11
| | | | | | | | A constructor needs to know whether or not it is most derived in order to determine if it is responsible for virtual bases. Delegating constructors assumed they were most derived. llvm-svn: 269465
* [ProfileData] (clang) Use Error in InstrProf and Coverage, NFCVedant Kumar2016-05-132-9/+12
| | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". llvm-svn: 269463
* [CodeGen] Clang does not choose aapcs-vfp calling convention for ARM bare ↵Oleg Ranevskyy2016-05-131-1/+2
| | | | | | | | | | | | | | | | | | | metal target with hard float (EABIHF) Summary: Clang does not detect `aapcs-vfp` for the EABIHF environment. The reason is that only GNUEABIHF is considered while choosing calling convention, EABIHF is ignored. This causes clang to use `aapcs` for EABIHF and add the `arm_aapcscc` specifier to functions in generated IR. The modified `arm-cc.c` test checks that no calling convention specifier is added to functions for EABIHF, which means the default one is used (`CallingConv::ARM_AAPCS_VFP`). Reviewers: rengolin, compnerd, t.p.northover Subscribers: aemerson, rengolin, asl, cfe-commits Differential Revision: http://reviews.llvm.org/D20219 llvm-svn: 269419
* [ObjC][CodeGen] Remove an assert that is no longer correct.Akira Hatanaka2016-05-131-3/+10
| | | | | | | | | | | | | | | | | | clang asserts when compiling the following code because r231508 made changes to promote constant temporary arrays and records to globals with constant initializers: std::vector<NSString*> strs = {@"a", @"b"}; This commit changes the code to return early if the object returned by createReferenceTemporary is a global variable with an initializer. rdar://problem/25504992 rdar://problem/25955179 Differential Revision: http://reviews.llvm.org/D20045 llvm-svn: 269385
* [ubsan] Add -fsanitize-undefined-strip-path-components=NFilipe Cabecinhas2016-05-121-1/+28
| | | | | | | | | | | | | | | | | | | Summary: This option allows the user to control how much of the file name is emitted by UBSan. Tuning this option allows one to save space in the resulting binary, which is helpful for restricted execution environments. With a positive N, UBSan skips the first N path components. With a negative N, UBSan only keeps the last N path components. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19666 llvm-svn: 269309
* [MS ABI] Don't crash when zero-initializing a vbase which contains a vbaseDavid Majnemer2016-05-121-0/+3
| | | | | | | | | | | | | | | | Bases can be zero-initialized: the storage is zero-initialized before the base constructor is run. The MS ABI has a quirk where base VBPtrs are not installed by the base constructor but by the most derived class. In particular, they are installed before the base constructor is run. The derived constructor must be careful to zero-initialize only the bits of the class which haven't already been populated by virtual base pointers. While we correctly avoided this scenario, we didn't handle the case where the base class has virtual bases which have virtual bases. llvm-svn: 269271
* Fixed msvc warningsSimon Pilgrim2016-05-111-0/+2
| | | | llvm-svn: 269242
* Preserve the FoundDecl when performing overload resolution for constructors.Richard Smith2016-05-111-0/+1
| | | | | | | | | This is in preparation for C++ P0136R1, which switches the model for inheriting constructors over from synthesizing a constructor to finding base class constructors (via using shadow decls) when looking for derived class constructors. llvm-svn: 269231
* Embed bitcode in object file (clang cc1 part)Steven Wu2016-05-112-0/+96
| | | | | | | | | | | | | | | | | | | Summary: Teach clang to embed bitcode inside bitcode. When -fembed-bitcode cc1 option is used, clang will embed both the input bitcode and cc1 commandline into the bitcode in special sections before compiling to the object file. Using -fembed-bitcode-marker will only introduce a marker in both sections. Depends on D17390 Reviewers: rsmith Subscribers: yaron.keren, vsk, cfe-commits Differential Revision: http://reviews.llvm.org/D17392 llvm-svn: 269202
* Update clang for LLVM API change.Peter Collingbourne2016-05-101-3/+1
| | | | llvm-svn: 269111
* Introduce CGCXXABI::canCallMismatchedFunctionTypeDerek Schuff2016-05-103-4/+16
| | | | llvm-svn: 269089
* more cleanupDerek Schuff2016-05-101-4/+4
| | | | llvm-svn: 269088
* Clarify condition, remove redundant checkDerek Schuff2016-05-101-5/+7
| | | | llvm-svn: 269087
* Clean up condition, add ARM to testDerek Schuff2016-05-101-8/+9
| | | | llvm-svn: 269086
* Do not register incompatible C++ destructors with __cxa_atexitDerek Schuff2016-05-101-3/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: For a static object with a nontrivial destructor, clang generates an initializer function (__cxx_global_var_init) which registers that object's destructor using __cxa_atexit. However some ABIs (ARM, WebAssembly) use destructors that return 'this' instead of having void return (which does not match the signature of function pointers passed to __cxa_atexit). This results in undefined behavior when the destructors are called. All the calling conventions I know of on ARM can tolerate this, but WebAssembly requires the signatures of indirect calls to match the called function. This patch disables that direct registration of destructors for ABIs that have this-returning destructors. Subscribers: aemerson, jfb, cfe-commits, dschuff Differential Revision: http://reviews.llvm.org/D19275 llvm-svn: 269085
OpenPOWER on IntegriCloud