summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenCL] Add 'denorms-are-zero' function attributeAlexey Sotkin2018-04-201-0/+4
| | | | | | | | | | | | | | | | | | Summary: Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero' compile option was specified and 'denorms-are-zero'='false' otherwise. Patch by krisb Reviewers: Anastasia, yaxunl Reviewed By: yaxunl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45808 llvm-svn: 330404
* Implement proper support for `-falign-functions`Saleem Abdulrasool2018-04-191-0/+4
| | | | | | | | | | | | | | | | This implements support for the previously ignored flag `-falign-functions`. This allows the frontend to request alignment on function definitions in the translation unit where they are not explicitly requested in code. This is compatible with the GCC behaviour and the ICC behaviour. The scalar value passed to `-falign-functions` aligns functions to a power-of-two boundary. If flag is used, the functions are aligned to 16-byte boundaries. If the scalar is specified, it must be an integer less than or equal to 4096. If the value is not a power-of-two, the driver will round it up to the nearest power of two. llvm-svn: 330378
* Fix __attribute__((force_align_arg_pointer)) misalignment bugErich Keane2018-04-191-20/+5
| | | | | | | | | | | | | | | | The force_align_arg_pointer attribute was using a hardcoded 16-byte alignment value which in combination with -mstack-alignment=32 (or larger) would produce a misaligned stack which could result in crashes when accessing stack buffers using aligned AVX load/store instructions. Fix the issue by using the "stackrealign" function attribute instead of using a hardcoded 16-byte alignment. Patch By: Gramner Differential Revision: https://reviews.llvm.org/D45812 llvm-svn: 330331
* Lowering x86 adds/addus/subs/subus intrinsics (clang)Alexander Ivchenko2018-04-191-1/+98
| | | | | | | | | | | This is the patch that lowers x86 intrinsics to native IR in order to enable optimizations. Patch by tkrupa Differential Revision: https://reviews.llvm.org/D44786 llvm-svn: 330323
* [CodeGen] Do not push a destructor cleanup for a struct that doesn'tAkira Hatanaka2018-04-181-2/+9
| | | | | | | | | | | | | | | have a non-trivial destructor. This fixes a bug introduced in r328731 where CodeGen emits calls to synthesized destructors for non-trivial C structs in C++ mode when the struct passed to EmitCallArg doesn't have a non-trivial destructor. Under Microsoft's ABI, ASTContext::isParamDestroyedInCallee currently always returns true, so it's necessary to check whether the struct has a non-trivial destructor before pushing a cleanup in EmitCallArg. This fixes PR37146. llvm-svn: 330304
* [MS] Fix unprototyped thunk emission for incomplete return typesReid Kleckner2018-04-181-5/+9
| | | | | | Fixes PR37161 llvm-svn: 330303
* [NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma ↵Artem Belevich2018-04-181-16/+134
| | | | | | | | | | instructions. The new instructions were added added for sm_70+ GPUs in CUDA-9.1. Differential Revision: https://reviews.llvm.org/D45068 llvm-svn: 330296
* [XRay] Add clang builtin for xray typed events.Keith Wyss2018-04-173-1/+50
| | | | | | | | | | | | | | | | | | | Summary: A clang builtin for xray typed events. Differs from __xray_customevent(...) by the presence of a type tag that is vended by compiler-rt in typical usage. This allows xray handlers to expand logged events with their type description and plugins to process traced events based on type. This change depends on D45633 for the intrinsic definition. Reviewers: dberris, pelikan, rnk, eizan Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D45716 llvm-svn: 330220
* Move the visitor classes that are used to traverse non-trivial C structsAkira Hatanaka2018-04-171-118/+89
| | | | | | | | | | | | | | to a header file. This is in preparation for using the visitor classes to warn about memcpy'ing non-trivial C structs. See the discussion here: https://reviews.llvm.org/D45310 rdar://problem/36124208 llvm-svn: 330201
* Add a command line option 'fregister_global_dtors_with_atexit' toAkira Hatanaka2018-04-175-0/+68
| | | | | | | | | | | | | | | | | | | | | register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit. Register destructor functions annotated with __attribute__((destructor)) calling __cxa_atexit in a synthesized constructor function instead of emitting references to the functions in a special section. The primary reason for adding this option is that we are planning to deprecate the __mod_term_funcs section on Darwin in the future. This feature is enabled by default only on Darwin. Users who do not want this can use command line option 'fno_register_global_dtors_with_atexit' to disable it. rdar://problem/33887655 Differential Revision: https://reviews.llvm.org/D45578 llvm-svn: 330199
* [ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO buildsTeresa Johnson2018-04-171-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Summary: The clang driver option -save-temps was not passed to the LTO config, so when invoking the ThinLTO backends via clang during distributed builds there was no way to get LTO to save temp files. Getting this to work with ThinLTO distributed builds also required changing the driver to avoid a separate compile step to emit unoptimized bitcode when the input was already bitcode under -save-temps. Not only is this unnecessary in general, it is problematic for ThinLTO backends since the temporary bitcode file to the backend would not match the module path in the combined index, leading to incorrect ThinLTO backend index-based optimizations. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D45217 llvm-svn: 330194
* Add modifiers for unsigned char and signed char field printing for ↵Aaron Ballman2018-04-171-0/+2
| | | | | | | | __builtin_dump_struct. Patch by Paul Semel. llvm-svn: 330188
* Add checks for format specifiers used by __builtin_dump_struct and added a ↵Aaron Ballman2018-04-171-0/+1
| | | | | | | | new specifier for null-terminated constant strings. Patch by Paul Semel. llvm-svn: 330185
* [OPENMP] Allow to use declare target variables in map clausesAlexey Bataev2018-04-161-10/+7
| | | | | | | | Global variables marked as declare target are allowed to be used in map clauses. Patch fixes the crash of the compiler on the declare target variables in map clauses. llvm-svn: 330156
* [CodeGen] Fix a crash that occurs when a non-trivial C struct with aAkira Hatanaka2018-04-161-15/+25
| | | | | | | | | | | | | | volatile array field is copied. The crash occurs because method 'visitArray' passes a null FieldDecl to method 'visit' and some of the methods called downstream expect a non-null FieldDecl to be passed. This reapplies r330151 with a fix to the test case. rdar://problem/33599681 llvm-svn: 330155
* [OPENMP] General code improvements.Alexey Bataev2018-04-162-133/+137
| | | | llvm-svn: 330154
* Revert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"Akira Hatanaka2018-04-161-25/+15
| | | | | | This reverts commit r330151, which caused bots to fail. llvm-svn: 330153
* Use export_as for autolinking frameworksBruno Cardoso Lopes2018-04-161-0/+6
| | | | | | | | | | | | | | | | framework module SomeKitCore { ... export_as SomeKit } Given the module above, while generting autolink information during codegen, clang should to emit '-framework SomeKitCore' only if SomeKit was not imported in the relevant TU, otherwise it should use '-framework SomeKit' instead. rdar://problem/38269782 llvm-svn: 330152
* [CodeGen] Fix a crash that occurs when a non-trivial C struct with aAkira Hatanaka2018-04-161-15/+25
| | | | | | | | | | | | volatile array field is copied. The crash occurs because method 'visitArray' passes a null FieldDecl to method 'visit' and some of the methods called downstream expect a non-null FieldDecl to be passed. rdar://problem/33599681 llvm-svn: 330151
* [OPENMP] General code improvements.Alexey Bataev2018-04-162-718/+861
| | | | llvm-svn: 330140
* [CodeView] Initial support for emitting S_THUNK32 symbols for compiler...Brock Wyma2018-04-163-3/+10
| | | | | | | | | | | When emitting CodeView debug information, compiler-generated thunk routines should be emitted using S_THUNK32 symbols instead of S_GPROC32_ID symbols so Visual Studio can properly step into the user code. This initial support only handles standard thunk ordinals. Differential Revision: https://reviews.llvm.org/D43838 llvm-svn: 330132
* Clean carriage returns from lib/ and include/. NFC.Malcolm Parsons2018-04-161-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Clean carriage returns from lib/ and include/. NFC. (I have to make this change locally in order for `git diff` to show sane output after I edit a file, so I might as well ask for it to be committed. I don't have commit privs myself.) (Without this patch, `git rebase`ing any change involving SemaDeclCXX.cpp is a real nightmare. :( So while I have no right to ask for this to be committed, geez would it make my workflow easier if it were.) Here's the command I used to reformat things. (Requires bash and OSX/FreeBSD sed.) git grep -l $'\r' lib include | xargs sed -i -e $'s/\r//' find lib include -name '*-e' -delete Reviewers: malcolm.parsons Reviewed By: malcolm.parsons Subscribers: emaste, krytarowski, cfe-commits Differential Revision: https://reviews.llvm.org/D45591 Patch by Arthur O'Dwyer. llvm-svn: 330112
* hwasan: add -fsanitize=kernel-hwaddress flagAndrey Konovalov2018-04-135-10/+34
| | | | | | | | | This patch adds -fsanitize=kernel-hwaddress flag, that essentially enables -hwasan-kernel=1 -hwasan-recover=1 -hwasan-match-all-tag=0xff. Differential Revision: https://reviews.llvm.org/D45046 llvm-svn: 330044
* [OPENMP] Replace push_back by emplace_back, NFC.Alexey Bataev2018-04-132-11/+11
| | | | llvm-svn: 330042
* [OPENMP] Code cleanup + formatting, NFC.Alexey Bataev2018-04-132-477/+492
| | | | llvm-svn: 330040
* [NEON] Support vrndns_f32 intrinsicIvan A. Kosarev2018-04-131-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D45515 llvm-svn: 330012
* [XRay][clang] Add flag to choose instrumentation bundlesDean Michael Berris2018-04-133-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change addresses http://llvm.org/PR36926 by allowing users to pick which instrumentation bundles to use, when instrumenting with XRay. In particular, the flag `-fxray-instrumentation-bundle=` has four valid values: - `all`: the default, emits all instrumentation kinds - `none`: equivalent to -fnoxray-instrument - `function`: emits the entry/exit instrumentation - `custom`: emits the custom event instrumentation These can be combined either as comma-separated values, or as repeated flag values. Reviewers: echristo, kpw, eizan, pelikan Reviewed By: pelikan Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D44970 llvm-svn: 329985
* Remove -cc1 option "-backend-option".Eli Friedman2018-04-121-2/+0
| | | | | | | | | It means the same thing as -mllvm; there isn't any reason to have two options which do the same thing. Differential Revision: https://reviews.llvm.org/D45109 llvm-svn: 329965
* [NFC] Fix terrible formatting of CGRecordLower constructor.Erich Keane2018-04-121-6/+7
| | | | llvm-svn: 329952
* ObjCGNU: Fix empty v3 protocols being emitted two fields shortDavid Chisnall2018-04-121-5/+7
| | | | | | | | | | | | | | | | | | | Summary: Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime. As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid. Reviewers: rjmccall, theraven Reviewed By: rjmccall, theraven Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D45305 llvm-svn: 329882
* [CodeGen] Handle __func__ inside __finallyShoaib Meenai2018-04-111-1/+1
| | | | | | | | | | | When we enter a __finally block, the CGF's CurCodeDecl will be null (because CodeGenFunction::StartFunction is given an empty GlobalDecl for a __finally block), and so the dyn_cast here will result in an assertion failure. Change it to dyn_cast_or_null to handle this case. Differential Revision: https://reviews.llvm.org/D45523 llvm-svn: 329836
* Introduce a new builtin, __builtin_dump_struct, that is useful for dumping ↵Aaron Ballman2018-04-101-0/+100
| | | | | | | | structure contents at runtime in circumstances where debuggers may not be easily available (such as in kernel work). Patch by Paul Semel. llvm-svn: 329762
* [OPENMP] Additional attributes for the pointer parameters.Alexey Bataev2018-04-103-1/+16
| | | | | | Added attributes for better optimization of the OpenMP code. llvm-svn: 329751
* Revert r329684 (and follow-ups 329693, 329714). See discussion on ↵Nico Weber2018-04-101-37/+46
| | | | | | https://reviews.llvm.org/D43578. llvm-svn: 329739
* -ftime-report switch support in Clang.Andrew V. Tischenko2018-04-101-46/+37
| | | | | | | | | | The current support of the feature produces only 2 lines in report: -Some general Code Generation Time; -Total time of Backend Consumer actions. This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc. Differential Revision: https://reviews.llvm.org/D43578 llvm-svn: 329684
* asan: kernel: make no_sanitize("address") attribute work with ↵Vitaly Buka2018-04-091-2/+8
| | | | | | | | | | | | | | | | | -fsanitize=kernel-address Summary: Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address") disable both ASan and KASan instrumentation. Also remove redundant test. Patch by Andrey Konovalov Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka Reviewed By: eugenis, vitalybuka Differential Revision: https://reviews.llvm.org/D44981 llvm-svn: 329612
* [X86] Emit native IR for pmuldq/pmuludq builtins.Craig Topper2018-04-091-0/+36
| | | | | | | | I believe all the pieces are now in place in the backend to make this work correctly. We can either mask the input to 32 bits for pmuludg or shl/ashr for pmuldq and use a regular mul instruction. The backend should combine this to PMULUDQ/PMULDQ and then SimplifyDemandedBits will remove the and/shifts. Differential Revision: https://reviews.llvm.org/D45421 llvm-svn: 329605
* Generalize the swiftcall API since being passed indirectly isn'tJohn McCall2018-04-071-6/+4
| | | | | | C++-specific anymore. llvm-svn: 329513
* Make CodeGen depend just once on clangAnalysis.Nico Weber2018-04-071-1/+0
| | | | llvm-svn: 329477
* [OPENMP, NVPTX] Fix codegen for the teams reduction.Alexey Bataev2018-04-061-25/+19
| | | | | | | Added NUW flags for all the add|mul|sub operations + replaced sdiv by udiv as we operate on unsigned values only (addresses, converted to integers) llvm-svn: 329411
* Fix typos in clangAlexander Kornienko2018-04-0623-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Hexagon] Remove default values from lambda parametersKrzysztof Parzyszek2018-04-061-24/+24
| | | | llvm-svn: 329394
* PR36992: do not store beyond the dsize of a class object unless we knowRichard Smith2018-04-0515-115/+226
| | | | | | | | | | | | | | 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
* [ObjC] Use the name specified by objc_runtime_name instead of the classAkira Hatanaka2018-04-031-2/+6
| | | | | | | | | | | | | identifier. This patch fixes a few places in CGObjCMac.cpp where the class identifier was used instead of the name specified by objc_runtime_name. rdar://problem/37910822 Differential Revision: https://reviews.llvm.org/D45101 llvm-svn: 329128
* Add the -fsanitize=shadow-call-stack flagVlad Tsyrklevich2018-04-032-0/+6
| | | | | | | | | | | | | | | | | Summary: Add support for the -fsanitize=shadow-call-stack flag which causes clang to add ShadowCallStack attribute to functions compiled with that flag enabled. Reviewers: pcc, kcc Reviewed By: pcc, kcc Subscribers: cryptoad, cfe-commits, kcc Differential Revision: https://reviews.llvm.org/D44801 llvm-svn: 329122
* Revert "Set calling convention for CUDA kernel"Artem Belevich2018-04-034-16/+0
| | | | | | | This reverts r328795 which introduced an issue with referencing __global__ function templates. More details in the original review D44747. llvm-svn: 329099
* [MS] Emit vftable thunks for functions with incomplete prototypesReid Kleckner2018-04-027-103/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The following class hierarchy requires that we be able to emit a this-adjusting thunk for B::foo in C's vftable: struct Incomplete; struct A { virtual A* foo(Incomplete p) = 0; }; struct B : virtual A { void foo(Incomplete p) override; }; struct C : B { int c; }; This TU is valid, but lacks a definition of 'Incomplete', which makes it hard to build a thunk for the final overrider, B::foo. Before this change, Clang gives up attempting to emit the thunk, because it assumes that if the parameter types are incomplete, it must be emitting the thunk for optimization purposes. This is untrue for the MS ABI, where the implementation of B::foo has no idea what thunks C's vftable may require. Clang needs to emit the thunk without necessarily having access to the complete prototype of foo. This change makes Clang emit a musttail variadic call when it needs such a thunk. I call these "unprototyped" thunks, because they only prototype the "this" parameter, which must always come first in the MS C++ ABI. These thunks work, but they create ugly LLVM IR. If the call to the thunk is devirtualized, it will be a call to a bitcast of a function pointer. Today, LLVM cannot inline through such a call, but I want to address that soon, because we also use this pattern for virtual member pointer thunks. This change also implements an old FIXME in the code about reusing the thunk's computed CGFunctionInfo as much as possible. Now we don't end up computing the thunk's mangled name and arranging it's prototype up to around three times. Fixes PR25641 Reviewers: rjmccall, rsmith, hans Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D45112 llvm-svn: 329009
* Fix some DenseMap use-after-rehash bugs and hoist MethodVFTableLocationReid Kleckner2018-04-022-15/+12
| | | | | | | | | | | | | | This re-lands r328845 with fixes for crbug.com/827810. The initial motiviation was to hoist MethodVFTableLocation to global scope so it could be forward declared. In this patch, I noticed that MicrosoftVTableContext uses some risky patterns. It has methods that return references to data stored in DenseMaps. I've made some of them return by value for trivial structs and I've moved some things into separate allocations. llvm-svn: 329007
* Add helper to determine if a field is a zero-length bitfield.Richard Smith2018-04-023-12/+9
| | | | llvm-svn: 328999
* [CUDA] Let device-side shared variables be initialized with undefYaxun Liu2018-04-021-4/+6
| | | | | | | | | | | CUDA shared variable should be initialized with undef. Patch by Greg Rodgers. Revised and lit test added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D44985 llvm-svn: 328994
OpenPOWER on IntegriCloud