Commit Graph

303709 Commits

Author SHA1 Message Date
Craig Topper 17fa42a69b [X86] Preserve undef information when creating a punpckl/hbw from a v16i8 where all the even or odd elements are undef.
Previously if V2 was unused we ended up using V1 for both inputs as part of the code that follows the new code. By using lowerVectorShuffleWithUNPCK we keep the undef nature of V2 in the output.

As near as I can tell this makes v16i8 behavior consistent with every other VT now.

This does mean that we give the register allocator freedom to fill in random registers now and create false dependencies. But like I said we're already doing that for other types.

llvm-svn: 347296
2018-11-20 09:04:01 +00:00
Craig Topper b06d1aa3a1 [X86] Add custom type legalization for v8i8->v8i32 sign extend pre-SSE4.1
This helps with a future patch and makes us less reliant on DAG combine merging shuffles.

llvm-svn: 347295
2018-11-20 09:03:58 +00:00
Bill Wendling 107b0e9881 Use is.constant intrinsic for __builtin_constant_p
Summary:
A __builtin_constant_p may end up with a constant after inlining. Use
the is.constant intrinsic if it's a variable that's in a context where
it may resolve to a constant, e.g., an argument to a function after
inlining.

Reviewers: rsmith, shafik

Subscribers: jfb, kristina, cfe-commits, nickdesaulniers, jyknight

Differential Revision: https://reviews.llvm.org/D54355

llvm-svn: 347294
2018-11-20 08:53:30 +00:00
Fangrui Song cabb36d38d [libclang] Unify getCursorDecl and getCursorParentDecl
They do the same thing, thus the latter (which has only 2 call sites) can be deleted.

llvm-svn: 347293
2018-11-20 08:00:00 +00:00
Craig Topper c733c7bf94 [X86] Replace more calls to getZeroVector with regular getConstant.
getZeroVector produces a specifically canonicalized zero vector, but we can just let DAG legalization take care of it.

The test changes are because MULH lowering happens later than it should and this change gave us the opportunity to constant fold away a multiply during a DAG combine before the build_vector got legalized with a bitcast.

llvm-svn: 347290
2018-11-20 06:54:01 +00:00
Max Kazantsev c04b5307d1 Recommit "[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches"
The initial version of patch lacked Phi nodes updates in destinations of removed
edges. This version contains this update and tests on this situation.

Differential Revision: https://reviews.llvm.org/D54021

llvm-svn: 347289
2018-11-20 05:43:32 +00:00
Nemanja Ivanovic 9b393909e2 [PowerPC] Don't combine to bswap store on 1-byte truncating store
Turns out that there was no check for a store that truncates down
to a single byte when combining a (store (bswap...)) into a byte-swapping
store. This patch just adds that check.

Fixes https://bugs.llvm.org/show_bug.cgi?id=39478.

llvm-svn: 347288
2018-11-20 04:42:31 +00:00
Craig Topper 4954c66430 [SelectionDAG] Compute known bits and num sign bits for live out vector registers. Use it to add AssertZExt/AssertSExt in the live in basic blocks
Summary:
We already support this for scalars, but it was explicitly disabled for vectors. In the updated test cases this allows us to see the upper bits are zero to use less multiply instructions to emulate a 64 bit multiply.

This should help with this ispc issue that a coworker pointed me to https://github.com/ispc/ispc/issues/1362

Reviewers: spatel, efriedma, RKSimon, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D54725

llvm-svn: 347287
2018-11-20 04:30:26 +00:00
Dean Michael Berris 388af45f18 [XRay] Add a test for allocator exhaustion
Use a more representative test of allocating small chunks for
oddly-sized (small) objects from an allocator that has a page's worth of
memory.

llvm-svn: 347286
2018-11-20 03:56:04 +00:00
Matthew Voss 25e44e7c33 Ensure FileManagerTest expects "\\" as path separator on Windows platforms
llvm-svn: 347284
2018-11-20 03:30:28 +00:00
Jonas Devlieghere 312a46a94a Skip TestTargetCreateDeps
Skip this test because Windows deals differently with shared libraries.

llvm-svn: 347283
2018-11-20 01:18:49 +00:00
Peter Collingbourne b5e19658a2 Driver: SCS is compatible with every other sanitizer.
Because SCS relies on system-provided runtime support, we can use it
together with any other sanitizer simply by linking the runtime for
the other sanitizer.

Differential Revision: https://reviews.llvm.org/D54735

llvm-svn: 347282
2018-11-20 01:01:49 +00:00
Lang Hames a4d5b34f73 [ExecutionEngine][Interpreter] Fix out-of-bounds array access.
If args is empty then accesing element 0 is illegal.

https://reviews.llvm.org/D53556

Patch by Eugene Sharygin. Thanks Eugene!

llvm-svn: 347281
2018-11-20 01:01:26 +00:00
Dean Michael Berris ba02cb58cf [XRay] Move buffer extents back to the heap
Summary:
This change addresses an issue which shows up with the synchronised race
between threads writing into a buffer, and another thread reading the
buffer.

In a lot of cases, we cannot guarantee that threads will always see the
signal to finalise their buffers in time despite the grace periods and
state machine maintained through atomic variables. This change addresses
it by ensuring that the same instance being updated to indicate how much
of the buffer is "used" by the writing thread is the same instance being
read by the thread processing the buffer to be written out to disk or
handled through the iterators.

To do this, we ensure that all the "extents" instances live in their own
the backing store, in a different contiguous page from the
buffer-specific backing store. We also take precautions to ensure that
the atomic variables are cache-line-sized to prevent false-sharing from
unnecessarily causing cache contention on unrelated writes/reads.

It's feasible that we may in the future be able to move the storage of
the extents objects into the single backing store, slightly changing the
way to compute the size(s) of the buffers, but in the meantime we'll
settle for the isolation afforded by having a different backing store
for the extents instances.

Reviewers: mboerger

Subscribers: jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D54684

llvm-svn: 347280
2018-11-20 01:00:26 +00:00
Petr Hosek 8e0e35a3f5 [compiler-rt] Use zx_futex_wait_deprecated for Fuchsia sanitizer runtime
This change is part of the soft-transition to the new synchronization
primitives which implement priority inheritance.

Differential Revision: https://reviews.llvm.org/D54727

llvm-svn: 347279
2018-11-20 00:55:20 +00:00
Sanjay Patel a36c444471 [DAGCombiner] reduce code duplication in visitXOR; NFC
llvm-svn: 347278
2018-11-20 00:51:45 +00:00
Heejin Ahn 38b12f5e70 [WebAssembly] Remove unused function return types (NFC)
Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54734

llvm-svn: 347277
2018-11-20 00:38:10 +00:00
Zachary Turner b35e1d7dc3 [CodeView] Don't print PointerAttributes when dumping.
PointerAttributes is a bitwise-or of several other fields, each of
which is already printed on its own line with a better explanation.
So this doesn't really help much.

llvm-svn: 347275
2018-11-20 00:10:27 +00:00
Stanislav Mekhanoshin 54ebfe8aee Implement computeKnownBits for scalar_to_vector
Differential Revision: https://reviews.llvm.org/D54728

llvm-svn: 347274
2018-11-19 23:34:07 +00:00
Heejin Ahn 6f4286fb97 [WebAssembly] Fix inaccurate comments / assertion messages
Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54688

llvm-svn: 347273
2018-11-19 23:31:28 +00:00
Heejin Ahn aeaab9925e [WebAssembly] Make starting indices calcaulation simpler (NFC)
Summary:
At the beginning of `assignIndexes() function, when `FunctionIndex` and
`GlobalIndex` variables are created, `InputFunctions` and `InputGlobals`
vectors are guaranteed to be empty, because those vectors are only
populated in `assignIndexes()` function. Current code looks like they
are nonempty, so this patch deletes them for better readability.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54687

llvm-svn: 347272
2018-11-19 23:21:25 +00:00
Paul Robinson f536cb0481 It's its
llvm-svn: 347271
2018-11-19 22:53:42 +00:00
Kamil Rytarowski 74abaf8cdc Add interceptor for the setvbuf(3) from NetBSD
Summary:
setvbuf(3) is a routine to setup stream buffering.

Enable the interceptor for NetBSD.

Add dedicated tests for setvbuf(3) and functions
on top of this interface: setbuf, setbuffer, setlinebuf.

Based on original work by Yang Zheng.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: devnexen, tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D54548

llvm-svn: 347270
2018-11-19 22:44:26 +00:00
Reid Kleckner 994a8451ba [Transforms] Prefer static and avoid namespaces, NFC
Put 'static' on three functions in an anonymous namespace as per our
coding style.

Remove the 'namespace llvm {}' around the .cpp file and explicitly
declare the free function 'llvm::optimizeGlobalCtorsList' in 'llvm::'.
I prefer this style for free functions because the compiler will error
out if the .h and .cpp files don't agree on the function name or
prototype.

llvm-svn: 347269
2018-11-19 22:19:05 +00:00
Craig Topper 808d0dd689 [X86] Rename combineVSZext->combineExtendVectorInreg. NFC
Now that we no longer have target specific vector extend nodes let's make the function name match the nodes we do use.

llvm-svn: 347268
2018-11-19 22:18:47 +00:00
Louis Dionne cc870190d8 [NFC][libcxx] Fix incorrect comments
llvm-svn: 347267
2018-11-19 22:06:42 +00:00
Craig Topper dbe3473634 [X86] Add test case to show missed opportunity to use a single pmuludq to implement a multiply when a zext lives in another basic block.
This can occur when one of the inputs to the multiply is loop invariant. Though my test cases just use two basic blocks with an unconditional jump which we won't merge until after isel in the codegen pipeline.

For scalars, I believe SelectionDAGBuilder can add an AssertZExt to pass knowledge across basic blocks but its explicitly disabled for vectors.

llvm-svn: 347266
2018-11-19 22:04:12 +00:00
Konstantin Zhuravlyov 700b1ef54d AMDGPU: Fix V_FMA_F16 selection on GFX9
GFX9 should select opsel version.

Differential Revision: https://reviews.llvm.org/D54545

llvm-svn: 347265
2018-11-19 21:10:16 +00:00
Louis Dionne 70c4858892 [libcxx] Fix XFAIL for GCC 4.9
The XFAIL started passing since we're only testing for trivial-copyability of
reference_wrapper in C++14 and above. This commit constrains the XFAIL to
gcc-4.9 with C++14 (it would also fail on C++17 and above, but those standards
are not available with GCC 4.9).

llvm-svn: 347264
2018-11-19 20:53:38 +00:00
Louis Dionne e0ac069286 [libcxx] Update test of trivial copyability of reference_wrapper
N4151 is not an extension anymore, it was standardized in C++14.

llvm-svn: 347263
2018-11-19 20:21:45 +00:00
Vedant Kumar 0c3e3115e8 [Coverage] Fix PR39258: support coverage regions that start deeper than they end
popRegions used to assume that the start location of a region can't be
nested deeper than the end location, which is not always true.

Patch by Orivej Desh!

Differential Revision: https://reviews.llvm.org/D53244

llvm-svn: 347262
2018-11-19 20:10:22 +00:00
Vedant Kumar c9a9531a03 [Sema] Fix PR38987: keep end location of a direct initializer list
If PerformConstructorInitialization of a direct initializer list constructor is
called while instantiating a template, it has brace locations in its BraceLoc
arguments but not in the Kind argument.

This reverts the hunk https://reviews.llvm.org/D41921#inline-468844.

Patch by Orivej Desh!

Differential Revision: https://reviews.llvm.org/D53231

llvm-svn: 347261
2018-11-19 20:10:21 +00:00
Benjamin Kramer fdd9b4fc8f Revert "[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches"
This reverts commits r347183 & r347184. Crashes while building libxml.

llvm-svn: 347260
2018-11-19 20:01:20 +00:00
Stanislav Mekhanoshin 8bafbae889 [AMDGPU] Restored selection of scalar_to_vector (v2x16)
This works if DAG combiner is enabled, but without combining
we cannot select scalar_to_vector of <2 x half> and <2 x i16>.

Differential Revision: https://reviews.llvm.org/D54718

llvm-svn: 347259
2018-11-19 19:58:13 +00:00
Roman Lebedev d677c3fc61 [clang][CodeGen] Implicit Conversion Sanitizer: discover the world of CompoundAssign operators
Summary:
As reported by @regehr (thanks!) on twitter (https://twitter.com/johnregehr/status/1057681496255815686),
we (me) has completely forgot about the binary assignment operator.
In AST, it isn't represented as separate `ImplicitCastExpr`'s,
but as a single `CompoundAssignOperator`, that does all the casts internally.
Which means, out of these two, only the first one is diagnosed:
```
auto foo() {
    unsigned char c = 255;
    c = c + 1;
    return c;
}
auto bar() {
    unsigned char c = 255;
    c += 1;
    return c;
}
```
https://godbolt.org/z/JNyVc4

This patch does handle the `CompoundAssignOperator`:
```
int main() {
  unsigned char c = 255;
  c += 1;
  return c;
}
```
```
$ ./bin/clang -g -fsanitize=integer /tmp/test.c && ./a.out
/tmp/test.c:3:5: runtime error: implicit conversion from type 'int' of value 256 (32-bit, signed) to type 'unsigned char' changed the value to 0 (8-bit, unsigned)
    #0 0x2392b8 in main /tmp/test.c:3:5
    #1 0x7fec4a612b16 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x22b16)
    #2 0x214029 in _start (/build/llvm-build-GCC-release/a.out+0x214029)
```

However, the pre/post increment/decrement is still not handled.

Reviewers: rsmith, regehr, vsk, rjmccall, #sanitizers

Reviewed By: rjmccall

Subscribers: mclow.lists, cfe-commits, regehr

Tags: #clang, #sanitizers

Differential Revision: https://reviews.llvm.org/D53949

llvm-svn: 347258
2018-11-19 19:56:43 +00:00
Vedant Kumar 238533ec2e [InstCombine] Set debug loc on `mergeStoreIntoSuccessor` phi
Assigning a merged debug location to the `mergeStoreIntoSuccessor` phi
improves backtrace quality.

Fixes llvm.org/PR38083.

llvm-svn: 347257
2018-11-19 19:55:02 +00:00
Vedant Kumar 4de31bba51 [IR] Add hasNPredecessors, hasNPredecessorsOrMore to BasicBlock
Add methods to BasicBlock which make it easier to efficiently check
whether a block has N (or more) predecessors.

This can be more efficient than using pred_size(), which is a linear
time operation.

We might consider adding similar methods for successors. I haven't done
so in this patch because succ_size() is already O(1).

With this patch applied, I measured a 0.065% compile-time reduction in
user time for running `opt -O3` on the sqlite3 amalgamation (30 trials).
The change in mergeStoreIntoSuccessor alone saves 45 million linked list
iterations in a stage2 Release build of llc.

See llvm.org/PR39702 for a harder but more general way of achieving
similar results.

Differential Revision: https://reviews.llvm.org/D54686

llvm-svn: 347256
2018-11-19 19:54:27 +00:00
Simon Pilgrim 740122fb8c [DAGCombine] SimplifyNodeWithTwoResults - ensure same legalization for LO/HI operands (PR21207)
Consistently use (!LegalOperations || isOperationLegalOrCustom) for all node pairs.

Differential Revision: https://reviews.llvm.org/D53478

llvm-svn: 347255
2018-11-19 19:37:59 +00:00
Reid Kleckner c6846a812b Fix clang test suite on Windows by reverting part of r347216
Otherwise, the clang analyzer tests fail on Windows when attempting to
unpickle AnalyzerTest objects in the worker processes. The pattern of,
add to path, import, remove from path, serialize, deserialize, doesn't
work. Once something gets added to the path, if we want to move it
across the wire for multiprocessing, we need to keep the module on
sys.path.

llvm-svn: 347254
2018-11-19 19:36:28 +00:00
Simon Pilgrim 01f4c4be90 Fix Wdocumentation warning. NFCI.
llvm-svn: 347253
2018-11-19 19:18:33 +00:00
Simon Pilgrim 493ac5320b Fix unused function warning.
llvm-svn: 347252
2018-11-19 19:18:00 +00:00
Simon Pilgrim de3605f56b [TargetLowering] expandFP_TO_UINT - improve fp16 support
As discussed on D53794, for float types with ranges smaller than the destination integer type, then we should be able to just use a regular FP_TO_SINT opcode.

I thought we'd need to provide MSA test cases for very small integer types as well (fp16 -> i8 etc.), but it turns out that promotion will kick in so they're unnecessary.

Differential Revision: https://reviews.llvm.org/D54703

llvm-svn: 347251
2018-11-19 19:16:13 +00:00
Roman Lebedev f284803213 [IR] DISubprogram::toSPFlags(): fix "enumeral and non-enumeral type in conditional expression"
/build/llvm/include/llvm/IR/DebugInfoMetadata.h: In static member function ‘static llvm::DISubprogram::DISPFlags llvm::DISubprogram::toSPFlags(bool, bool, bool, unsigned int)’:
/build/llvm/include/llvm/IR/DebugInfoMetadata.h:1636:50: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
                                   (IsLocalToUnit ? SPFlagLocalToUnit : 0) |
                                    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/build/llvm/include/llvm/IR/DebugInfoMetadata.h:1637:49: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
                                   (IsDefinition ? SPFlagDefinition : 0) |
                                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/build/llvm/include/llvm/IR/DebugInfoMetadata.h:1638:48: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
                                   (IsOptimized ? SPFlagOptimized : 0));
                                    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

llvm-svn: 347250
2018-11-19 19:07:03 +00:00
Simon Pilgrim 9ad5717fcc Add missing stream operator for Polynomial class to fix debug builds.
llvm-svn: 347249
2018-11-19 18:57:49 +00:00
Craig Topper a5e0380c30 [X86][CostModel] Don't lookup intrinsic cost tables if the intrinsic isn't one we care about
We're seeing some issues internally where we sent some intrinsics into the cost model that the getTypeLegalizationCost call fails on, but X86 specific tables don't care about. Our base class implementation takes care of them. We'd just like X86 backend to ignore them.

This patch makes sure the switch returned something X86 cares about and skips the table lookups and type legalization call if not. Probably more efficient too since we don't go scanning the tables for every intrinsic we could possibly see.

Differential Revision: https://reviews.llvm.org/D54711

llvm-svn: 347248
2018-11-19 18:57:31 +00:00
Simon Pilgrim 0a1cb71e64 Add missing closing bracket.
llvm-svn: 347247
2018-11-19 18:54:34 +00:00
Paul Robinson fdaeb0c647 Fix build break from r347239
llvm-svn: 347246
2018-11-19 18:51:11 +00:00
Simon Pilgrim 987c253e5a Fix Wdocumentation warning. NFCI.
llvm-svn: 347245
2018-11-19 18:46:40 +00:00
Eric Fiselier 9c97ca1b99 Add docker configurations used by the buildbots.
These are the scripts I use to create the docker images for
the build bots and run them.

llvm-svn: 347244
2018-11-19 18:43:31 +00:00
Stella Stamenova c01fc1c696 [lldbsuite] Invoke sed on Windows to determine the cache dir for clang
Summary: In order to invoke sed on Windows, we need to quote the command correctly. Since we already have commands which do that, move the definitions at the beginning of the file and then re-use them for each command.

Reviewers: aprantl, zturner

Subscribers: teemperor, lldb-commits

Differential Revision: https://reviews.llvm.org/D54709

llvm-svn: 347243
2018-11-19 18:41:33 +00:00