Commit Graph

102183 Commits

Author SHA1 Message Date
Chandler Carruth
1d4cf6e01f [PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.
Currently, this pass only focuses on *trivial* loop unswitching. At that
reduced problem it remains significantly better than the current loop
unswitch:
- Old pass is worse than cubic complexity. New pass is (I think) linear.
- New pass is much simpler in its design by focusing on full unswitching. (See
  below for details on this).
- New pass doesn't carry state for thresholds between pass iterations.
- New pass doesn't carry state for correctness (both miscompile and
  infloop) between pass iterations.
- New pass produces substantially better code after unswitching.
- New pass can handle more trivial unswitch cases.
- New pass doesn't recompute the dominator tree for the entire function
  and instead incrementally updates it.

I've ported all of the trivial unswitching test cases from the old pass
to the new one to make sure that major functionality isn't lost in the
process. For several of the test cases I've worked to improve the
precision and rigor of the CHECKs, but for many I've just updated them
to handle the new IR produced.

My initial motivation was the fact that the old pass carried state in
very unreliable ways between pass iterations, and these mechansims were
incompatible with the new pass manager. However, I discovered many more
improvements to make along the way.

This pass makes two very significant assumptions that enable most of these
improvements:

1) Focus on *full* unswitching -- that is, completely removing whatever
   control flow construct is being unswitched from the loop. In the case
   of trivial unswitching, this means removing the trivial (exiting)
   edge. In non-trivial unswitching, this means removing the branch or
   switch itself. This is in opposition to *partial* unswitching where
   some part of the unswitched control flow remains in the loop. Partial
   unswitching only really applies to switches and to folded branches.
   These are very similar to full unrolling and partial unrolling. The
   full form is an effective canonicalization, the partial form needs
   a complex cost model, cannot be iterated, isn't canonicalizing, and
   should be a separate pass that runs very late (much like unrolling).

2) Leverage LLVM's Loop machinery to the fullest. The original unswitch
   dates from a time when a great deal of LLVM's loop infrastructure was
   missing, ineffective, and/or unreliable. As a consequence, a lot of
   complexity was added which we no longer need.

With these two overarching principles, I think we can build a fast and
effective unswitcher that fits in well in the new PM and in the
canonicalization pipeline. Some of the remaining functionality around
partial unswitching may not be relevant today (not many test cases or
benchmarks I can find) but if they are I'd like to add support for them
as a separate layer that runs very late in the pipeline.

Purely to make reviewing and introducing this code more manageable, I've
split this into first a trivial-unswitch-only pass and in the next patch
I'll add support for full non-trivial unswitching against a *fixed*
threshold, exactly like full unrolling. I even plan to re-use the
unrolling thresholds, as these are incredibly similar cost tradeoffs:
we're cloning a loop body in order to end up with simplified control
flow. We should only do that when the total growth is reasonably small.

One of the biggest changes with this pass compared to the previous one
is that previously, each individual trivial exiting edge from a switch
was unswitched separately as a branch. Now, we unswitch the entire
switch at once, with cases going to the various destinations. This lets
us unswitch multiple exiting edges in a single operation and also avoids
numerous extremely bad behaviors, where we would introduce 1000s of
branches to test for thousands of possible values, all of which would
take the exact same exit path bypassing the loop. Now we will use
a switch with 1000s of cases that can be efficiently lowered into
a jumptable. This avoids relying on somehow forming a switch out of the
branches or getting horrible code if that fails for any reason.

Another significant change is that this pass actively updates the CFG
based on unswitching. For trivial unswitching, this is actually very
easy because of the definition of loop simplified form. Doing this makes
the code coming out of loop unswitch dramatically more friendly. We
still should run loop-simplifycfg (at the least) after this to clean up,
but it will have to do a lot less work.

Finally, this pass makes much fewer attempts to simplify instructions
based on the unswitch. Something like loop-instsimplify, instcombine, or
GVN can be used to do increasingly powerful simplifications based on the
now dominating predicate. The old simplifications are things that
something like loop-instsimplify should get today or a very, very basic
loop-instcombine could get. Keeping that logic separate is a big
simplifying technique.

Most of the code in this pass that isn't in the old one has to do with
achieving specific goals:
- Updating the dominator tree as we go
- Unswitching all cases in a switch in a single step.

I think it is still shorter than just the trivial unswitching code in
the old pass despite having this functionality.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301576 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 18:45:20 +00:00
Eli Friedman
9dc569fec5 [GlobalOpt] Correctly update metadata when localizing a global.
Just calling dropAllReferences leaves pointers to the ConstantExpr
behind, so we would eventually crash with a null pointer dereference.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 18:39:08 +00:00
Teresa Johnson
913d272566 Memory intrinsic value profile optimization: Improve debug output (NFC)
Summary:
Misc improvements to debug output. Fix a couple typos and also dump the
value profile before we make any profitability checks.

Reviewers: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301574 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 18:25:22 +00:00
Sanjoy Das
b3ab6b2622 Use a pointer type for target frame indices during statepoint lowering
Summary:
The type of the target frame index is intptr, not the type of the value we're
going to store into it.  Without this change we crash in the attached test case
when trying to type-legalize a TargetFrameIndex.

Patchpoint lowering types the target frame index as intptr as well.

Reviewers: reames, bogner, arsenm

Subscribers: arsenm, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 17:17:16 +00:00
Frederich Munch
dbf2bf739f Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301562 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:55:24 +00:00
Xinliang David Li
5a24953af4 [PartialInlining]: Improve partial inlining to handle complex conditions
Differential Revision: http://reviews.llvm.org/D32249


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301561 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:34:00 +00:00
Zachary Turner
2834a6874e [CodeView] Isolate Debug Info Fragments into standalone classes.
Previously parsing of these were all grouped together into a
single master class that could parse any type of debug info
fragment.

With writing forthcoming, the complexity of each individual
fragment is enough to warrant them having their own classes so
that reading and writing of each fragment type can be grouped
together, but isolated from the code for reading and writing
other fragment types.

In doing so, I found a place where parsing code was duplicated
for the FileChecksums fragment, across llvm-readobj and the
CodeView library, and one of the implementations had a bug.
Now that the codepaths are merged, the bug is resolved.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301557 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:12:16 +00:00
Zachary Turner
67e6eced9e [Support] Make BinaryStreamArray extractors stateless.
Instead, we now pass a context memeber through the extraction
process.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301556 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:11:47 +00:00
Zachary Turner
3220dd07ab Rename some PDB classes.
We have a lot of very similarly named classes related to
dealing with module debug info.  This patch has NFC, it just
renames some classes to be more descriptive (albeit slightly
more to type).  The mapping from old to new class names is as
follows:

   Old          |        New
ModInfo         | DbiModuleDescriptor
ModuleSubstream | ModuleDebugFragment
ModStream       | ModuleDebugStream

With the corresponding Builder classes renamed accordingly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301555 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 16:11:19 +00:00
Sam Kolton
74a47fb13d [AMDGPU] DPP: add support for GFX9
Reviewers: artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301551 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 15:42:38 +00:00
Krzysztof Parzyszek
83513e069b Fix typo and place comment close to its target
Patch by Wei-Ren Chen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 14:38:21 +00:00
Zoran Jovanovic
d2333e0a15 [mips][microMIPS] Adding code size reduction pass for MicroMIPS
Author: milena.vujosevic.janicic
Reviewers: sdardis
The code implements size reduction pass for MicroMIPS.
Load and store instructions are examined and transformed, if possible.
lw32 instruction is transformed into 16-bit instruction lwsp
sw32 instruction is transformed into 16-bit instruction swsp
Arithmetic instrcutions are examined and transformed, if possible.
addu32 instruction is transformed into 16-bit instruction addu16
subu32 instruction is transformed into 16-bit instruction subu16
Differential Revision: https://reviews.llvm.org/D15144


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301540 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 13:10:48 +00:00
Jonas Paulsson
5f77135fa2 [SystemZ] Remove incorrect assert in SystemZTTIImpl
In getCmpSelInstrCost(), CondTy may actually be scalar while ValTy is a
vector when LoopVectorizer is the caller. Therefore the assert that CondTy
must be a vector type if ValTy is was wrong and is now removed.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 11:01:18 +00:00
Diana Picus
6790813007 [ARM] GlobalISel: Fix extended stack operands
Fix a crash when trying to extend a value passed as a sign- or
zero-extended stack parameter. The cause of the crash was that we were
setting the size of the loaded value to 32 bits, and then tyring to
extend again to 32 bits.

This patch addresses the issue by also introducing a G_TRUNC after the
load. This will leave the unused bits to their original values set by
the caller, while being consistent about the types. For values that are
not extended, we just use a smaller load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 10:23:30 +00:00
George Rimar
0fcdd9ba05 [llvm-dwarfdump] - Change format for .gdb_index dump.
It is useful to output size of ranges when address ranges
section of .gdb_index is dumped.

It helps to compare outputs produced by different linkers,
for example. In that case address ranges can look very different,
when they are the same at fact. Difference comes from different 
low address because of different address of .text.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301527 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 10:00:13 +00:00
Igor Breger
39e6fd3cd6 [GlobalISel][X86] handle not symmetric G_COPY
Summary: handle not symmetric G_COPY

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301523 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 08:02:03 +00:00
Clement Courbet
54b949daeb [CodeGen][NFC] Rename 'Src' to 'Val'.
'Src' looks like it was borrowed from memcpy, 'Val' makes more sense for
memset and is consistent with naming within the function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 07:22:30 +00:00
Sanjoy Das
9f5bf2cd28 Use accessors for ValueHandleBase::V; NFC
This changes code that touches ValueHandleBase::V to go through
getValPtr and (newly added) setValPtr.  This functionality will be
used later, but also seemed like a generally good cleanup.

I also renamed the field to Val, but that's just to make it obvious
that I fixed all the uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 06:02:18 +00:00
Craig Topper
e5cb2e5840 [Metadata] Fix typos in comments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 05:48:29 +00:00
Craig Topper
8025bd61c5 [InstCombine] Use APInt bit counting methods to avoid a temporary APInt. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301516 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 04:51:25 +00:00
Konstantin Zhuravlyov
51ff1d79cd AMDGPU: Fix assert in scheduler
Assert is triggered if DBG_VALUE is first instruction in BB

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 03:22:44 +00:00
Chandler Carruth
bde56a9699 Disable GVN Hoist due to still more bugs being found in it. There is
also a discussion about exactly what we should do prior to re-enabling
it.

The current bug is http://llvm.org/PR32821 and the discussion about this
is in the review thread for r300200.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27 00:28:03 +00:00
Adrian Prantl
9d291ed9ad Turn DISubprogram into a variable-length node.
DISubprogram currently has 10 pointer operands, several of which are
often nullptr. This patch reduces the amount of memory allocated by
DISubprogram by rearranging the operands such that containing type,
template params, and thrown types come last, and are only allocated
when they are non-null (or followed by non-null operands).

This patch also eliminates the entirely unused DisplayName operand.

This saves up to 4 pointer operands per DISubprogram. (I tried
measuring the effect on peak memory usage on an LTO link of an X86
llc, but the results were very noisy).

This reapplies r301498 with an attempted workaround for g++.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301501 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:59:52 +00:00
Adrian Prantl
589155c2d7 Revert "Turn DISubprogram into a variable-length node."
This reverts commit r301498 while investigating bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:49:30 +00:00
Adrian Prantl
6c938e5225 Turn DISubprogram into a variable-length node.
DISubprogram currently has 10 pointer operands, several of which are
often nullptr. This patch reduces the amount of memory allocated by
DISubprogram by rearranging the operands such that containing type,
template params, and thrown types come last, and are only allocated
when they are non-null (or followed by non-null operands).

This patch also eliminates the entirely unused DisplayName operand.

This saves up to 4 pointer operands per DISubprogram. (I tried
measuring the effect on peak memory usage on an LTO link of an X86
llc, but the results were very noisy).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:44:54 +00:00
Matthias Braun
7c2792bdea Lanai: Remove unnecessary canRealignStack() override; NFC
It was doing the same as the base implementation and was irritating me
when I was searching for backends that have custom behavior for
canRealignStack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:37:01 +00:00
Matthias Braun
a596026865 MachineFrameInfo: Move implementation to an own file; NFC
Move implementation of the MachineFrameInfo class into
MachineFrameInfo.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301494 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:36:58 +00:00
Rui Ueyama
089cd2cb50 Revert r301487: Replace HashString algorithm with xxHash64
This reverts commit r301487 to make buildbots green.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301491 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 23:15:10 +00:00
Adrian Prantl
1bf6297ee8 Add support for DW_TAG_thrown_type.
For Swift we would like to be able to encode the error types that a
function may throw, so the debugger can display them alongside the
function's return value when finish-ing a function.

DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw()
declarations) that is a perfect fit for this purpose. This patch wires
up support for DW_TAG_thrown_type in LLVM by adding a list of thrown
types to DISubprogram.

To offset the cost of the extra pointer, there is a follow-up patch
that turns DISubprogram into a variable-length node.

rdar://problem/29481673

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 22:56:44 +00:00
Rui Ueyama
2db23b3bbe Replace HashString algorithm with xxHash64
The previous algorithm processed one character at a time, which is very
painful on a modern CPU. Replace it with xxHash64, which both already
exists in the codebase and is fairly fast.

Patch from Scott Smith!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301487 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 22:45:04 +00:00
Eugene Zelenko
f49f90e97b [MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301485 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 22:31:39 +00:00
Davide Italiano
2f1bbeb63f [LibCallsShrinkWrap] Remove an unnecessary class member variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301477 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 21:28:40 +00:00
Davide Italiano
65e17c010c [LibCallsShrinkWrap] More descriptive assertion messages.
Fix a typo while I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 21:21:02 +00:00
Davide Italiano
1b1163841f [LibCallsShrinkWrap] Remove some temporary cl::opt(s).
The pass has been on and working for a while.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 21:19:05 +00:00
Davide Italiano
c1543360c2 [LibCallsShrinkWrap] Teach the pass how to preserve the dominator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 21:05:40 +00:00
Daniel Berlin
988e599a02 Kill the old Simplify* APIs, leave SimplifyInstruction for the moment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301467 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:17 +00:00
Daniel Berlin
2b0666738c NewGVN: Use new SimplifyQuery based API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:14 +00:00
Daniel Berlin
5c3bf01e34 PHITransAddr: Use new SimplifyQuery based API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:13 +00:00
Daniel Berlin
516ca41d78 InstCombine: Use the new SimplifyQuery versions of Simplify*. Use AssumptionCache, DominatorTree, TargetLibraryInfo everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:56:07 +00:00
Sanjay Patel
8253e24b39 [DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)
Besides better codegen, the motivation is to be able to canonicalize this pattern 
in IR (currently we don't) knowing that the backend is prepared for that.

This may also allow removing code for special constant cases in 
DAGCombiner::foldSelectOfConstants() that was added in D30180.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:26:46 +00:00
Dmitry Preobrazhensky
559cd48144 [AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers
Summary of changes:
- corrected vmcnt, expcnt, lgkmcnt helpers to checks their argument for truncation;
- added saturated versions of these helpers.

See bug 32711 for details: https://bugs.llvm.org//show_bug.cgi?id=32711

Reviewers: artem.tamazov, vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:55:50 +00:00
Peter Collingbourne
052412f4f5 LTO: Mark undefined module asm symbols as used.
Marking them as used causes them to be considered visible outside of LTO. This
prevents the symbols from being internalized or discarded, either by GlobalDCE
or by summary-based dead stripping in ThinLTO.

This change makes it unnecessary to add these symbols to llvm.compiler.used
in the backend, as the symbols are kept alive by virtue of being external,
so remove the backend code that handles that.

Fixes PR32798.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:53:39 +00:00
Daniel Berlin
86c47581d6 CorrelatedValuePropagation: Rename a variable for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:41:46 +00:00
Craig Topper
58c7fe69d0 [ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits
This patch introduces a new KnownBits struct that wraps the two APInt used by computeKnownBits. This allows us to treat them as more of a unit.

Initially I've just altered the signatures of computeKnownBits and InstCombine's simplifyDemandedBits to pass a KnownBits reference instead of two separate APInt references. I'll do similar to the SelectionDAG version of computeKnownBits/simplifyDemandedBits as a separate patch.

I've added a constructor that allows initializing both APInts to the same bit width with a starting value of 0. This reduces the repeated pattern of initializing both APInts. Once place default constructed the APInts so I added a default constructor for those cases.

Going forward I would like to add more methods that will work on the pairs. For example trunc, zext, and sext occur on both APInts together in several places. We should probably add a clear method that can be used to clear both pieces. Maybe a method to check for conflicting information. A method to return (Zero|One) so we don't write it out everywhere. Maybe a method for (Zero|One).isAllOnesValue() to determine if all bits are known. I'm sure there are many other methods we can come up with.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:39:58 +00:00
Sanjoy Das
263da12ab2 Reverts commit r301424, r301425 and r301426
Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:37:05 +00:00
Matthew Simpson
86197951a0 [LV] Handle external uses of floating-point induction variables
Reference: https://bugs.llvm.org/show_bug.cgi?id=32758
Differential Revision: https://reviews.llvm.org/D32445

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301428 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:23:02 +00:00
Sanjoy Das
147a8edb1b Add a new WeakVH value handle; NFC
Summary:
WeakVH nulls itself out if the value it was tracking gets deleted, but
it does not track RAUW.

Reviewers: dblaikie, davide

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:20:59 +00:00
Sanjoy Das
d0cf26e443 Rename WeakVH to WeakTrackingVH; NFC
Summary:
I plan to use WeakVH to mean "nulls itself out on deletion, but does
not track RAUW" in a subsequent commit.

Reviewers: dblaikie, davide

Reviewed By: davide

Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:20:52 +00:00
Dmitry Preobrazhensky
5cc9392ddb [AMDGPU][MC] Added check for truncation of SOPK imm operand
See bug 30827: https://bugs.llvm.org//show_bug.cgi?id=30827

Reviewers: artem.tamazov, vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301418 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 15:34:19 +00:00
Dylan McKay
180ce98a0d [AVR] Remove an unused local variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301413 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 14:47:27 +00:00