summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [InlineAsm] Update the min-legal-vector-width function attribute based on ↵Craig Topper2018-08-141-0/+14
| | | | | | | | | | | | | | | | | | | | | inputs and outputs to inline assembly Summary: Another piece of my ongoing to work for prefer-vector-width. min-legal-vector-width will eventually be used by the X86 backend to know whether it needs to make 512 bits type legal when prefer-vector-width=256. If the user used inline assembly that passed in/out a 512-bit register, we need to make sure 512 bits are considered legal. Otherwise we'll get an assert failure when we try to wire up the inline assembly to the rest of the code. This patch just checks the LLVM IR types to see if they are vectors and then updates the attribute based on their total width. I'm not sure if this is the best way to do this or if there's any subtlety I might have missed. So if anyone has other opinions on how to do this I'm open to suggestions. Reviewers: chandlerc, rsmith, rnk Reviewed By: rnk Subscribers: eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D50678 llvm-svn: 339721
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-9/+9
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Hsiangkai Wang2018-08-061-10/+0
| | | | | | | | | | | Build failed in http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/27258 In lib/CodeGen/LiveDebugVariables.cpp:589, it uses std::prev(MBBI) to get DebugValue's SlotIndex. however, the previous instruction may be also a debug instruction. llvm-svn: 338992
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Hsiangkai Wang2018-08-061-0/+10
| | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 338989
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Shiva Chen2018-07-241-10/+0
| | | | | | This reverts commit 4288dd3bf082482e02c8a044c611c18168cb0180. llvm-svn: 337803
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Shiva Chen2018-07-241-0/+10
| | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 337800
* Patch to fix pragma metadata for do-while loopsBjorn Pettersson2018-07-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make sure that loop metadata only is put on the backedge when expanding a do-while loop. Previously we added the loop metadata also on the branch in the pre-header. That could confuse optimization passes and result in the loop metadata being associated with the wrong loop. Fixes https://bugs.llvm.org/show_bug.cgi?id=38011 Committing on behalf of deepak2427 (Deepak Panickal) Reviewers: #clang, ABataev, hfinkel, aaron.ballman, bjope Reviewed By: bjope Subscribers: bjope, rsmith, shenhan, zzheng, xbolva00, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D48721 llvm-svn: 336717
* Revert r331843 "[DebugInfo] Generate debug information for labels."Hans Wennborg2018-05-091-10/+0
| | | | | | | | | | | | | | | | It broke the Chromium build (see reply on the review). > Generate DILabel metadata and call llvm.dbg.label after label > statement to associate the metadata with the label. > > Differential Revision: https://reviews.llvm.org/D45045 > > Patch by Hsiangkai Wang. This doesn't revert the change to backend-unsupported-error.ll that seems to correspond to an llvm-side change. llvm-svn: 331861
* [DebugInfo] Generate debug information for labels.Shiva Chen2018-05-091-0/+10
| | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 331843
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* PR36992: do not store beyond the dsize of a class object unless we knowRichard Smith2018-04-051-6/+7
| | | | | | | | | | | | | | the tail padding is not reused. We track on the AggValueSlot (and through a couple of other initialization actions) whether we're dealing with an object that might share its tail padding with some other object, so that we can avoid emitting stores into the tail padding if that's the case. We still widen stores into tail padding when we can do so. Differential Revision: https://reviews.llvm.org/D45306 llvm-svn: 329342
* [AMDGPU] Fix codegen for inline assemblyYaxun Liu2018-03-231-1/+1
| | | | | | | | Need to override convertConstraint to recognise amdgpu specific register names. Differential Revision: https://reviews.llvm.org/D44533 llvm-svn: 328359
* Fix codegen for structured binding binding in conditionsZhihao Yuan2018-03-171-5/+5
| | | | | | | | | | | | | | | | | | | | | Summary: The codegen for conditions assumes that a normal variable declaration is used in a condition, but this is not the case when a structured binding is used. This fixes [PR36747](http://llvm.org/pr36747). Thanks Nicolas Lesser for contributing the patch. Reviewers: lichray, rsmith Reviewed By: lichray Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D44534 llvm-svn: 327780
* [WinEH] Put funclet bundles on inline asm callsReid Kleckner2018-02-091-1/+2
| | | | | | | | | | | | | | | | 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
* [CodeGen] Decorate aggregate accesses with TBAA tagsIvan A. Kosarev2018-01-251-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D41539 llvm-svn: 323421
* [OPENMP] Support for -fopenmp-simd option with compilation of simd loopsAlexey Bataev2017-12-291-0/+9
| | | | | | | | | only. Added support for -fopenmp-simd option that allows compilation of simd-based constructs without emission of OpenMP runtime calls. llvm-svn: 321560
* Fix some -Wunused-variable warningsHans Wennborg2017-11-181-1/+0
| | | | llvm-svn: 318578
* OpenCL: Assume inline asm is convergentMatt Arsenault2017-11-131-4/+5
| | | | | | Already done for CUDA. llvm-svn: 318098
* [MS-InlineAsm] Fix cast assertion with vector spills (PR34021)Simon Pilgrim2017-09-121-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D37448 llvm-svn: 313019
* Debug info: Fixed faulty debug locations for attributed statementsKarl-Johan Karlsson2017-09-061-27/+11
| | | | | | | | | | | | | | | | | Summary: As the attributed statements are considered simple statements no stoppoint was generated before emitting attributed do/while/for/range- statement. This lead to faulty debug locations. Reviewers: echristo, aaron.ballman, dblaikie Reviewed By: dblaikie Subscribers: bjope, aprantl, cfe-commits Differential Revision: https://reviews.llvm.org/D37428 llvm-svn: 312623
* [ubsan] Improve diagnostics for return value checks (clang)Vedant Kumar2017-06-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes ubsan's nonnull return value diagnostics more precise, which makes the diagnostics more useful when there are multiple return statements in a function. Example: 1 |__attribute__((returns_nonnull)) char *foo() { 2 | if (...) { 3 | return expr_which_might_evaluate_to_null(); 4 | } else { 5 | return another_expr_which_might_evaluate_to_null(); 6 | } 7 |} // <- The current diagnostic always points here! runtime error: Null returned from Line 7, Column 2! With this patch, the diagnostic would point to either Line 3, Column 5 or Line 5, Column 5. This is done by emitting source location metadata for each return statement in a sanitized function. The runtime is passed a pointer to the appropriate metadata so that it can prepare and deduplicate reports. Compiler-rt patch (with more tests): https://reviews.llvm.org/D34298 Differential Revision: https://reviews.llvm.org/D34299 llvm-svn: 306163
* [CodeGen] Use preincrement version of APInt::operator++ instead of ↵Craig Topper2017-04-191-1/+1
| | | | | | | | postincrement to avoid creating and immediately discarding a temporary APInt. This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207. llvm-svn: 300756
* Update Clang for LLVM rename AttributeSet -> AttributeListReid Kleckner2017-03-211-4/+4
| | | | llvm-svn: 298394
* [coroutines] Add co_return statement emissionGor Nishanov2017-03-061-1/+1
| | | | | | | | | | | | | | | | | Summary: Added co_return statement emission. Tweaked coro-alloc.cpp test to use co_return to trigger coroutine processing instead of co_await, since this change starts emitting the body of the coroutine and await expression handling has not been upstreamed yet. Reviewers: rsmith, majnemer, EricWF, aaron.ballman Reviewed By: rsmith Subscribers: majnemer, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D29979 llvm-svn: 297076
* [OpenMP] Sema and parsing for 'target teams distribute simd’ pragmaKelvin Li2017-01-101-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute simd’ pragma. Differential Revision: https://reviews.llvm.org/D28252 llvm-svn: 291579
* [OpenMP] Sema and parsing for 'target teams distribute parallel for simd’ ↵Kelvin Li2017-01-031-0/+4
| | | | | | | | | | pragma This patch is to implement sema and parsing for 'target teams distribute parallel for simd’ pragma. Differential Revision: https://reviews.llvm.org/D28202 llvm-svn: 290862
* [OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragmaKelvin Li2016-12-291-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma. Differential Revision: https://reviews.llvm.org/D28160 llvm-svn: 290725
* [OpenMP] Sema and parsing for 'target teams distribute' pragmaKelvin Li2016-12-251-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D28015 llvm-svn: 290508
* [OpenMP] Sema and parsing for 'target teams' pragmaKelvin Li2016-12-171-0/+3
| | | | | | | | This patch is to implement sema and parsing for 'target teams' pragma. Differential Revision: https://reviews.llvm.org/D27818 llvm-svn: 290038
* Remove custom handling of array copies in lambda by-value array capture andRichard Smith2016-12-141-1/+1
| | | | | | | | | | | copy constructors of classes with array members, instead using ArrayInitLoopExpr to represent the initialization loop. This exposed a bug in the static analyzer where it was unable to differentiate between zero-initialized and unknown array values, which has also been fixed here. llvm-svn: 289618
* [OpenMP] Sema and parsing for 'teams distribute parallel for' pragmaKelvin Li2016-12-091-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for' pragma. Differential Revision: https://reviews.llvm.org/D27345 llvm-svn: 289179
* [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragmaKelvin Li2016-11-301-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D27084 llvm-svn: 288294
* [MS] Mangle a unique ID into all MS inline asm labelsReid Kleckner2016-11-281-9/+0
| | | | | | | | | | | | This solves PR23715 in a way that is compatible with LTO. MSVC supports jumping to source-level labels and between inline asm blocks, but we don't. Also revert the old solution, r255201, which was to mark these calls as noduplicate. llvm-svn: 288059
* Add the loop end location to the loop metadata. This additional informationAmara Emerson2016-11-101-8/+14
| | | | | | | | | | | | can be used to improve the locations when generating remarks for loops. Depends on the companion LLVM change r286227. Patch by Florian Hahn. Differential Revision: https://reviews.llvm.org/D25764 llvm-svn: 286456
* [coroutines] Add allocation and deallocation substatements.Gor Nishanov2016-10-271-0/+2
| | | | | | | | | | | | | | Summary: SemaCoroutine: Add allocation / deallocation substatements. CGCoroutine/Test: Emit allocation and deallocation + test. Reviewers: rsmith Subscribers: ABataev, EricWF, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D25879 llvm-svn: 285306
* Re-apply patch r279045.Kelvin Li2016-10-251-0/+4
| | | | llvm-svn: 285066
* Fix a couple of wrong-code bugs in switch-on-constant optimization:Richard Smith2016-09-161-2/+31
| | | | | | | | | | | | * recurse through intermediate LabelStmts and AttributedStmts when checking whether a statement inside a switch declares a variable * if the end of a compound statement is reachable from the chosen case label, and the compound statement contains a variable declaration, it's not valid to just emit the contents of the compound statement -- we must emit the statement itself or we lose the scope (and thus end lifetimes at the wrong point) llvm-svn: 281797
* Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"Diana Picus2016-08-181-4/+0
| | | | | | | | | | | | | | | | | This reverts commit r279003 as it breaks some of our buildbots (e.g. clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules). The error is in OpenMP/teams_distribute_simd_ast_print.cpp: clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527: bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const [with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>; KeyT = clang::Stmt*; ValueT = long unsigned int; KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>; BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]: Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!"' failed. llvm-svn: 279045
* [OpenMP] Sema and parsing for 'teams distribute simd’ pragmaKelvin Li2016-08-171-0/+4
| | | | | | | | | | This patch is to implement sema and parsing for 'teams distribute simd’ pragma. This patch is originated by Carlo Bertolli. Differential Revision: https://reviews.llvm.org/D23528 llvm-svn: 279003
* [OpenMP] Sema and parsing for 'teams distribute' pragmaKelvin Li2016-08-051-0/+3
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D23189 llvm-svn: 277818
* Reverting r275115 which caused PR28634.Wolfgang Pieb2016-07-211-13/+1
| | | | | | | When empty (forwarding) basic blocks that are referenced by user labels are removed, incorrect code may be generated. llvm-svn: 276361
* [CodeGen] Fix a crash when constant folding switch statementErik Pilkington2016-07-211-0/+8
| | | | | | Differential revision: https://reviews.llvm.org/D22542 llvm-svn: 276350
* [OpenMP] Sema and parsing for 'target simd' pragmaKelvin Li2016-07-201-0/+3
| | | | | | | | This patch is to implement sema and parsing for 'target simd' pragma. Differential Revision: https://reviews.llvm.org/D22479 llvm-svn: 276203
* [OpenMP] Sema and parsing for 'target parallel for simd' pragmaKelvin Li2016-07-141-0/+4
| | | | | | | | This patch is to implement sema and parsing for 'target parallel for simd' pragma. Differential Revision: http://reviews.llvm.org/D22096 llvm-svn: 275365
* P0305R0: Semantic analysis and code generation for C++17 init-statement for ↵Richard Smith2016-07-141-0/+10
| | | | | | | | | | 'if' and 'switch': if (stmt; condition) { ... } Patch by Anton Bikineev! Some minor formatting and comment tweets by me. llvm-svn: 275350
* Prevent the creation of empty (forwarding) blocks resulting from nested ifs.Wolfgang Pieb2016-07-111-1/+13
| | | | | | | | | | | | | | | | | Summary: Nested if statements can generate empty BBs whose terminator branches unconditionally to its successor. These branches are not eliminated to help generate better line number information in some cases, but there is no reason to keep the empty blocks that result from nested ifs. Reviewers: mehdi_amini, dblaikie, echristo Subscribers: mehdi_amini, cfe-commits Differential review: http://reviews.llvm.org/D11360 llvm-svn: 275115
* [OpenMP] Sema and parsing for 'distribute simd' pragmaKelvin Li2016-07-061-0/+3
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute simd'. Differential Revision: http://reviews.llvm.org/D22007 llvm-svn: 274604
* [OpenMP] Sema and parse for 'distribute parallel for simd'Kelvin Li2016-07-051-0/+4
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute parallel for simd'. Differential Revision: http://reviews.llvm.org/D21977 llvm-svn: 274530
* Resubmission of http://reviews.llvm.org/D21564 after fixes.Carlo Bertolli2016-06-271-0/+4
| | | | | | | | | | | | | [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for' This patch is an initial implementation for #distribute parallel for. The main differences that affect other pragmas are: The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds. As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value. As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound. llvm-svn: 273884
* Revert r273705Carlo Bertolli2016-06-241-4/+0
| | | | | | [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for' llvm-svn: 273709
OpenPOWER on IntegriCloud