Dean Michael Berris [Thu, 14 Jul 2016 04:58:44 +0000 (04:58 +0000)]
Add C++ dependencies to xray runtime
Summary:
Depends on D21982 which implements the in-memory logging implementation of the
XRay runtime. These additional changes also depends on D20352 which adds the
bulk of XRay flags/dependencies when using the `-fxray-instrument` flag from
Clang.
Reviewers: echristo, rnk, aaron.ballman
Subscribers: mehdi_amini, cfe-commits
Differential Revision: http://reviews.llvm.org/D21983
llvm-svn: 275368
Dean Michael Berris [Thu, 14 Jul 2016 04:06:33 +0000 (04:06 +0000)]
XRay: Add entry and exit sleds
Summary:
In this patch we implement the following parts of XRay:
- Supporting a function attribute named 'function-instrument' which currently only supports 'xray-always'. We should be able to use this attribute for other instrumentation approaches.
- Supporting a function attribute named 'xray-instruction-threshold' used to determine whether a function is instrumented with a minimum number of instructions (IR instruction counts).
- X86-specific nop sleds as described in the white paper.
- A machine function pass that adds the different instrumentation marker instructions at a very late stage.
- A way of identifying which return opcode is considered "normal" for each architecture.
There are some caveats here:
1) We don't handle PATCHABLE_RET in platforms other than x86_64 yet -- this means if IR used PATCHABLE_RET directly instead of a normal ret, instruction lowering for that platform might do the wrong thing. We think this should be handled at instruction selection time to by default be unpacked for platforms where XRay is not availble yet.
2) The generated section for X86 is different from what is described from the white paper for the sole reason that LLVM allows us to do this neatly. We're taking the opportunity to deviate from the white paper from this perspective to allow us to get richer information from the runtime library.
Reviewers: sanjoy, eugenis, kcc, pcc, echristo, rnk
Subscribers: niravd, majnemer, atrick, rnk, emaste, bmakam, mcrosier, mehdi_amini, llvm-commits
Differential Revision: http://reviews.llvm.org/D19904
llvm-svn: 275367
Davide Italiano [Thu, 14 Jul 2016 03:02:34 +0000 (03:02 +0000)]
[SCCP] Pass a Value * instead of templating this function. NFC.
Thanks to Eli for the suggestion!
llvm-svn: 275366
Kelvin Li [Thu, 14 Jul 2016 02:54:56 +0000 (02:54 +0000)]
[OpenMP] Sema and parsing for 'target parallel for simd' pragma
This patch is to implement sema and parsing for 'target parallel for simd' pragma.
Differential Revision: http://reviews.llvm.org/D22096
llvm-svn: 275365
Chris Lattner [Thu, 14 Jul 2016 02:52:04 +0000 (02:52 +0000)]
clarify a bit.
llvm-svn: 275364
Davide Italiano [Thu, 14 Jul 2016 02:51:41 +0000 (02:51 +0000)]
[IPSCCP] Constant fold struct argument/instructions when all the lattice values are constant.
This now should also work with the interprocedural variant of the pass.
Slightly easier now that the yak is shaved.
Differential Revision: http://reviews.llvm.org/D22329
llvm-svn: 275363
Lang Hames [Thu, 14 Jul 2016 02:35:18 +0000 (02:35 +0000)]
[lld] Update LLD for Archive::child_iterator change in LLVM r275361.
llvm-svn: 275362
Lang Hames [Thu, 14 Jul 2016 02:24:01 +0000 (02:24 +0000)]
[Object] Re-apply r275316 now that I have the corresponding LLD patch ready.
llvm-svn: 275361
Nico Weber [Thu, 14 Jul 2016 01:52:51 +0000 (01:52 +0000)]
Teach fast isel about thiscall (and callee-pop) calls.
http://reviews.llvm.org/D22315
llvm-svn: 275360
Mehdi Amini [Thu, 14 Jul 2016 01:31:25 +0000 (01:31 +0000)]
[Scalarizer] PR28108: Skip over nullptr rather than crashing on it.
Summary:
In Scalarizer::gather we see if we already have a scattered form of Op,
and in that case use the new form.
In the particular case of PR28108, the found ValueVector SV has size 2,
where the first Value is nullptr, and the second is indeed a proper Value.
The nullptr then caused an assert to blow when we tried to do
cast<Instruction>(SV[I]).
With this patch we check SV[I] before doing the cast, and if it's nullptr
we just skip over it.
I don't know the Scalarizer well enough to know if this is the best fix
or if something should be done else where to prevent the nullptr from
being in the ValueVector at all, but at least this avoids the crash
and looking at the test case output it looks reasonable.
Reviewers: hfinkel, frasercrmck, wala, mehdi_amini
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21518
llvm-svn: 275359
Mehdi Amini [Thu, 14 Jul 2016 01:31:20 +0000 (01:31 +0000)]
Add missing test for r275347 "[IPRA] Set callee saved registers to none for local function when IPRA is enabled."
llvm-svn: 275358
Davide Italiano [Thu, 14 Jul 2016 01:27:29 +0000 (01:27 +0000)]
[SCCP] Generalize tryToReplaceInstWithConstant to work also with arguments.
llvm-svn: 275357
Adrian Prantl [Thu, 14 Jul 2016 00:42:53 +0000 (00:42 +0000)]
Add a comment mirroring the one in LLVM's Dwarf.h
llvm-svn: 275356
Matthias Braun [Thu, 14 Jul 2016 00:42:37 +0000 (00:42 +0000)]
MIRParser: Fix MIRParser not reporting nullptr on error.
While some code paths in MIRParserImpl::parse() already returned nullptr
in case of error one of the important ones did not.
llvm-svn: 275355
Adrian Prantl [Thu, 14 Jul 2016 00:41:18 +0000 (00:41 +0000)]
Synchronize LLVM and clang's ObjCDeclSpec::ObjCPropertyAttributeKind.
This adds Clang-specific DWARF constants for nullability and ObjC
class properties that are already generated by clang. This patch adds
dwarfdump support and a more comprehensive testcase.
<rdar://problem/
27335745>
llvm-svn: 275354
Lang Hames [Thu, 14 Jul 2016 00:37:04 +0000 (00:37 +0000)]
[Object] Revert r275316, Archive::child_iterator changes, while I update lld.
Should fix the bots broken by r275316.
llvm-svn: 275353
David Majnemer [Thu, 14 Jul 2016 00:29:50 +0000 (00:29 +0000)]
[ConstantFolding] Fold masked loads
We can constant fold a masked load if the operands are appropriately
constant.
Differential Revision: http://reviews.llvm.org/D22324
llvm-svn: 275352
Richard Smith [Thu, 14 Jul 2016 00:14:59 +0000 (00:14 +0000)]
www/cxx_status: give more precise links to initialization order wording
llvm-svn: 275351
Richard Smith [Thu, 14 Jul 2016 00:11:03 +0000 (00:11 +0000)]
P0305R0: Semantic analysis and code generation for C++17 init-statement for 'if' and 'switch':
if (stmt; condition) { ... }
Patch by Anton Bikineev! Some minor formatting and comment tweets by me.
llvm-svn: 275350
Justin Lebar [Wed, 13 Jul 2016 23:52:19 +0000 (23:52 +0000)]
Force a semicolon at the end of the LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE() macro.
This silences a warning about an extra semicolon on gcc.
llvm-svn: 275349
Mehdi Amini [Wed, 13 Jul 2016 23:39:46 +0000 (23:39 +0000)]
Add EnableIPRA to TargetOptions, and move the cl::opt -enable-ipra to TargetMachine.cpp
Avoid exposing a cl::opt in a public header and instead promote this
option in the API.
Alternatively, we could land the cl::opt in CommandFlags.h so that
it is available to every tool, but we would still have to find an
option for clang.
llvm-svn: 275348
Mehdi Amini [Wed, 13 Jul 2016 23:39:34 +0000 (23:39 +0000)]
[IPRA] Set callee saved registers to none for local function when IPRA is enabled.
IPRA try to optimize caller saved register by propagating register
usage information from callee to caller so it is beneficial to have
caller saved registers compare to callee saved registers when IPRA
is enabled. Please find more detailed explanation here
https://groups.google.com/d/msg/llvm-dev/XRzGhJ9wtZg/tjAJqb0eEgAJ.
This change makes local function do not have any callee preserved
register when IPRA is enabled. A simple test case is also added to
verify this change.
Patch by Vivek Pandya <vivekvpandya@gmail.com>
Differential Revision: http://reviews.llvm.org/D21561
llvm-svn: 275347
Sanjoy Das [Wed, 13 Jul 2016 23:33:20 +0000 (23:33 +0000)]
[JumpThreading] Delete commented out debug code; NFC
llvm-svn: 275346
David Majnemer [Wed, 13 Jul 2016 23:33:07 +0000 (23:33 +0000)]
[ConstantFolding] Extend FoldReinterpretLoadFromConstPtr to handle negative offsets
Treat loads which clip before the start of a global initializer the same
way we treat clipping beyond the end of the initializer: use zeros.
llvm-svn: 275345
David Majnemer [Wed, 13 Jul 2016 23:32:53 +0000 (23:32 +0000)]
Move a transform from InstCombine to InstSimplify.
This transform doesn't require any new instructions, it can safely live
in InstSimplify.
llvm-svn: 275344
Michael Kuperstein [Wed, 13 Jul 2016 23:28:00 +0000 (23:28 +0000)]
Fix copy/paste bug in r275340.
llvm-svn: 275343
Matthias Braun [Wed, 13 Jul 2016 23:27:50 +0000 (23:27 +0000)]
MIRParser: Move SlotMapping and SourceMgr refs to PFS; NFC
Code cleanup: Move references to SlotMapping and SourceMgr into the
PerFunctionMIParsingState to avoid unnecessary passing around in
parameters.
llvm-svn: 275342
Michael Kuperstein [Wed, 13 Jul 2016 23:23:40 +0000 (23:23 +0000)]
[DAG] Correctly chain masked loads
If a masked loads is not added to the chain, it should not reset the chain's
root.
This fixes the remaining part of PR28515.
llvm-svn: 275340
Davide Italiano [Wed, 13 Jul 2016 23:20:04 +0000 (23:20 +0000)]
[SCCP] Have the logic for replacing insts with constant in a single place.
The code was pretty much copy-pasted between SCCP and IPSCCP. The situation
became clearly worse after I introduced the support for folding structs in
SCCP. This commit is NFC as we currently (still) skip the replacement
step in IPSCCP, but I'll change this soon.
llvm-svn: 275339
Vedant Kumar [Wed, 13 Jul 2016 23:12:26 +0000 (23:12 +0000)]
[Coverage] Return an ArrayRef to avoid copies (NFC)
llvm-svn: 275338
Vedant Kumar [Wed, 13 Jul 2016 23:12:23 +0000 (23:12 +0000)]
[Coverage] Mark a few methods const (NFC)
llvm-svn: 275337
Greg Clayton [Wed, 13 Jul 2016 22:38:54 +0000 (22:38 +0000)]
Added test for setting breakpoints by basename and fullname.
<rdar://problem/
24599697>
llvm-svn: 275336
Adam Nemet [Wed, 13 Jul 2016 22:36:35 +0000 (22:36 +0000)]
[LAA] Don't hold on to DominatorTree in the analysis result
llvm-svn: 275335
Adam Nemet [Wed, 13 Jul 2016 22:36:27 +0000 (22:36 +0000)]
[LAA] Don't hold on to TargetLibraryInfo in the analysis result
llvm-svn: 275334
Quentin Colombet [Wed, 13 Jul 2016 22:35:33 +0000 (22:35 +0000)]
[MIR] Fix one GlobalISel test case that I missed in r275314.
llvm-svn: 275333
Justin Lebar [Wed, 13 Jul 2016 22:35:19 +0000 (22:35 +0000)]
[MI] Clean up some loops over MachineInstr::memoperands(). NFC
Use range-based for loops and llvm::any_of instead of explicit
iterators.
llvm-svn: 275332
Justin Lebar [Wed, 13 Jul 2016 22:34:50 +0000 (22:34 +0000)]
[MI] Fix MachineInstr::isInvariantLoad.
Summary:
Previously it would say we had an invariant load if any of the memory
operands were invariant. But the load should be invariant only if *all*
the memory operands are invariant.
No testcase because this has proven to be very difficult to tickle in
practice. As just one example, ARM's ldrd instruction, which loads 64
bits into two 32-bit regs, is theoretically affected by this. But when
it's produced, it loses its memoperands' invariance bits!
Reviewers: jfb
Subscribers: llvm-commits, aemerson
Differential Revision: http://reviews.llvm.org/D22318
llvm-svn: 275331
Aaron Ballman [Wed, 13 Jul 2016 22:32:15 +0000 (22:32 +0000)]
Add XRay flags to Clang. We implement two flags to control the XRay behaviour:
-fxray-instrument: enables XRay annotation of IR
-fxray-instruction-threshold: configures the threshold for function size (looking at IR instructions), and allow LLVM to decide whether to add the nop sleds later on in the process.
Also implements the related xray_always_instrument and xray_never_instrument function attributes.
Patch by Dean Michael Berris.
llvm-svn: 275330
Matthias Braun [Wed, 13 Jul 2016 22:23:23 +0000 (22:23 +0000)]
MIRParser: Move MachineFunction reference into PFS; NFC
Code cleanup: The PerFunctionMIParsingState is per function, moving a
reference into PFS we can avoid passing around the MachineFunction in an
extra parameter most of the time.
Also change most signatures to consistently pass PFS reference first.
llvm-svn: 275329
Matthias Braun [Wed, 13 Jul 2016 22:23:19 +0000 (22:23 +0000)]
MIRYamlMapping: Update stale comment
llvm-svn: 275328
Nico Weber [Wed, 13 Jul 2016 22:19:40 +0000 (22:19 +0000)]
Add a triple to fix test on bots after 275320.
llvm-svn: 275327
Adam Nemet [Wed, 13 Jul 2016 22:18:51 +0000 (22:18 +0000)]
[LAA] Don't hold on to DataLayout in the analysis result
In fact, don't even pass this to the ctor since we can get it from the
module.
llvm-svn: 275326
Adam Nemet [Wed, 13 Jul 2016 22:18:48 +0000 (22:18 +0000)]
[LAA] Don't hold on to LoopInfo in the analysis result
llvm-svn: 275325
Argyrios Kyrtzidis [Wed, 13 Jul 2016 22:03:47 +0000 (22:03 +0000)]
[test] Add 'env' to fix test failures in windows bots.
llvm-svn: 275324
Kelvin Li [Wed, 13 Jul 2016 21:51:49 +0000 (21:51 +0000)]
[OpenMP] remove duplicate code in ActOnOpenMPRegionStart
This patch is to remove duplicate code in ActOnOpenMPRegionStart. (NFC)
Differential Revision: http://reviews.llvm.org/D22177
llvm-svn: 275323
Adam Nemet [Wed, 13 Jul 2016 21:39:09 +0000 (21:39 +0000)]
[LAA] Don't hold on to AliasAnalysis in the analysis result
llvm-svn: 275322
Vedant Kumar [Wed, 13 Jul 2016 21:38:36 +0000 (21:38 +0000)]
[llvm-cov] Use a thread pool to speed up report generation (NFC)
It's safe to print out source coverage views using multiple threads when
using the -output-dir mode of the `llvm-cov show` sub-command.
While testing this on my development machine, I observed that the speed
up is roughly linear with the number of available cores. Avg. time for
`llvm-cov show ./llvm-as -show-line-counts-or-regions`:
1 thread: 7.79s user 0.33s system 98% cpu 8.228 total
4 threads: 7.82s user 0.34s system 283% cpu 2.880 total
llvm-svn: 275321
Nico Weber [Wed, 13 Jul 2016 21:38:27 +0000 (21:38 +0000)]
Fix a TODO in X86CallFrameOptimization to not rely on a codegen artifact.
This happens to make X86CallFrameOptimization in -O0 / FastISel builds as well,
but it's not clear if the pass should run in that setup.
http://reviews.llvm.org/D22314
llvm-svn: 275320
Teresa Johnson [Wed, 13 Jul 2016 21:27:51 +0000 (21:27 +0000)]
Mark the textual headers in the module map for ProfileData
Follow on to r275312.
llvm-svn: 275319
Yaxun Liu [Wed, 13 Jul 2016 21:21:05 +0000 (21:21 +0000)]
[OpenCL] Fixes failures in test/Driver/opencl.cl.
Also fixes strict-aliasing option to only be allowed when OpenCL Version 1.0. Added testcase in test/Frontend/opencl-blocks.cl.
Patch by Aaron En Ye Shi.
Differential Revision: http://reviews.llvm.org/D22170
llvm-svn: 275318
Alina Sbirlea [Wed, 13 Jul 2016 21:20:01 +0000 (21:20 +0000)]
Extended LoadStoreVectorizer to vectorize subchains.
Summary:
LSV used to abort vectorizing a chain for interleaved load/store accesses that alias.
Allow a valid prefix of the chain to be vectorized, mark just the prefix and retry vectorizing the remaining chain.
Reviewers: llvm-commits, jlebar, arsenm
Subscribers: mzolotukhin
Differential Revision: http://reviews.llvm.org/D22119
llvm-svn: 275317
Lang Hames [Wed, 13 Jul 2016 21:13:05 +0000 (21:13 +0000)]
[Object] Change Archive::child_iterator for better interop with Error/Expected.
See http://reviews.llvm.org/D22079
Changes the Archive::child_begin and Archive::children to require a reference
to an Error. If iterator increment fails (because the archive header is
damaged) the iterator will be set to 'end()', and the error stored in the
given Error&. The Error value should be checked by the user immediately after
the loop. E.g.:
Error Err;
for (auto &C : A->children(Err)) {
// Do something with archive child C.
}
// Check the error immediately after the loop.
if (Err)
return Err;
Failure to check the Error will result in an abort() when the Error goes out of
scope (as guaranteed by the Error class).
llvm-svn: 275316
Kelvin Li [Wed, 13 Jul 2016 20:40:32 +0000 (20:40 +0000)]
[OpenMP] add more tests for 'distribute parallel for simd' pragma
This patch is to add two additional tests for testing 'distribute parallel for simd' pragma with disallowed clauses and loops.
Differential Revision: http://reviews.llvm.org/D22169
llvm-svn: 275315
Quentin Colombet [Wed, 13 Jul 2016 20:36:03 +0000 (20:36 +0000)]
[MIR] Print on the given output instead of stderr.
Currently the MIR framework prints all its outputs (errors and actual
representation) on stderr.
This patch fixes that by printing the regular output in the output
specified with -o.
Differential Revision: http://reviews.llvm.org/D22251
llvm-svn: 275314
Argyrios Kyrtzidis [Wed, 13 Jul 2016 20:35:26 +0000 (20:35 +0000)]
[PCH/preamble] Make sure that if the preamble/PCH was serialized with errors that we set diagnostic engine state appropriately.
Otherwise there can be a crash with CFG analysis warnings doing work on invalid AST.
Fixes crash of rdar://
26224134
llvm-svn: 275313
Teresa Johnson [Wed, 13 Jul 2016 20:19:09 +0000 (20:19 +0000)]
Define a module map entry for ProfileData.
As per Richard Smith, this should help avoid a modules bug exposed
by my r275216 commit:
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/17560
llvm-svn: 275312
Tobias Grosser [Wed, 13 Jul 2016 19:52:24 +0000 (19:52 +0000)]
PPCGCodegen: Support compilation without GPU support
llvm-svn: 275310
Matt Arsenault [Wed, 13 Jul 2016 19:42:06 +0000 (19:42 +0000)]
AMDGPU: Remove last AMDIL intrinsics
llvm-svn: 275309
Davide Italiano [Wed, 13 Jul 2016 19:33:25 +0000 (19:33 +0000)]
[SCCP] Factor out common code.
llvm-svn: 275308
Davide Italiano [Wed, 13 Jul 2016 19:23:30 +0000 (19:23 +0000)]
[SCCP] Use early return. NFCI.
llvm-svn: 275307
Kelvin Li [Wed, 13 Jul 2016 19:16:56 +0000 (19:16 +0000)]
[OpenMP] add more tests for 'distribute simd' pragma
This patch is to add two additional tests for testing 'distribute simd' pragma with disallowed clauses and loops.
Differential Revision: http://reviews.llvm.org/D22176
llvm-svn: 275306
Rui Ueyama [Wed, 13 Jul 2016 19:14:25 +0000 (19:14 +0000)]
Update the readme text.
llvm-svn: 275305
Andrew Kaylor [Wed, 13 Jul 2016 19:09:16 +0000 (19:09 +0000)]
Reverting r275284 due to platform-specific test failures
llvm-svn: 275304
Yaron Keren [Wed, 13 Jul 2016 19:04:51 +0000 (19:04 +0000)]
Implement FunctionDecl::getDefinition() to be consistent with
VarDecl, TagDecl, EnumDecl, RecordDecl, CXXRecordDecl.
Use getDefinition in two locations to make the code more readable.
llvm-svn: 275303
Sanjay Patel [Wed, 13 Jul 2016 18:58:55 +0000 (18:58 +0000)]
add more tests for zexty xor sandwiches
...mmm sandwiches
llvm-svn: 275302
Rui Ueyama [Wed, 13 Jul 2016 18:55:14 +0000 (18:55 +0000)]
Add GotEntrySize/GotPltEntrySize to ELF target.
Patch by H.J Lu.
For x86-64 psABI, the entry size of .got and .got.plt sections is 8
bytes for both LP64 and ILP32. Add GotEntrySize and GotPltEntrySize
to ELF target instead of using size of ELFT::uint. Now we can generate
a simple working x32 executable.
Differential Revision: http://reviews.llvm.org/D22288
llvm-svn: 275301
Simon Pilgrim [Wed, 13 Jul 2016 18:50:10 +0000 (18:50 +0000)]
[X86][SSE] Regenerate truncated shift test
Check SSE2 and AVX2 implementations
llvm-svn: 275300
Simon Pilgrim [Wed, 13 Jul 2016 18:46:37 +0000 (18:46 +0000)]
Regenerate test
llvm-svn: 275299
Rui Ueyama [Wed, 13 Jul 2016 18:40:59 +0000 (18:40 +0000)]
Rename VAStart -> ImageBase. NFC.
Config members are named after corresponding command line options.
This patch renames VAStart ImageBase so that they are in line with
--image-base.
Differential Revision: http://reviews.llvm.org/D22277
llvm-svn: 275298
Sanjay Patel [Wed, 13 Jul 2016 18:40:38 +0000 (18:40 +0000)]
add test for zexty xor sandwich
llvm-svn: 275297
Justin Lebar [Wed, 13 Jul 2016 18:38:20 +0000 (18:38 +0000)]
Fix header comment in unittests/CodeGen/DIEHashTest.cpp.
llvm-svn: 275296
Petr Hosek [Wed, 13 Jul 2016 18:31:44 +0000 (18:31 +0000)]
[ELF] Rename the test to reflect the option name
This is to follow the convention of naming the test after the name
of the option.
Differential Revision: http://reviews.llvm.org/D22276
llvm-svn: 275295
Krzysztof Parzyszek [Wed, 13 Jul 2016 18:28:45 +0000 (18:28 +0000)]
Move mempcpy_call.ll to X86 subdirectory
llvm-svn: 275294
Justin Lebar [Wed, 13 Jul 2016 18:27:49 +0000 (18:27 +0000)]
Fix warning in ObjectTransformLayerTest.
Doing "I++" inside of an EXPECT_* triggers
warning: expression with side effects has no effect in an unevaluated context
because EXPECT_* partially expands to
EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(MockObjects[I++] + 1)) == 1)>
which is an unevaluated context.
llvm-svn: 275293
Justin Lebar [Wed, 13 Jul 2016 18:23:16 +0000 (18:23 +0000)]
[ADT] Add LLVM_MARK_AS_BITMASK_ENUM, used to enable bitwise operations on enums without static_cast.
Summary: Normally when you do a bitwise operation on an enum value, you
get back an instance of the underlying type (e.g. int). But using this
macro, bitwise ops on your enum will return you back instances of the
enum. This is particularly useful for enums which represent a
combination of flags.
Suppose you have a function which takes an int and a set of flags. One
way to do this would be to take two numeric params:
enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
void Fn(int Num, int Flags);
void foo() {
Fn(42, F2 | F3);
}
But now if you get the order of arguments wrong, you won't get an error.
You might try to fix this by changing the signature of Fn so it accepts
a SomeFlags arg:
enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
void Fn(int Num, SomeFlags Flags);
void foo() {
Fn(42, static_cast<SomeFlags>(F2 | F3));
}
But now we need a static cast after doing "F2 | F3" because the result
of that computation is the enum's underlying type.
This patch adds a mechanism which gives us the safety of the second
approach with the brevity of the first.
enum SomeFlags {
F1 = 1, F2 = 2, F3 = 4, ..., F_MAX = 128,
LLVM_MARK_AS_BITMASK_ENUM(F_MAX)
};
void Fn(int Num, SomeFlags Flags);
void foo() {
Fn(42, F2 | F3); // No static_cast.
}
The LLVM_MARK_AS_BITMASK_ENUM macro enables overloads for bitwise
operators on SomeFlags. Critically, these operators return the enum
type, not its underlying type, so you don't need any static_casts.
An advantage of this solution over the previously-proposed BitMask class
[0, 1] is that we don't need any wrapper classes -- we can operate
directly on the enum itself.
The approach here is somewhat similar to OpenOffice's typed_flags_set
[2]. But we skirt the need for a wrapper class (and a good deal of
complexity) by judicious use of enable_if. We SFINAE on the presence of
a particular enumerator (added by the LLVM_MARK_AS_BITMASK_ENUM macro)
instead of using a traits class so that it's impossible to use the enum
before the overloads are present. The solution here also seamlessly
works across multiple namespaces.
[0] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20150622/283369.html
[1] http://lists.llvm.org/pipermail/llvm-commits/attachments/
20150623/
073434b6/attachment.obj
[2] https://cgit.freedesktop.org/libreoffice/core/tree/include/o3tl/typed_flags_set.hxx
Reviewers: chandlerc, rsmith
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D22279
llvm-svn: 275292
Justin Lebar [Wed, 13 Jul 2016 18:17:46 +0000 (18:17 +0000)]
Fix warnings in FunctionTest.cpp.
Because of the goop involved in the EXPECT_EQ macro, we were getting the
following warning
expression with side effects has no effect in an unevaluated context
because the "I++" was being used inside of a template type:
switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(Args[I++])) == 1)>::Compare("Args[I++]", "&A", Args[I++], &A))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "../src/unittests/IR/FunctionTest.cpp", 94, gtest_ar.failure_message()) = ::testing::Message();
llvm-svn: 275291
Artem Dergachev [Wed, 13 Jul 2016 18:07:26 +0000 (18:07 +0000)]
[analyzer] Implement a methond to discover origin region of a symbol.
This encourages checkers to make logical decisions depending on
value of which region was the symbol under consideration
introduced to denote.
A similar technique is already used in a couple of checkers;
they were modified to call the new method.
Differential Revision: http://reviews.llvm.org/D22242
llvm-svn: 275290
Sanjay Patel [Wed, 13 Jul 2016 18:07:02 +0000 (18:07 +0000)]
[InstCombine] extend vector select matching for non-splat constants
In D21740, we discussed trying to make this a more general matcher. However, I didn't see a clean
way to handle the regular m_Not cases and these non-splat vector patterns, so I've opted for the
direct approach here. If there are other potential uses of areInverseVectorBitmasks(), we could
move that helper function to a higher level.
There is an open question as to which is of these forms should be considered the canonical IR:
%sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> %a, <4 x i32> %b
%shuf = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
Differential Revision: http://reviews.llvm.org/D22114
llvm-svn: 275289
Marek Olsak [Wed, 13 Jul 2016 17:35:15 +0000 (17:35 +0000)]
AMDGPU/SI: Emit the number of SGPR and VGPR spills
Summary:
v2: don't count SGPRs spilled to scratch twice
I think this is sufficient. It doesn't count private memory usage, which
happens often and uses scratch but isn't technically a spill. The private
memory usage can be computed by:
[scratch_per_thread - vgpr_spills - a random multiple of SGPR spills].
The fact SGPR spills add very high numbers to the scratch size make that
computation a guessing game, but I don't have a solution to that.
Reviewers: tstellarAMD
Subscribers: arsenm, kzhuravl
Differential Revision: http://reviews.llvm.org/D22197
llvm-svn: 275288
Stephane Sezer [Wed, 13 Jul 2016 17:34:26 +0000 (17:34 +0000)]
Fix a check in the objc trampoline handler
Summary:
The function FunctionCaller::WriteFunctionArguments returns false on
errors, so they should check for the false return value.
Change by Walter Erquinigo <
a20012251@gmail.com>
Reviewers: jingham, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D22278
llvm-svn: 275287
Greg Clayton [Wed, 13 Jul 2016 17:25:55 +0000 (17:25 +0000)]
Remove comment that isn't needed anymore.
<rdar://problem/
24599697>
llvm-svn: 275285
Andrew Kaylor [Wed, 13 Jul 2016 17:25:11 +0000 (17:25 +0000)]
Fix for Bug 26903, adds support to inline __builtin_mempcpy
Patch by Sunita Marathe
Differential Revision: http://reviews.llvm.org/D21920
llvm-svn: 275284
David Blaikie [Wed, 13 Jul 2016 17:21:34 +0000 (17:21 +0000)]
PR28516: Fix LangRef description of call and invoke to match IR changes for typeless pointers
llvm-svn: 275283
Carlo Bertolli [Wed, 13 Jul 2016 17:16:49 +0000 (17:16 +0000)]
[OpenMP] Initial implementation of parse+sema for OpenMP clause 'is_device_ptr' of target
http://reviews.llvm.org/D22070
llvm-svn: 275282
Greg Clayton [Wed, 13 Jul 2016 17:12:24 +0000 (17:12 +0000)]
Centralize the way symbol and functions are looked up by making a Module::LookupInfo class that does all of the heavy lifting.
Background: symbols and functions can be looked up by full mangled name and by basename. SymbolFile and ObjectFile are expected to be able to do the lookups based on full mangled name or by basename, so when the user types something that is incomplete, we must be able to look it up efficiently. For example the user types "a::b::c" as a symbol to set a breakpoint on, we will break this down into a 'lookup "c"' and then weed out N matches down to just the ones that match "a::b::c". Previously this was done manaully in many functions by calling Module::PrepareForFunctionNameLookup(...) and then doing the lookup and manually pruning the results down afterward with duplicated code. Now all places use Module::LookupInfo to do the work in one place.
This allowed me to fix the name lookups to look for "func" with eFunctionNameTypeFull as the "name_type_mask", and correctly weed the results:
"func", "func()", "func(int)", "a::func()", "b::func()", and "a::b::func()" down to just "func", "func()", "func(int)". Previously we would have set 6 breakpoints, now we correctly set just 3. This also extends to the expression parser when it looks up names for functions it needs to not get multiple results so we can call the correct function.
<rdar://problem/
24599697>
llvm-svn: 275281
Marshall Clow [Wed, 13 Jul 2016 16:58:48 +0000 (16:58 +0000)]
Constuct a sentry object in istream::readsome, and handle failures appropriately. Fixes PR#28217.
llvm-svn: 275280
Haojian Wu [Wed, 13 Jul 2016 16:43:54 +0000 (16:43 +0000)]
[include-fixer] Implement adding missing namespace qualifiers in vim integration.
Summary:
The patch extends include-fixer's "-output-headers", and "-insert-headers"
command line options to make it dump more information (e.g. QualifiedSymbol),
so that vim-integration can add missing qualifiers.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D22299
llvm-svn: 275279
Matthias Braun [Wed, 13 Jul 2016 16:37:29 +0000 (16:37 +0000)]
PatchableFunction: Skip pseudos that do not create code
This fixes http://llvm.org/PR28524
llvm-svn: 275278
Teresa Johnson [Wed, 13 Jul 2016 16:35:56 +0000 (16:35 +0000)]
[ThinLTO/gold] Enable symbol resolution in distributed backend case
While testing a follow-on change to enable index-based symbol resolution
and internalization in the distributed backends, I realized that a test
case change I made in r275247 was only required because we were not
analyzing symbols in the claimed files in thinlto-index-only mode.
In the fixed test case there should be no internalization because we are
linking in -shared mode, so f() is in fact exported, which is detected
properly when we analyze symbols in thinlto-index-only mode. Note that
this is not (yet) a correctness issue (because we are not yet performing
the index-based linkage optimizations in the distributed backends -
that's coming in a follow-on patch).
llvm-svn: 275277
Sanjay Patel [Wed, 13 Jul 2016 16:04:07 +0000 (16:04 +0000)]
[x86][SSE/AVX] optimize pcmp results better (PR28484)
We know that pcmp produces all-ones/all-zeros bitmasks, so we can use that behavior to avoid unnecessary constant loading.
One could argue that load+and is actually a better solution for some CPUs (Intel big cores) because shifts don't have the
same throughput potential as load+and on those cores, but that should be handled as a CPU-specific later transformation if
it ever comes up. Removing the load is the more general x86 optimization. Note that the uneven usage of vpbroadcast in the
test cases is filed as PR28505:
https://llvm.org/bugs/show_bug.cgi?id=28505
Differential Revision: http://reviews.llvm.org/D22225
llvm-svn: 275276
Tobias Grosser [Wed, 13 Jul 2016 15:54:58 +0000 (15:54 +0000)]
Add accelerator code generation pass skeleton
Add a new pass to serve as basis for automatic accelerator mapping in Polly.
The pass structure and the analyses preserved are copied from
CodeGeneration.cpp, as we will rely on IslNodeBuilder and IslExprBuilder for
LLVM-IR code generation.
Polly's accelerator code generation is enabled with -polly-target=gpu
I would like to use this commit as opportunity to thank Yabin Hu for his work in
the context of two Google summer of code projects during which he implemented
initial prototypes of the Polly accelerator code generation -- in parts this
code is already available in todays Polly (e.g., tools/GPURuntime). More will
come as part of the upcoming Polly ACC changes.
Reviewers: Meinersbur
Subscribers: pollydev, llvm-commits
Differential Revision: http://reviews.llvm.org/D22036
llvm-svn: 275275
Tobias Grosser [Wed, 13 Jul 2016 15:54:47 +0000 (15:54 +0000)]
Add ppcg-0.04 to lib/External
ppcg will be used to provide mapping decisions for GPU code generation.
As we do not use C as input language, we do not include pet. However, we include
pet.h from pet
82cacb71 plus a set of dummy functions to ensure ppcg links
without problems.
The version of ppcg committed is unmodified ppcg-0.04 which has been well tested
in the context of LLVM. It does not provide an official library interface yet,
which means that in upcoming commits we will add minor modifications to make
necessary functionality accessible. We will aim to upstream these modifications
after we gained enough experience with GPU generation support in Polly to
propose a stable interface.
Reviewers: Meinersbur
Subscribers: pollydev, llvm-commits
Differential Revision: http://reviews.llvm.org/D22033
llvm-svn: 275274
David Majnemer [Wed, 13 Jul 2016 15:53:46 +0000 (15:53 +0000)]
[ConstantFolding] Use sdiv_ov
This is a simplification, there should be no functional change.
llvm-svn: 275273
Simon Pilgrim [Wed, 13 Jul 2016 15:45:36 +0000 (15:45 +0000)]
[X86][AVX512] Add support for VPERMILPD/VPERMILPS variable shuffle mask comments
llvm-svn: 275272
Carlo Bertolli [Wed, 13 Jul 2016 15:37:16 +0000 (15:37 +0000)]
[OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'
http://reviews.llvm.org/D21904
This patch is similar to the implementation of 'private' clause: it adds a list of private pointers to be used within the target data region to store the device pointers returned by the runtime.
Please refer to the following document for a full description of what the runtime witll return in this case (page 10 and 11):
https://github.com/clang-omp/OffloadingDesign
I am happy to answer any question related to the runtime interface to help reviewing this patch.
llvm-svn: 275271
Simon Pilgrim [Wed, 13 Jul 2016 15:10:43 +0000 (15:10 +0000)]
[X86][AVX] Add support for target shuffle combining to VPERMILPS variable shuffle mask
Added AVX512F VPERMILPS shuffle decoding support
llvm-svn: 275270
George Rimar [Wed, 13 Jul 2016 14:26:31 +0000 (14:26 +0000)]
[ELF] - Add predefined sections to output sections list in one place.
Minor cleanup.
Currently it looks wierd that having method addPredefinedSections()
we still add 2 sections outside it without real reasons.
Patch fixes that.
Differential revision: http://reviews.llvm.org/D19981
llvm-svn: 275269
Tom Stellard [Wed, 13 Jul 2016 14:23:33 +0000 (14:23 +0000)]
AMDGPU/SI: Add support for R_AMDGPU_GOTPCREL
Reviewers: rafael, ruiu, tony-tye, arsenm, kzhuravl
Subscribers: arsenm, llvm-commits, kzhuravl
Differential Revision: http://reviews.llvm.org/D21484
llvm-svn: 275268
Pierre Gousseau [Wed, 13 Jul 2016 14:21:11 +0000 (14:21 +0000)]
[PCH] Add a fno-pch-timestamp option to cc1 to disable inclusion of timestamps in PCH files.
This is to allow distributed build systems, that do not preserve time stamps, to use PCH files.
Second and last part of the patch proposed at:
Differential Revision: http://reviews.llvm.org/D20867
llvm-svn: 275267
Nirav Dave [Wed, 13 Jul 2016 14:20:41 +0000 (14:20 +0000)]
Rename llc's -fpreserve-as-comments flag -preserve-as-comments.
llvm-svn: 275266