Commit Graph

147795 Commits

Author SHA1 Message Date
Davide Italiano
540c0392b5 [Target] Use hasOneUse() instead of getNumUses().
The latter does a liner scan over a linked list, therefore is
much more expensive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 00:29:54 +00:00
Peter Collingbourne
4df72d14c8 Object: Shrink the size of irsymtab::Symbol by a word. NFCI.
Instead of storing an UncommonIndex on the Symbol, use a flag bit to store
whether the Symbol has an Uncommon. This shrinks Chromium's .bc files (after
D32061) by about 1%.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300514 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 23:43:49 +00:00
Dehao Chen
62b2c39c08 Build SymbolMap in SampleProfileLoader to help matchin function names with suffix.
Summary: If there is suffix added in the function name (e.g. module hash added by thinLTO), we will not be able to find a match in profile as the suffix does not exist in profile. This patch build a map from function name to Function *. The map includes the entry for the stripped function name so that inlineHotFunctions can find the corresponding function to promote/inline.

Reviewers: davidxl, dnovillo, tejohnson

Reviewed By: davidxl

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300507 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 22:23:05 +00:00
Haicheng Wu
e8773635a3 Change the testcase tail-merge-after-mbp.ll to tail-merge-after-mbp.mir
Differential Revision: https://reviews.llvm.org/D32037

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 22:22:38 +00:00
Craig Topper
538a54682a [SimplifyCFG] Use hasNUses instead of comparing getNumUses to a constant."
The use list is a linked list so getNumUses requires a linear scan through the whole list. hasNUses will stop scanning at N and see if that is the end.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 22:13:00 +00:00
Craig Topper
9128da5831 [APInt] Merge the multiword code from lshrInPlace and tcShiftRight into a single implementation
This merges the two different multiword shift right implementations into a single version located in tcShiftRight. lshrInPlace now calls tcShiftRight for the multiword case.

I retained the memmove fast path from lshrInPlace and used a memset for the zeroing. The for loop is basically tcShiftRight's implementation with the zeroing and the intra-shift of 0 removed.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300503 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:43:43 +00:00
Jacob Gravelle
fee2961b5a [WebAssembly] Fix WebAssemblyOptimizeReturned after r300367
Summary:
Refactoring changed paramHasAttr(1 + i) to paramHasAttr(0), fix that to
paramHasAttr(i).
Add more tests to WebAssemblyOptimizeReturned that catch that
regression.

Reviewers: dschuff

Subscribers: jfb, sbc100, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:40:28 +00:00
Benjamin Kramer
2e4163e54d [SCEV] Fix another unused variable warning in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300500 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:07:26 +00:00
Wei Mi
c2c171286c Fix an unused variable error in rL300494.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 21:00:45 +00:00
Kostya Serebryany
b662731542 [libFuzzer] experimental option -cleanse_crash: tries to replace all bytes in a crash reproducer with garbage, while still preserving the crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:58:21 +00:00
Sylvestre Ledru
cd789d8cfe Add a linker script to version LLVM symbols
Summary:
This patch adds a very simple linker script to version the lib's symbols
and thus trying to avoid crashes if an application loads two different
LLVM versions (as long as they do not share data between them).

Note that we deliberately *don't* make LLVM_5.0 depend on LLVM_4.0:
they're incompatible and the whole point of this patch is
to tell the linker that.


Avoid unexpected crashes when two LLVM versions are used in the same process.

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Author: Lisandro Damían Nicanor Pérez Meyer <lisandro@debian.org>
Author: Sylvestre Ledru <sylvestre@debian.org>
Bug-Debian:  https://bugs.debian.org/848368


Reviewers: beanz, rnk

Reviewed By: rnk

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300496 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:51:50 +00:00
Davide Italiano
61710dfa3a [InstCombine] Matchers work with both ConstExpr and Instructions.
So, `cast<Instruction>` is not guaranteed to succeed. Change the
code so that we create a new constant and use it in the newly
created instruction, as it's done in other places in InstCombine.

OK'ed by Sanjay/Craig. Fixes PR32686.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:49:50 +00:00
Wei Mi
e35a5f5518 [SCEV] Add a local cache for getZeroExtendExpr and getSignExtendExpr to prevent
the exponential behavior.

The patch is to fix PR32043. Functions getZeroExtendExpr and getSignExtendExpr
may call themselves recursively more than once. This is potentially a 2^N
complexity behavior. The exponential behavior was not commonly exposed before
because of existing global cache mechnism like UniqueSCEVs or some early return
mechanism when flags FlagNSW or FlagNUW are seen. However, we still have case
which can expose the exponential behavior, like the case in PR32043, so we add
a local cache in getZeroExtendExpr and getSignExtendExpr. If the input of the
functions -- SCEV and type pair have been seen before, we can find the extended
expression directly in the local cache.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300494 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:40:05 +00:00
Sanjay Patel
4aa15d3d33 [InstSimplify] add/move tests for (icmp X, C1 & icmp X, C2); NFC
We simplify based on range intersection, but we're missing folds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300493 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:38:33 +00:00
Dehao Chen
9fc2ff7f34 Update the test to fix the buildbot failure introduced by r300486 (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300492 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:35:32 +00:00
Derek Schuff
e39a78c951 [WebAssembly] Encode block signatures as SLEB instead of ULEB
Use SLEB (varint) for block_type immediates in accordance with the spec.

Patch by Yury Delendik

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:28:28 +00:00
Dehao Chen
3b1256dc1d Add GNU_discriminator support for inline callsites in llvm-symbolizer.
Summary: LLVM symbolize cannot recognize GNU_discriminator for inline callsites. This patch adds support for it.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 20:10:39 +00:00
Matt Arsenault
74ac54ec5b AMDGPU: Use MachineRegisterInfo to find max used register
Avoid looping through program to determine register counts.
This avoids needing to look at regmask operands.

Also fixes some counting errors with flat_scr when there
are no stack objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300482 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:48:30 +00:00
Matt Arsenault
fc3524b1a2 AMDGPU: Change stack alignment
While the incoming stack for a kernel is 256-byte aligned,
this refers to the base address of the entire wave. This isn't
useful information for most of codegen. Fixes unnecessarily
aligning stack objects in callees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:48:24 +00:00
Brendon Cahoon
80269962da [CodeGenPrepare] Fix crash due to an invalid CFG
The splitIndirectCriticalEdges function generates and invalid CFG when the
'Target' basic block is a loop to itself. When this occurs, the code that
updates the predecessor terminator needs to update the terminator in the split
basic block.

This occurs when there is an edge from block D back to D. Since D is split in
to D0 and D1, the code needs to update the terminator in D1. But D1 is not in
the OtherPreds vector, so it was not getting updated.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:11:04 +00:00
Benjamin Kramer
3778de4635 Unbreak build of the wasm backend after r300463.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 19:08:41 +00:00
Peter Collingbourne
c45a5a4d32 Bitcode: Add missing build dep to fix shlib build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300478 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:53:27 +00:00
Craig Topper
ef47b09cd9 [APInt] Remove self move check from move assignment operator
This was added to work around a bug in MSVC 2013's implementation of stable_sort. That bug has been fixed as of MSVC 2015 so we shouldn't need this anymore.

Technically the current implementation has undefined behavior because we only protect the deleting of the pVal array with the self move check. There is still a memcpy of that.VAL to VAL that isn't protected. In the case of self move those are the same local and memcpy is undefined for src and dst overlapping.

This reduces the size of the opt binary on my local x86-64 build by about 4k.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300477 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:44:27 +00:00
Craig Topper
7b19c164ad [IR] Implement DataLayout::getPointerTypeSizeInBits using getPointerSizeInBits directly
Currently we use getTypeSizeInBits which contains a switch statement to dispatch based on what the Type is. We know we always have a pointer type here, but the compiler isn't able to figure out that out to remove the switch.

This patch changes it to just call handle the pointer type directly by calling getPointerSizeInBits without going through a switch.

getPointerTypeSizeInBits is called pretty often, particularly by getOrEnforceKnownAlignment which is used by InstCombine. This should speed that up a little bit.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300475 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:22:36 +00:00
Tim Northover
8f48abe12d AArch64: put nonlazybind special handling behind a flag for now.
It's basically a terrible idea anyway but objc_msgSend gets emitted like that.
We can decide on a better way to deal with it in the unlikely event that anyone
actually uses it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:18:47 +00:00
Konstantin Zhuravlyov
8e59825382 AMDGPU: Test handling of R_AMDGPU_ABS64 in RelocVisitor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300472 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:12:45 +00:00
Craig Topper
1ba7d19428 [IR] Put the Use list waymarking bits in the bit positions documentation says they are using
The documentation for the waymarking algorithm says that we use the lower 2 bits of Use::Prev to store the way marking bits. But because we use a PointerIntPair with the default PointerLikeTypeTraits, we're using bits 2:1 on 64-bit targets.

There's also a trick employed for distinguishing Users that have Uses stored with them and Users that have Uses stored in a separate array. The documentation says we use the LSB of the first byte of the real User object or the User* that occurs at the end of the Use array. But again due to the PointerLikeTypeTraits we're really using bit 2(64-bit) or bit 1(32-bit) and not the LSB. This is a little worrying because the first byte of the User object is the vtable ptr so we're assuming the vtable has 8 byte or 4 byte alignment where what is documented would only require 2 byte alignment.

This patch provides a custom traits override for these two cases to put the bits where the documentation says they are. It also has the side effect of removing some shifts from the waymarking traversal implementation.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:12:30 +00:00
Konstantin Zhuravlyov
82b3362fea AMDGPU: Set CodePointerSize to 8 for amdgcn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 18:02:09 +00:00
Peter Collingbourne
fc84bd3dbe Object: Use offset+size as the irsymtab string representation.
This is consistent with the bitcode string table.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:55:24 +00:00
Peter Collingbourne
6163b4af73 Bitcode: Add a string table to the bitcode format.
Add a top-level STRTAB block containing a string table blob, and start storing
strings for module codes FUNCTION, GLOBALVAR, ALIAS, IFUNC and COMDAT in
the string table.

This change allows us to share names between globals and comdats as well
as between modules, and improves the efficiency of loading bitcode files by
no longer using a bit encoding for symbol names. Once we start writing the
irsymtab to the bitcode file we will also be able to share strings between
it and the module.

On my machine, link time for Chromium for Linux with ThinLTO decreases by
about 7% for no-op incremental builds or about 1% for full builds. Total
bitcode file size decreases by about 3%.

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2017-April/111732.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:51:36 +00:00
Konstantin Zhuravlyov
0c79d1f4e0 Distinguish between code pointer size and DataLayout::getPointerSize() in DWARF info generation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:41:25 +00:00
Tim Northover
a017dc6965 AArch64: support nonlazybind
It's almost certainly not a good idea to actually use it in most cases (there's
a pretty large code size overhead on AArch64), but we can't do those
experiments until it's supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 17:27:56 +00:00
Craig Topper
f1a890db28 Introduce APInt::isSignBitSet/isSignBitClear. Use in place isSignBitSet in place of isNegative in known bits tracking.
This makes statements like KnownZero.isNegative() (which means the value we're tracking is positive) less confusing.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 16:38:20 +00:00
Matt Arsenault
6d01b81485 AMDGPU: SimplifyDemandedElts for image intrinsics
Causes some VGPR usage improvements in shaderdb, but
introduces some SGPR spilling regressions due to random
scheduling changes later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 15:12:44 +00:00
Davide Italiano
5c0006e064 [LCSSA] Don't insert tokens into the worklist at all.
We're gonna skip them anyway, so there's no point in inserting them
in the first place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300452 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 14:32:05 +00:00
Amaury Sechet
603e72e193 Introducing LLVMMetadataRef
Summary:
This seems like an uncontroversial first step toward providing access to the metadata hierarchy that now exists in LLVM. This should allow for good debug info support from C.

Future plans are to deprecate API that take mixed bags of values and metadata (mainly the LLVMMDNode family of functions) and migrate the rest toward the use of LLVMMetadataRef.

Once this is in place, mapping of DIBuilder will be able to start.

Reviewers: mehdi_amini, echristo, whitequark, jketema, Wallbraker

Reviewed By: Wallbraker

Subscribers: Eugene.Zelenko, axw, mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 11:52:54 +00:00
Max Kazantsev
63c0d1d702 [LoopPeeling] Get rid of Phis that become invariant after N steps
This patch is a generalization of the improvement introduced in rL296898.
Previously, we were able to peel one iteration of a loop to get rid of a Phi that becomes
an invariant on the 2nd iteration. In more general case, if a Phi becomes invariant after
N iterations, we can peel N times and turn it into invariant.
In order to do this, we for every Phi in loop's header we define the Invariant Depth value
which is calculated as follows:

Given %x = phi <Inputs from above the loop>, ..., [%y, %back.edge].

If %y is a loop invariant, then Depth(%x) = 1.
If %y is a Phi from the loop header, Depth(%x) = Depth(%y) + 1.
Otherwise, Depth(%x) is infinite.
Notice that if we peel a loop, all Phis with Depth = 1 become invariants,
and all other Phis with finite depth decrease the depth by 1.
Thus, peeling N first iterations allows us to turn all Phis with Depth <= N
into invariants.

Reviewers: reames, apilipenko, mkuper, skatkov, anna, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 09:52:02 +00:00
Serguei Katkov
38eae0ca5e [BPI] NFC: reorder ifs to bail out earlier
This is non-functional change to re-order if statements to bail out earlier
from unreachable and ColdCall heuristics.

Reviewers: sanjoy, reames, junbuml, vsk, chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 06:39:47 +00:00
Max Kazantsev
db6b21de41 [LoopPeeling] Fix condition for phi-eliminating peeling
When peeling loops basing on phis becoming invariants, we make a wrong loop size check.
UP.Threshold should be compared against the total numbers of instructions after the transformation,
which is equal to 2 * LoopSize in case of peeling one iteration.
We should also check that the maximum allowed number of peeled iterations is not zero.

Reviewers: sanjoy, anna, reames, mkuper

Reviewed By: mkuper

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300441 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 05:38:28 +00:00
Serguei Katkov
8c6e6605aa [BPI] Use metadata info before any other heuristics
Metadata potentially is more precise than any heuristics we use, so
it makes sense to use first metadata info if it is available. However it makes
sense to examine it against other strong heuristics like unreachable one.
If edge coming to unreachable block has higher probability then it is expected 
by unreachable heuristic then we use heuristic and remaining probability is
distributed among other reachable blocks equally.

An example where metadata might be more strong then unreachable heuristic is
as follows: it is possible that there are two branches and for the branch A
metadata says that its probability is (0, 2^25). For the branch B
the probability is (1, 2^25).
So the expectation is that first edge of B is hotter than first edge of A
because first edge of A did not executed at least once.
If first edge of A points to the unreachable block then using the unreachable
heuristics we'll set the probability for A to (1, 2^20) and now edge of A
becomes hotter than edge of B.
This is unexpected behavior.

This fixed the biggest part of https://bugs.llvm.org/show_bug.cgi?id=32214

Reviewers: sanjoy, junbuml, vsk, chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits, reames, davidxl

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 04:33:04 +00:00
Craig Topper
b844f35bcd [InstCombine] Simplify 1/X for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 03:41:47 +00:00
Craig Topper
af3add1d49 [InstCombine] Add test cases for missing support for simplifying 1/X for vectors. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 03:41:44 +00:00
Craig Topper
b39b99c0aa [InstCombine] Add support for vector srem->urem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300437 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 01:51:24 +00:00
Craig Topper
2b555ede15 [InstCombine] Add missing testcases for srem->urem conversion. The vector version isn't currently supported. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 01:51:21 +00:00
Craig Topper
f84ee35832 [InstCombine] Add support for turning vector sdiv into udiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 01:51:19 +00:00
Craig Topper
023ae40959 [InstCombine] Add test cases for missing support for turning vector sdiv into udiv. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 01:51:16 +00:00
Davide Italiano
f763838a0b [LCSSA] Simplify a loop. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 00:02:45 +00:00
Craig Topper
9563b95955 [InstCombine][ValueTracking] When computing known bits for Srem make sure we don't compute known bits for the LHS twice.
If we already called computeKnownBits for the RHS being a constant power of 2, we've already computed everything we can and should just stop. I think previously we would still recurse if we had determined the result was negative or had not determined the sign bit at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-16 21:46:12 +00:00
Davide Italiano
0bd8066c86 [LCSSA] Fix non-determinism due to iterating over a SmallPtrSet.
Use a SmallSetVector instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-16 21:07:04 +00:00
Craig Topper
bfe2c60567 [InstCombine] In SimplifyDemandedUseBits, don't bother to mask known bits of constants with DemandedMask.
Just because we didn't demand them doesn't mean they aren't known.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300430 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-16 20:55:58 +00:00