]> granicus.if.org Git - llvm/log
llvm
5 years ago[X86] Add fp128 test cases for ceil/floor/trunc/nearbyint/rint/round libcalls.
Craig Topper [Mon, 9 Sep 2019 02:44:46 +0000 (02:44 +0000)]
[X86] Add fp128 test cases for ceil/floor/trunc/nearbyint/rint/round libcalls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371360 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp
Kai Luo [Mon, 9 Sep 2019 02:32:42 +0000 (02:32 +0000)]
[MachineCopyPropagation] Remove redundant copies after TailDup via machine-cp

Summary:
After tailduplication, we have redundant copies. We can remove these
copies in machine-cp if it's safe to, i.e.
```
$reg0 = OP ...
... <<< No read or clobber of $reg0 and $reg1
$reg1 = COPY $reg0 <<< $reg0 is killed
...
<RET>
```
will be transformed to
```
$reg1 = OP ...
...
<RET>
```

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371359 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test cases for fptoui/fptosi/sitofp/uitofp between fp128 and i128.
Craig Topper [Mon, 9 Sep 2019 01:35:04 +0000 (01:35 +0000)]
[X86] Add test cases for fptoui/fptosi/sitofp/uitofp between fp128 and i128.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371358 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use xorps to create fp128 +0.0 constants.
Craig Topper [Mon, 9 Sep 2019 01:35:00 +0000 (01:35 +0000)]
[X86] Use xorps to create fp128 +0.0 constants.

This matches what we do for f32/f64. gcc also does this for fp128.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371357 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add avx and avx512f RUN lines to fp128-cast.ll
Craig Topper [Mon, 9 Sep 2019 01:34:55 +0000 (01:34 +0000)]
[X86] Add avx and avx512f RUN lines to fp128-cast.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371356 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRelax opcode checks in test to check for only a number instead of a specific number.
Douglas Yung [Mon, 9 Sep 2019 01:21:33 +0000 (01:21 +0000)]
Relax opcode checks in test to check for only a number instead of a specific number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371355 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - add faux shuffle support.
Simon Pilgrim [Sun, 8 Sep 2019 21:38:33 +0000 (21:38 +0000)]
[X86][SSE] SimplifyDemandedVectorEltsForTargetNode - add faux shuffle support.

This patch decodes target and faux shuffles with getTargetShuffleInputs - a reduced version of resolveTargetShuffleInputs that doesn't resolve SM_SentinelZero cases, so we can correctly remove zero vectors if they aren't demanded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371353 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][NFC] Some tests for usub overflow+nonzero check improvement (PR43251)
Roman Lebedev [Sun, 8 Sep 2019 21:30:34 +0000 (21:30 +0000)]
[InstCombine][NFC] Some tests for usub overflow+nonzero check improvement (PR43251)

https://rise4fun.com/Alive/kHq

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371352 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a hack to combineVSelectWithAllOnesOrZeros to turn selects with two zero...
Craig Topper [Sun, 8 Sep 2019 20:56:09 +0000 (20:56 +0000)]
[X86] Add a hack to combineVSelectWithAllOnesOrZeros to turn selects with two zero/undef vector inputs into an all zeroes vector.

If the two zero vectors have undefs in different places they
won't get combined by simplifySelect.

This fixes a regression from an earlier commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371351 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove call to getZeroVector from materializeVectorConstant. Add isel patterns...
Craig Topper [Sun, 8 Sep 2019 20:56:05 +0000 (20:56 +0000)]
[X86] Remove call to getZeroVector from materializeVectorConstant. Add isel patterns for zero vectors with all types.

The change to avx512-vec-cmp.ll is a regression, but should be
easy to fix. It occurs because the getZeroVector call was
canonicalizing both sides to the same node, then SimplifySelect
was able to simplify it. But since only called getZeroVector
on some VTs this isn't a robust way to combine this.

The change to vector-shuffle-combining-ssse3.ll is more
instructions, but removes a constant pool load so its unclear
if its a regression or not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371350 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstSimplify] simplifyUnsignedRangeCheck(): if we know that X != 0, handle more...
Roman Lebedev [Sun, 8 Sep 2019 20:14:15 +0000 (20:14 +0000)]
[InstSimplify] simplifyUnsignedRangeCheck(): if we know that X != 0, handle more cases (PR43246)

Summary:
This is motivated by D67122 sanitizer check enhancement.
That patch seemingly worsens `-fsanitize=pointer-overflow`
overhead from 25% to 50%, which strongly implies missing folds.

In this particular case, given
```
char* test(char& base, unsigned long offset) {
  return &base + offset;
}
```
it will end up producing something like
https://godbolt.org/z/LK5-iH
which after optimizations reduces down to roughly
```
define i1 @t0(i8* nonnull %base, i64 %offset) {
  %base_int = ptrtoint i8* %base to i64
  %adjusted = add i64 %base_int, %offset
  %non_null_after_adjustment = icmp ne i64 %adjusted, 0
  %no_overflow_during_adjustment = icmp uge i64 %adjusted, %base_int
  %res = and i1 %non_null_after_adjustment, %no_overflow_during_adjustment
  ret i1 %res
}
```
Without D67122 there was no `%non_null_after_adjustment`,
and in this particular case we can get rid of the overhead:

Here we add some offset to a non-null pointer,
and check that the result does not overflow and is not a null pointer.
But since the base pointer is already non-null, and we check for overflow,
that overflow check will already catch the null pointer,
so the separate null check is redundant and can be dropped.

Alive proofs:
https://rise4fun.com/Alive/WRzq

There are more patterns of "unsigned-add-with-overflow", they are not handled here,
but this is the main pattern, that we currently consider canonical,
so it makes sense to handle it.

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

Reviewers: spatel, nikic, vsk

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits, reames

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371349 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for icmp with srem operand; NFC
Sanjay Patel [Sun, 8 Sep 2019 19:48:47 +0000 (19:48 +0000)]
[InstCombine] add tests for icmp with srem operand; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371348 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] X86DAGToDAGISel::combineIncDecVector(): call getSplatBuildVector() manually
Roman Lebedev [Sun, 8 Sep 2019 19:36:13 +0000 (19:36 +0000)]
[X86] X86DAGToDAGISel::combineIncDecVector(): call getSplatBuildVector() manually

As reported in post-commit review of r370327,
there is some case where the code crashes.

As discussed with Craig Topper, the problem is that getConstant()
internally calls getSplatBuildVector(), so we don't insert
the constant itself.

If we do that manually we're good.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371346 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use DAG.getConstant instead of getZeroVector in combinePMULDQ.
Craig Topper [Sun, 8 Sep 2019 19:24:42 +0000 (19:24 +0000)]
[X86] Use DAG.getConstant instead of getZeroVector in combinePMULDQ.

getZeroVector canonicalizes the type to vXi32, but that's a
legalization action. We should use the most correct type if
possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371345 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner][X86][ARM] Teach visitMULO to fold multiplies with 0 to 0 and no carry.
Craig Topper [Sun, 8 Sep 2019 19:24:39 +0000 (19:24 +0000)]
[DAGCombiner][X86][ARM] Teach visitMULO to fold multiplies with 0 to 0 and no carry.

I modified the ARM test to use two inputs instead of 0 so the
test hopefully still tests what was intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371344 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Teach materializeVectorConstant to not call getZeroVector/getOnesVector on...
Craig Topper [Sun, 8 Sep 2019 19:24:29 +0000 (19:24 +0000)]
[X86] Teach materializeVectorConstant to not call getZeroVector/getOnesVector on the types we already have isel patterns for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371343 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] fold extract+insert into identity shuffle
Sanjay Patel [Sun, 8 Sep 2019 19:03:01 +0000 (19:03 +0000)]
[InstCombine] fold extract+insert into identity shuffle

This is similar to the existing fold for splats added with:
rL365379

If we can adjust the shuffle mask to include another element
in an identity mask (if it changes vector length, that's an
extract/insert subvector operation in the backend), then that
can eliminate extractelement/insertelement pairs in IR.

All targets are expected to lower shuffles with identity masks
efficiently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371340 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstSimplify] Some tests for dropping null check after uadd.with.overflow of...
Roman Lebedev [Sun, 8 Sep 2019 17:50:40 +0000 (17:50 +0000)]
[NFC][InstSimplify] Some tests for dropping null check after uadd.with.overflow of non-null (PR43246)

https://rise4fun.com/Alive/WRzq

Name: C <= Y && Y != 0  -->  C <= Y  iff C != 0
Pre: C != 0
  %y_is_nonnull = icmp ne i64 %y, 0
  %no_overflow = icmp ule i64 C, %y
  %r = and i1 %y_is_nonnull, %no_overflow
=>
  %r = %no_overflow

Name: C <= Y || Y != 0  -->  Y != 0  iff C != 0
Pre: C != 0
  %y_is_nonnull = icmp ne i64 %y, 0
  %no_overflow = icmp ule i64 C, %y
  %r = or i1 %y_is_nonnull, %no_overflow
=>
  %r = %y_is_nonnull

Name: C > Y || Y == 0  -->  C > Y  iff C != 0
Pre: C != 0
  %y_is_null = icmp eq i64 %y, 0
  %overflow = icmp ugt i64 C, %y
  %r = or i1 %y_is_null, %overflow
=>
  %r = %overflow

Name: C > Y && Y == 0  -->  Y == 0  iff C != 0
Pre: C != 0
  %y_is_null = icmp eq i64 %y, 0
  %overflow = icmp ugt i64 C, %y
  %r = and i1 %y_is_null, %overflow
=>
  %r = %y_is_null

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371339 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo][X86] Describe call site values for zero-valued imms
David Stenberg [Sun, 8 Sep 2019 14:22:06 +0000 (14:22 +0000)]
[DebugInfo][X86] Describe call site values for zero-valued imms

Summary:
Add zero-materializing XORs to X86's describeLoadedValue() hook in order
to produce call site values.

I have had to change the defs logic in collectCallSiteParameters() a bit
to be able to describe the XORs. The XORs implicitly define $eflags,
which would cause them to never be considered, due to a guard condition
that I->getNumDefs() is one. I have changed that condition so that we
now only consider instructions where a forwarded register overlaps with
the instruction's single explicit define. We still need to collect the implicit
defines of other forwarded registers to remove them from the work list.
I'm not sure how to move towards supporting instructions with multiple
explicit defines, cases where forwarded register are implicitly defined,
and/or cases where an instruction produces values for multiple forwarded
registers. Perhaps the describeLoadedValue() hook should take a register
argument, and we then leave it up to the hook to describe the loaded
value in that register? I have not yet encountered a situation where
that would be necessary though.

Reviewers: aprantl, vsk, djtodoro, NikolaPrica

Reviewed By: vsk

Subscribers: ychen, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371333 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Make the describeLoadedValue() hook return machine operand objects
David Stenberg [Sun, 8 Sep 2019 14:05:10 +0000 (14:05 +0000)]
[NFC] Make the describeLoadedValue() hook return machine operand objects

Summary:
This changes the ParamLoadedValue pair which the describeLoadedValue()
hook returns so that MachineOperand objects are returned instead of
pointers.

When describing call site values we may need to describe operands which
are not part of the instruction. One such example is zero-materializing
XORs on x86, which I have implemented support for in a child revision.
Instead of having to return a pointer to an operand stored somewhere
outside the instruction, start returning objects directly instead, as
that simplifies the code.

The MachineOperand class only holds POD members, and on x86-64 it is 32
bytes large. That combined with copy elision means that the overhead of
returning a machine operand object from the hook does not become very
large.

I benchmarked this on a 8-thread i7-8650U machine with 32 GB RAM. The
benchmark consisted of building a clang 8.0 binary configured with:

  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DLLVM_TARGETS_TO_BUILD=X86 \
  -DLLVM_USE_SANITIZER=Address \
  -DCMAKE_CXX_FLAGS="-Xclang -femit-debug-entry-values -stdlib=libc++"

The average wall clock time increased by 4 seconds, from 62:05 to
62:09, which is an 0.1% increase.

Reviewers: aprantl, vsk, djtodoro, NikolaPrica

Reviewed By: vsk

Subscribers: hiraditya, ychen, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371332 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Remove declaration of unimplemented function. NFC.
David Green [Sun, 8 Sep 2019 13:13:15 +0000 (13:13 +0000)]
[ARM] Remove declaration of unimplemented function. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371331 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Fix out of range shift introduced in D67070/rL371328
Simon Pilgrim [Sun, 8 Sep 2019 12:44:22 +0000 (12:44 +0000)]
[X86][SSE] Fix out of range shift introduced in D67070/rL371328

Use APInt to create the comparison mask instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371330 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test case for PR32546
Simon Pilgrim [Sun, 8 Sep 2019 11:56:07 +0000 (11:56 +0000)]
[X86] Add test case for PR32546

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371329 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add support for <64 x i1> bool reduction
Simon Pilgrim [Sun, 8 Sep 2019 11:46:21 +0000 (11:46 +0000)]
[X86][SSE] Add support for <64 x i1> bool reduction

This generalizes the existing <32 x i1> pre-AVX2 split code to support reductions from <64 x i1> as well, we can probably generalize to any larger pow2 case in the future if the (unlikely) need ever arises.

We still need to tweak combineBitcastvxi1 to improve AVX512F codegen as its assumes vXi1 types should be handled on the mask registers even when they aren't legal.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371328 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[StackMap] Current stackmap version should be 3. NFC.
Xing GUO [Sun, 8 Sep 2019 11:42:51 +0000 (11:42 +0000)]
[StackMap] Current stackmap version should be 3. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371327 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Make getZeroVector return floating point vectors in their native type on SSE2...
Craig Topper [Sun, 8 Sep 2019 00:43:52 +0000 (00:43 +0000)]
[X86] Make getZeroVector return floating point vectors in their native type on SSE2 and later.

isel used to require zero vectors to be canonicalized to a single
type to minimize the number of patterns needed to match. This is
 no longer required.

I plan to do this to integers too, but floating point was simpler
to start with. Integer has a complication where v32i16/v64i8 aren't
legal when the other 512-bit integer types are.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371325 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add support for unfold broadcast loads from FMA instructions.
Craig Topper [Sat, 7 Sep 2019 21:54:40 +0000 (21:54 +0000)]
[X86] Add support for unfold broadcast loads from FMA instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371323 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add broadcast load unfolding tests for FMA instructions.
Craig Topper [Sat, 7 Sep 2019 21:54:36 +0000 (21:54 +0000)]
[X86] Add broadcast load unfolding tests for FMA instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371322 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[aarch64] Add combine patterns for fp16 fmla
Sebastian Pop [Sat, 7 Sep 2019 20:24:51 +0000 (20:24 +0000)]
[aarch64] Add combine patterns for fp16 fmla

This patch enables generation of fused multiply add/sub for instructions operating on fp16.
Tested on aarch64-linux.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371321 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add prefer-128-bit subtarget feature.
Craig Topper [Sat, 7 Sep 2019 19:54:22 +0000 (19:54 +0000)]
[X86] Add prefer-128-bit subtarget feature.

Summary:
Similar to the previous prefer-256-bit flag. We might want to
enable this by default some CPUs. This just starts the initial
work to implement and prove that it effects TTI's vector width.

Reviewers: RKSimon, echristo, spatel, atdt

Reviewed By: RKSimon

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371319 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-nm] - Fix a bug and unbreak ASan BB.
George Rimar [Sat, 7 Sep 2019 19:45:27 +0000 (19:45 +0000)]
[llvm-nm] - Fix a bug and unbreak ASan BB.

BB: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/13820/steps/check-llvm%20asan/logs/stdio

rL371074 revealed a bug in llvm-nm.

This patch fixes it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371318 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typo. NFCI
Simon Pilgrim [Sat, 7 Sep 2019 18:09:09 +0000 (18:09 +0000)]
Fix typo. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371317 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Avoid uses of getZextValue(). NFCI.
Simon Pilgrim [Sat, 7 Sep 2019 16:13:57 +0000 (16:13 +0000)]
[X86] Avoid uses of getZextValue(). NFCI.

Use getAPIntValue() directly - this is mainly a best practice style issue to help prevent fuzz tests blowing up when a i12345 (or whatever) is generated.

Use getConstantOperandVal/getConstantOperandAPInt wrappers where possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371315 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Add 'f5' v4f64 shuffle test mentioned in D66004
Simon Pilgrim [Sat, 7 Sep 2019 16:13:48 +0000 (16:13 +0000)]
[X86][AVX] Add 'f5' v4f64 shuffle test mentioned in D66004

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371314 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ELF][MC] Set types of aliases of IFunc to STT_GNU_IFUNC
Fangrui Song [Sat, 7 Sep 2019 14:58:47 +0000 (14:58 +0000)]
[ELF][MC] Set types of aliases of IFunc to STT_GNU_IFUNC

```
.type  foo,@gnu_indirect_function
.set   foo,foo_resolver

.set foo2,foo
.set foo3,foo2
```

The types of foo2 and foo3 should be STT_GNU_IFUNC, but we currently
resolve them to the type of foo_resolver. This patch fixes it.

Differential Revision: https://reviews.llvm.org/D67206
Patch by Senran Zhang

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371312 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG][NFC] Autogenerate PhiEliminate3.ll
Roman Lebedev [Sat, 7 Sep 2019 13:53:14 +0000 (13:53 +0000)]
[SimplifyCFG][NFC] Autogenerate PhiEliminate3.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371311 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG][NFC] Autogenerate two tests
Roman Lebedev [Sat, 7 Sep 2019 13:35:54 +0000 (13:35 +0000)]
[SimplifyCFG][NFC] Autogenerate two tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371310 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Handle SMULFIXSAT with scale zero in TargetLowering::expandFixedPointMul
Bjorn Pettersson [Sat, 7 Sep 2019 12:16:23 +0000 (12:16 +0000)]
[CodeGen] Handle SMULFIXSAT with scale zero in TargetLowering::expandFixedPointMul

Summary:
Normally TargetLowering::expandFixedPointMul would handle
SMULFIXSAT with scale zero by using an SMULO to compute the
product and determine if saturation is needed (if overflow
happened). But if SMULO isn't custom/legal it falls through
and uses the same technique, using MULHS/SMUL_LOHI, as used
for non-zero scales.

Problem was that when checking for overflow (handling saturation)
when not using MULO we did not expect to find a zero scale. So
we ended up in an assertion when doing
  APInt::getLowBitsSet(VTSize, Scale - 1)

This patch fixes the problem by adding a new special case for
how saturation is computed when scale is zero.

Reviewers: RKSimon, bevinh, leonardchan, spatel

Reviewed By: RKSimon

Subscribers: wuzish, nemanjai, hiraditya, MaskRay, jsji, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371309 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Intrinsic] Add the llvm.umul.fix.sat intrinsic
Bjorn Pettersson [Sat, 7 Sep 2019 12:16:14 +0000 (12:16 +0000)]
[Intrinsic] Add the llvm.umul.fix.sat intrinsic

Summary:
Add an intrinsic that takes 2 unsigned integers with
the scale of them provided as the third argument and
performs fixed point multiplication on them. The
result is saturated and clamped between the largest and
smallest representable values of the first 2 operands.

This is a part of implementing fixed point arithmetic
in clang where some of the more complex operations
will be implemented as intrinsics.

Patch by: leonardchan, bjope

Reviewers: RKSimon, craig.topper, bevinh, leonardchan, lebedev.ri, spatel

Reviewed By: leonardchan

Subscribers: ychen, wuzish, nemanjai, MaskRay, jsji, jdoerfert, Ka-Ka, hiraditya, rjmccall, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371308 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Fix pshuflw formation from repeated shuffle mask (PR43230)
Nikita Popov [Sat, 7 Sep 2019 12:13:44 +0000 (12:13 +0000)]
[X86] Fix pshuflw formation from repeated shuffle mask (PR43230)

Fix for https://bugs.llvm.org/show_bug.cgi?id=43230.

When creating PSHUFLW from a repeated shuffle mask, we have to apply
the checks to the repeated mask, not the original one. For the test
case from PR43230 the inspected part of the original mask is all undef.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371307 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LVI] Look through extractvalue of insertvalue
Nikita Popov [Sat, 7 Sep 2019 12:03:59 +0000 (12:03 +0000)]
[LVI] Look through extractvalue of insertvalue

This addresses the issue mentioned on D19867. When we simplify
with.overflow instructions in CVP, we leave behind extractvalue
of insertvalue sequences that LVI no longer understands. This
means that we can not simplify any instructions based on the
with.overflow anymore (until some over pass like InstCombine
cleans them up).

This patch extends LVI extractvalue handling by calling
SimplifyExtractValueInst (which doesn't do anything more than
constant folding + looking through insertvalue) and using the block
value of the simplification.

A possible alternative would be to do something similar to
SimplifyIndVars, where we instead directly try to replace
extractvalue users of the with.overflow. This would need some
additional structural changes to CVP, as it's currently not legal
to remove anything but the current instruction -- we'd have to
introduce a worklist with instructions scheduled for deletion or similar.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371306 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test for PR43230; NFC
Nikita Popov [Sat, 7 Sep 2019 12:03:48 +0000 (12:03 +0000)]
[X86] Add test for PR43230; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371305 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DwarfExpression] Disallow some rewrites to avoid undefined behavior
Bjorn Pettersson [Sat, 7 Sep 2019 11:40:10 +0000 (11:40 +0000)]
[DwarfExpression] Disallow some rewrites to avoid undefined behavior

Summary:
The value operand in DW_OP_plus_uconst/DW_OP_constu value can be
large (it uses uint64_t as representation internally in LLVM).
This means that in the uint64_t to int conversions, previously done
by DwarfExpression::addMachineRegExpression, could lose information.
Also, the negation done in "-Offset" was undefined behavior in case
Offset was exactly INT_MIN.

To avoid the above problems, we now avoid transformation like
 [Reg, DW_OP_plus_uconst, Offset] --> [DW_OP_breg, Offset]
and
 [Reg, DW_OP_constu, Offset, DW_OP_plus]  --> [DW_OP_breg, Offset]
when Offset > INT_MAX.

And we avoid to transform
 [Reg, DW_OP_constu, Offset, DW_OP_minus] --> [DW_OP_breg,-Offset]
when Offset > INT_MAX+1.

The patch also adjusts DwarfCompileUnit::constructVariableDIEImpl
to make sure that "DW_OP_constu, Offset, DW_OP_minus" is used
instead of "DW_OP_plus_uconst, Offset" when creating DIExpressions
with negative frame index offsets.

Notice that this might just be the tip of the iceberg. There
are lots of fishy handling related to these constants. I think both
DIExpression::appendOffset and DIExpression::extractIfOffset may
trigger undefined behavior for certain values.

Reviewers: sdesmalen, rnk, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: jholewinski, aprantl, hiraditya, ychen, uabelho, llvm-commits

Tags: #debug-info, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371304 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Pre-commit of test case for DW_OP_breg/DW_OP_fbreg folds
Bjorn Pettersson [Sat, 7 Sep 2019 11:39:57 +0000 (11:39 +0000)]
[DebugInfo] Pre-commit of test case for DW_OP_breg/DW_OP_fbreg folds

This currently triggers undefined behavior if executed with an
ubsan build. It is just a precommit of the test case to show that
we got a problem.

Fix is proposed in https://reviews.llvm.org/D67263 and plan is to
commit the fix directly after this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371303 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix MSVC "32-bit shift implicitly converted to 64 bits" warnings. NFCI.
Simon Pilgrim [Sat, 7 Sep 2019 11:04:04 +0000 (11:04 +0000)]
Fix MSVC "32-bit shift implicitly converted to 64 bits" warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371302 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG][NFC] Make merge-cond-stores-cost.ll X86-specific, and rewrite it
Roman Lebedev [Sat, 7 Sep 2019 10:55:04 +0000 (10:55 +0000)]
[SimplifyCFG][NFC] Make merge-cond-stores-cost.ll X86-specific, and rewrite it

We clearly perform store-merging, even though div is really costly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371300 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Make unimplemented method pure virtual.
Benjamin Kramer [Sat, 7 Sep 2019 10:27:13 +0000 (10:27 +0000)]
[Attributor] Make unimplemented method pure virtual.

Otherwise the compiler mistakes it for a vtable anchor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371298 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG][NFC] Show that we don't consider the cost when merging cond stores
Roman Lebedev [Sat, 7 Sep 2019 09:25:26 +0000 (09:25 +0000)]
[SimplifyCFG][NFC] Show that we don't consider the cost when merging cond stores

We count instruction count in each BB's separately, not their cost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371297 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG][NFC] Regenerate merge-cond-stores* tests
Roman Lebedev [Sat, 7 Sep 2019 09:25:18 +0000 (09:25 +0000)]
[SimplifyCFG][NFC] Regenerate merge-cond-stores* tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371296 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyCFG] SpeculativelyExecuteBB(): It's SpeculatedInstructions, not SpeculationCost
Roman Lebedev [Sat, 7 Sep 2019 09:06:06 +0000 (09:06 +0000)]
[SimplifyCFG] SpeculativelyExecuteBB(): It's SpeculatedInstructions, not SpeculationCost

It counts the number of instructions we are ok speculating
(at most 1 there), not their cost, so rename accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371294 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReplicate the change "[Alignment][NFC] Use Align with TargetLowering::setMinFunctionA...
Sylvestre Ledru [Sat, 7 Sep 2019 08:38:46 +0000 (08:38 +0000)]
Replicate the change "[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment"
on AVR to avoid a breakage.
See r371200 / https://reviews.llvm.org/D67229

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371293 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] ValueSimplify Abstract Attribute
Hideto Ueno [Sat, 7 Sep 2019 07:03:05 +0000 (07:03 +0000)]
[Attributor] ValueSimplify Abstract Attribute

Summary:
This patch introduces initial `AAValueSimplify` which simplifies a value in a context.

example
- (for function returned) If all the return values are the same and constant, then we can replace callsite returned with the constant.
- If an internal function takes the same value(constant) as an argument in the callsite, then we can replace the argument with that constant.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371291 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[git-llvm] Do not reinvent `@{upstream}`
David Zarzycki [Sat, 7 Sep 2019 06:44:52 +0000 (06:44 +0000)]
[git-llvm] Do not reinvent `@{upstream}`

Make `git-llvm` more robust when used with a nontrivial repository.

https://reviews.llvm.org/D67262

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371290 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [CodeGen] Fix typos to run tests. NFC.
Xing GUO [Sat, 7 Sep 2019 05:14:47 +0000 (05:14 +0000)]
Revert [CodeGen] Fix typos to run tests. NFC.

This reverts r371286 (git commit b38105bbd0f7dfef424a4f096aa6a6b7b467fe99)

r371286 caused build bots' failure. I'll check it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371289 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Fix typos to run tests. NFC.
Xing GUO [Sat, 7 Sep 2019 04:57:53 +0000 (04:57 +0000)]
[CodeGen] Fix typos to run tests. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371286 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChange TargetLibraryInfo analysis passes to always require Function
Teresa Johnson [Sat, 7 Sep 2019 03:09:36 +0000 (03:09 +0000)]
Change TargetLibraryInfo analysis passes to always require Function

Summary:
This is the first change to enable the TLI to be built per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.

This change should not affect behavior, as the provided function is not
yet used to build a specifically per-function TLI, but rather enables
that migration.

Most of the changes were very mechanical, e.g. passing a Function to the
legacy analysis pass's getTLI interface, or in Module level cases,
adding a callback. This is similar to the way the per-function TTI
analysis works.

There was one place where we were looking for builtins but not in the
context of a specific function. See FindCXAAtExit in
lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
could provide the wrong behavior in some corner cases. Suggestions
welcome.

Reviewers: chandlerc, hfinkel

Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371284 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add tests for fp128 frem, sqrt, sin, and cos.
Craig Topper [Sat, 7 Sep 2019 01:39:21 +0000 (01:39 +0000)]
[X86] Add tests for fp128 frem, sqrt, sin, and cos.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371283 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Autogenerate fp128-libcalls.ll
Craig Topper [Sat, 7 Sep 2019 01:39:12 +0000 (01:39 +0000)]
[X86] Autogenerate fp128-libcalls.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371282 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Rename SHOffset (e_shoff) field to SHOff. NFC
Fangrui Song [Sat, 7 Sep 2019 01:38:56 +0000 (01:38 +0000)]
[llvm-objcopy] Rename SHOffset (e_shoff) field to SHOff. NFC

Similar to D67254.

`struct Elf*_Shdr` has a field `sh_offset`. Rename SHOffset to SHOff to
avoid confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371281 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSynchronize LLVM's copy of libc++abi's demangler with the libc++abi
Richard Smith [Sat, 7 Sep 2019 00:11:53 +0000 (00:11 +0000)]
Synchronize LLVM's copy of libc++abi's demangler with the libc++abi
version after r371273.

Also fix a minor issue in r371273 that only surfaced after template
instantiation from LLVM's use of the demangler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371274 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Enable the localizer for optimized builds.
Amara Emerson [Fri, 6 Sep 2019 22:27:09 +0000 (22:27 +0000)]
[AArch64][GlobalISel] Enable the localizer for optimized builds.

Despite the fact that the localizer's original motivation was to fix horrendous
constant spilling at -O0, shortening live ranges still has net benefits even
with optimizations enabled.

On an -Os build of CTMark, doing this improves code size by 0.5% geomean.

There are a few regressions, bullet increasing in size by 0.5%. One example from
bullet where code size increased slightly was due to GlobalISel actually now
generating the same code as SelectionDAG. So we actually have an opportunity
in future to implement better heuristics for localization and therefore be
*better* than SDAG in some cases. In relation to other optimizations though that
one is relatively minor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371266 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Refactor substitution of instruction in the parent BB (NFC)
Evandro Menezes [Fri, 6 Sep 2019 22:07:11 +0000 (22:07 +0000)]
[InstCombine] Refactor substitution of instruction in the parent BB (NFC)

Add the new method `LibCallSimplifier::substituteInParent()` that calls
`LibCallSimplifier::replaceAllUsesWith()' and
`LibCallSimplifier::eraseFromParent()` back to back, simplifying the
resulting code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371264 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC][RPC] Join server thread before checking condition in unit test.
Lang Hames [Fri, 6 Sep 2019 21:55:43 +0000 (21:55 +0000)]
[ORC][RPC] Join server thread before checking condition in unit test.

Otherwise we have a race on the sent-messages count.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371263 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IR] CallBrInst: scan+update arg list when indirect dest list changes
Nick Desaulniers [Fri, 6 Sep 2019 21:50:11 +0000 (21:50 +0000)]
[IR] CallBrInst: scan+update arg list when indirect dest list changes

Summary:
There's an unspoken invariant of callbr that the list of BlockAddress
Constants in the "function args" list match the BasicBlocks in the
"other labels" list. (This invariant is being added to the LangRef in
https://reviews.llvm.org/D67196).

When modifying the any of the indirect destinations of a callbr
instruction (possible jump targets), we need to update the function
arguments if the argument is a BlockAddress whose BasicBlock refers to
the indirect destination BasicBlock being replaced.  Otherwise, many
transforms that modify successors will end up violating that invariant.
A recent change to the arm64 Linux kernel exposed this bug, which
prevents the kernel from booting.

I considered maintaining a mapping from indirect destination BasicBlock
to argument operand BlockAddress, but this ends up being a one to
potentially many (though usually one) mapping.  Also, the list of
arguments to a function (or more typically inline assembly) ends up
being less than 10.  The implementation is significantly simpler to just
rescan the full list of arguments. Because of the one to potentially
many relationship, the full arg list must be scanned (we can't stop at
the first instance).

Thanks to the following folks that reported the issue and helped debug
it:
* Nathan Chancellor
* Will Deacon
* Andrew Murray
* Craig Topper

Link: https://bugs.llvm.org/show_bug.cgi?id=43222
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Link: https://lists.infradead.org/pipermail/linux-arm-kernel/2019-September/678330.html
Reviewers: craig.topper, chandlerc

Reviewed By: craig.topper

Subscribers: void, javed.absar, kristof.beyls, hiraditya, llvm-commits, nathanchance, srhines

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371262 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a AVX512VBMI command line to min-legal-vector-width.ll. Always enable fast...
Craig Topper [Fri, 6 Sep 2019 21:49:01 +0000 (21:49 +0000)]
[X86] Add a AVX512VBMI command line to min-legal-vector-width.ll. Always enable fast-variable-shuffle

Trying to minimize the features we need to manipulate when this
is updated for D67259.

The VBMI is interesting because it enables some improved combining
for truncates.

I enabled fast-variable-shuffle because all the CPUs we're going
to add implicitly enable it. So they can share check lines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371261 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Replace -mcpu with -mattr on some tests.
Craig Topper [Fri, 6 Sep 2019 21:48:44 +0000 (21:48 +0000)]
[X86] Replace -mcpu with -mattr on some tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371260 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Add a missing #include atomic.
Lang Hames [Fri, 6 Sep 2019 20:50:00 +0000 (20:50 +0000)]
[ORC] Add a missing #include atomic.

Hopefully this will fix the bot build failures from r371245.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371255 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Add G_FMAD instruction
Matt Arsenault [Fri, 6 Sep 2019 20:49:10 +0000 (20:49 +0000)]
GlobalISel: Add G_FMAD instruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371254 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Support physical register inputs in patterns
Matt Arsenault [Fri, 6 Sep 2019 20:32:37 +0000 (20:32 +0000)]
GlobalISel: Support physical register inputs in patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371253 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove dead .seh_stackalloc parsing method in X86AsmParser
Reid Kleckner [Fri, 6 Sep 2019 20:12:44 +0000 (20:12 +0000)]
Remove dead .seh_stackalloc parsing method in X86AsmParser

The shared COFF asm parser code handles this directive, since it is
shared with AArch64. Spotted by Alexandre Ganea in review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371251 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Fix typo
Matt Arsenault [Fri, 6 Sep 2019 20:00:22 +0000 (20:00 +0000)]
AMDGPU: Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371249 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-ifs] Improving detection of PlatformKind from triple for TBD generation.
Puyan Lotfi [Fri, 6 Sep 2019 19:59:59 +0000 (19:59 +0000)]
[llvm-ifs] Improving detection of PlatformKind from triple for TBD generation.

It was pointed out that I had hard-coded PlatformKind. This is rectifying that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371248 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][XCOFF] Remove basic test. [NFC]
Sean Fertile [Fri, 6 Sep 2019 19:55:44 +0000 (19:55 +0000)]
[PowerPC][XCOFF] Remove basic test. [NFC]

Test verified that we could compile an empty module and produce an XCOFF
object file. Newer tests superssed this coverage, its safe to remove.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371247 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantFolding] Add new test cases for transcendentals (NFC)
Evandro Menezes [Fri, 6 Sep 2019 19:41:49 +0000 (19:41 +0000)]
[ConstantFolding] Add new test cases for transcendentals (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371246 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Make sure RPC channel-send is called in blocking calls and responses.
Lang Hames [Fri, 6 Sep 2019 19:21:59 +0000 (19:21 +0000)]
[ORC] Make sure RPC channel-send is called in blocking calls and responses.

ORC-RPC batches calls by default, and the channel's send method must be called
to transfer any buffered calls to the remote. The call to send was missing on
responses and blocking calls in the SingleThreadedRPCEndpoint. This patch adds
the necessary calls and modifies the RPC unit test to check for them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371245 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-jitlink] Add optional slab allocator for testing locality optimizations.
Lang Hames [Fri, 6 Sep 2019 19:21:55 +0000 (19:21 +0000)]
[llvm-jitlink] Add optional slab allocator for testing locality optimizations.

The llvm-jitlink utility now accepts a '-slab-allocate <size>' option. If given,
llvm-jitlink will use a slab-based memory manager rather than the default
InProcessMemoryManager. Using a slab allocator will allow reliable testing of
future locality based optimizations (e.g. PLT and GOT elimination) in JITLink.

The <size> argument is a number, optionally followed by a units specifier (Kb,
Mb, or Gb). If the units are not given then the number is assumed to be in Kb.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371244 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.
Craig Topper [Fri, 6 Sep 2019 19:17:02 +0000 (19:17 +0000)]
[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.

We can use a MOVSX16 here then rely on FixupBWInst to change to
MOVSX32 if the upper bits are dead. With a special case to
not promote if it could be turned into CBW.

Then we can rely on X86MCInstLower to turn the MOVSX into CBW
very late if register allocation worked out.

Using MOVSX gives an opportunity to use the MOVSX as a both a
copy and a sign extend since the input and output register aren't
tied together.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371243 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use MOVZX16rr8/MOVZXrm8 when extending input for i8 udivrem.
Craig Topper [Fri, 6 Sep 2019 19:15:04 +0000 (19:15 +0000)]
[X86] Use MOVZX16rr8/MOVZXrm8 when extending input for i8 udivrem.

We can rely on X86FixupBWInsts to turn these into MOVZX32. This
simplifies a follow up commit to use MOVSX for i8 sdivrem with
a late optimization to use CBW when register allocation works out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371242 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Teach FixupBWInsts to turn MOVSX16rr8/MOVZX16rr8/MOVSX16rm8/MOVZX16rm8 into...
Craig Topper [Fri, 6 Sep 2019 19:14:49 +0000 (19:14 +0000)]
[X86] Teach FixupBWInsts to turn MOVSX16rr8/MOVZX16rr8/MOVSX16rm8/MOVZX16rm8 into their 32-bit dest equivalents when the upper part of the register is dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371240 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]
Sean Fertile [Fri, 6 Sep 2019 18:56:14 +0000 (18:56 +0000)]
[PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]

Extend the common/local-common testing for object files to also verify the
symbol table now that the needed functionality has landed in llvm-readobj.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371237 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantFolding] Refactor functions not available before C99 (NFC)
Evandro Menezes [Fri, 6 Sep 2019 18:24:21 +0000 (18:24 +0000)]
[ConstantFolding] Refactor functions not available before C99 (NFC)

Note the cases when calling a function at compile time may fail if the host
does not support the C99 run time library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371236 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI.
Kevin P. Neal [Fri, 6 Sep 2019 18:04:34 +0000 (18:04 +0000)]
[FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI.

The IRBuilder doesn't know that the two floating point to integer instructions
have constrained equivalents. This patch adds the support by building on
the strict FP mode now present in the IRBuilder.

Reviewed by: John McCall
Approved by: John McCall
Differential Revision: https://reviews.llvm.org/D67291

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371235 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Remarks] Add support for internalizing a remark in a string table
Francis Visoiu Mistrih [Fri, 6 Sep 2019 17:22:51 +0000 (17:22 +0000)]
[Remarks] Add support for internalizing a remark in a string table

In order to keep remarks around, we need to make them tied to a string
table.

Users then can delete the parser and rely on the string table to keep
the memory of the strings alive and deduplicated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371233 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Add patterns for VSUB with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:42 +0000 (17:02 +0000)]
[ARM] Add patterns for VSUB with q and r registers

Added patterns for VSUB to support q and r registers, which reduces
pressure on q registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371231 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Add patterns for VADD with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:35 +0000 (17:02 +0000)]
[ARM] Add patterns for VADD with q and r registers

Added support for VADD to use q and r registers, which reduces pressure
on q registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371230 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Add patterns for VMUL with q and r registers
Oliver Cruickshank [Fri, 6 Sep 2019 17:02:21 +0000 (17:02 +0000)]
[ARM] Add patterns for VMUL with q and r registers

Added support for VMUL to use an r register, this reduces pressure on
the q registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371229 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantFolding] Refactor function match for better speed (NFC)
Evandro Menezes [Fri, 6 Sep 2019 16:49:49 +0000 (16:49 +0000)]
[ConstantFolding] Refactor function match for better speed (NFC)

Use an `enum` instead of string comparison to match the candidate function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371228 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Always fall back on tail calls with -tailcallopt
Jessica Paquette [Fri, 6 Sep 2019 16:49:13 +0000 (16:49 +0000)]
[AArch64][GlobalISel] Always fall back on tail calls with -tailcallopt

-tailcallopt requires that we perform different stack adjustments than with
sibling calls. For example, the `@caller_to0_from8` function in
test/CodeGen/AArch64/tail-call.ll requires that we adjust SP. Without
-tailcallopt, this adjustment does not happen. With it, however, it is expected.

So, to ensure that adding sibling call support doesn't break -tailcallopt,
make CallLowering always fall back on possible tail calls when -tailcallopt
is passed in.

Update test/CodeGen/AArch64/tail-call.ll with a GlobalISel line to make sure
that we don't differ from the SDAG implementation at any point.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371227 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] pow(x, +/- 0.0) -> 1.0
JF Bastien [Fri, 6 Sep 2019 16:26:59 +0000 (16:26 +0000)]
[InstCombine] pow(x, +/- 0.0) -> 1.0

Summary:
This isn't an important optimization at all... We're already doing:
  pow(x, 0.0) -> 1.0
My patch merely teaches instcombine that -0.0 does the same.

However, doing this fixes an AMAZING bug! Compile this program:

  extern "C" double pow(double, double);
  double boom(double base) {
    return pow(base, -0.0);
  }

With:
  clang++ ~/Desktop/fast-math.cpp -ffast-math -O2 -S

And clang will crash with a signal. Wow, fast math is so fast it ICEs the
compiler! Arguably, the generated math is infinitely fast.

What's actually happening is that we recurse infinitely in getPow. In debug we
hit its assertion:
  assert(Exp != 0 && "Incorrect exponent 0 not handled");

We avoid this entire mess if we instead recognize that an exponent of positive
and negative zero yield 1.0.

A separate commit, r371221, fixed the same problem. This only contains the added
tests.

<rdar://problem/54598300>

Reviewers: scanon

Subscribers: hiraditya, jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371224 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyLibCalls] handle pow(x,-0.0) before it can assert (PR43233)
Sanjay Patel [Fri, 6 Sep 2019 16:10:18 +0000 (16:10 +0000)]
[SimplifyLibCalls] handle pow(x,-0.0) before it can assert (PR43233)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371221 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Sink add/mul(shufflevector(insertelement())) for MVE instruction selection
Sam Tebbs [Fri, 6 Sep 2019 16:01:32 +0000 (16:01 +0000)]
[ARM] Sink add/mul(shufflevector(insertelement())) for MVE instruction selection

This patch sinks add/mul(shufflevector(insertelement())) into the basic block in which they are used so that they can then be selected together.

This is useful for various MVE instructions, such as vmla and others that take R registers.

Loop tests have been added to the vmla test file to make sure vmlas are generated in loops.

Differential revision: https://reviews.llvm.org/D66295

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371218 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Enable constant offset promotion to immediate operand for VMEM stores
Valery Pykhtin [Fri, 6 Sep 2019 15:33:53 +0000 (15:33 +0000)]
[AMDGPU] Enable constant offset promotion to immediate operand for VMEM stores

Differential revision: https://reviews.llvm.org/D66958

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371214 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 15:03:49 +0000 (15:03 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: nemanjai, javed.absar, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, ychen, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371212 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Object] remove struct constructor, NFC
Cyndy Ishida [Fri, 6 Sep 2019 15:02:22 +0000 (15:02 +0000)]
[Object] remove struct constructor, NFC

Summary: make POD struct by removing ctors

Reviewers: avl, dblaikie

Reviewed By: dblaikie

Subscribers: ributzka, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371211 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 14:51:15 +0000 (14:51 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, ychen, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371210 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment] fix dubious min function alignment
Guillaume Chatelet [Fri, 6 Sep 2019 13:54:09 +0000 (13:54 +0000)]
[Alignment] fix dubious min function alignment

Summary:
This was discovered while introducing the llvm::Align type.
The original setMinFunctionAlignment used to take alignment as log2, looking at the comment it seems like instructions are to be 2-bytes aligned and not 4-bytes aligned.

Reviewers: uweigand

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371204 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readelf] - Print unknown st_other value if present in GNU output.
George Rimar [Fri, 6 Sep 2019 13:05:34 +0000 (13:05 +0000)]
[llvm-readelf] - Print unknown st_other value if present in GNU output.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785.

llvm-readelf does not print the st_value of the symbol when
st_value has any non-visibility bits set.

This patch:

* Aligns "Ndx" row for the default and a new cases.
(it was 1 space character off for the case when "PROTECTED" visibility was printed)

* Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set.
In compare with GNU, this logic is a bit simpler and seems to be more consistent.

For MIPS GNU can print named flags, though can't print a mix of them:
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1
2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2
3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3
4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4
5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5
6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1
7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2

On PPC64 it can print a localentry value that is encoded in the high bits of st_other
63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12

We chose to print the raw st_other field, prefixed with '0x'.

Differential revision: https://reviews.llvm.org/D67094

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371201 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
Guillaume Chatelet [Fri, 6 Sep 2019 12:48:34 +0000 (12:48 +0000)]
[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jyknight, sdardis, nemanjai, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371200 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test] Update the name of the debug entry values option. NFC
Djordje Todorovic [Fri, 6 Sep 2019 12:23:37 +0000 (12:23 +0000)]
[test] Update the name of the debug entry values option. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371199 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DFAPacketizer] Track resources for packetized instructions
James Molloy [Fri, 6 Sep 2019 12:20:08 +0000 (12:20 +0000)]
[DFAPacketizer] Track resources for packetized instructions

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371198 91177308-0d34-0410-b5e6-96231b3b80d8