8199 Commits

Author SHA1 Message Date
Vitaly Buka
05252670a6 [cxx2a] Fix warning triggered by r343285
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343369 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-29 02:17:12 +00:00
Thomas Lively
30635bc8de [ValueTracking] Allow select patterns to work on FP vectors
Summary:
This CL allows constant vectors of floats to be recognized as non-NaN
and non-zero in select patterns. This change makes
`matchSelectPattern` more powerful generally, but was motivated
specifically because I wanted fminnan and fmaxnan to be created for
vector versions of the scalar patterns they are created for.

Tested with check-all on all targets. A testcase in the WebAssembly
backend that tests the non-nan codepath is in an upcoming CL.

Reviewers: aheejin, dschuff

Subscribers: sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343364 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 21:36:43 +00:00
Teresa Johnson
7756815310 [WPD] Fix incorrect devirtualization after indirect call promotion
Summary:
Add a dominance check to ensure that the possible devirtualizable
call is actually dominated by the type test/checked load intrinsic being
analyzed. With PGO, after indirect call promotion is performed during
the compile step, followed by inlining, we may have a type test in the
promoted and inlined sequence that allows an indirect call in that
sequence to be devirtualized. That indirect call (inserted by inlining
after promotion) will share the same vtable pointer as the fallback
indirect call that cannot be devirtualized.

Before this patch the code was incorrectly devirtualizing the fallback
indirect call.

See the new test and the example described there for more details.

Reviewers: pcc, vitalybuka

Subscribers: mehdi_amini, Prazek, eraman, steven_wu, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343226 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 14:55:32 +00:00
Fangrui Song
3b35e17b21 llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb

Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:13:45 +00:00
Anna Thomas
edafc389f1 [LV][LAA] Vectorize loop invariant values stored into loop invariant address
Summary:
We are overly conservative in loop vectorizer with respect to stores to loop
invariant addresses.
More details in https://bugs.llvm.org/show_bug.cgi?id=38546
This is the first part of the fix where we start with vectorizing loop invariant
values to loop invariant addresses.

This also includes changes to ORE for stores to invariant address.

Reviewers: anemet, Ayal, mkuper, mssimpso

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343028 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-25 20:57:20 +00:00
Sanjay Patel
7e09993947 [Analysis] add comment to generalize finding a scalar op from vector; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342906 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-24 17:18:32 +00:00
Fedor Sergeev
a7c2370e95 [New PM][PassInstrumentation] IR printing support for New Pass Manager
Implementing -print-before-all/-print-after-all/-filter-print-func support
through PassInstrumentation callbacks.

- PrintIR routines implement printing callbacks.

- StandardInstrumentations class provides a central place to manage all
  the "standard" in-tree pass instrumentations. Currently it registers
  PrintIR callbacks.

Reviewers: chandlerc, paquette, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D50923

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342896 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-24 16:08:15 +00:00
JF Bastien
1269b2af10 Merge clang's isRepeatedBytePattern with LLVM's isBytewiseValue
Summary:
his code was in CGDecl.cpp and really belongs in LLVM's isBytewiseValue. Teach isBytewiseValue the tricks clang's isRepeatedBytePattern had, including merging undef properly, and recursing on more types.

clang part of this patch: D51752

Subscribers: dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342709 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-21 05:17:42 +00:00
Sameer AbuAsal
e54994e9c0 [inline Cost] Don't mark functions accessing varargs as non-inlinable
Summary:
rL323619 marks functions that are calling va_end as not viable for
inlining. This patch reverses that since this va_end doesn't need
access to the vriadic arguments list that are saved on the stack, only
va_start does.

Reviewers: efriedma, fhahn

Reviewed By: fhahn

Subscribers: eraman, haicheng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342675 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-20 18:39:34 +00:00
Fedor Sergeev
e6959a6ecf [New PM] Introducing PassInstrumentation framework
Pass Execution Instrumentation interface enables customizable instrumentation
of pass execution, as per "RFC: Pass Execution Instrumentation interface"
posted 06/07/2018 on llvm-dev@

The intent is to provide a common machinery to implement all
the pass-execution-debugging features like print-before/after,
opt-bisect, time-passes etc.

Here we get a basic implementation consisting of:
* PassInstrumentationCallbacks class that handles registration of callbacks
  and access to them.

* PassInstrumentation class that handles instrumentation-point interfaces
  that call into PassInstrumentationCallbacks.

* Callbacks accept StringRef which is just a name of the Pass right now.
  There were some ideas to pass an opaque wrapper for the pointer to pass instance,
  however it appears that pointer does not actually identify the instance
  (adaptors and managers might have the same address with the pass they govern).
  Hence it was decided to go simple for now and then later decide on what the proper
  mental model of identifying a "pass in a phase of pipeline" is.

* Callbacks accept llvm::Any serving as a wrapper for const IRUnit*, to remove direct dependencies
  on different IRUnits (e.g. Analyses).

* PassInstrumentationAnalysis analysis is explicitly requested from PassManager through
  usual AnalysisManager::getResult. All pass managers were updated to run that
  to get PassInstrumentation object for instrumentation calls.

* Using tuples/index_sequence getAnalysisResult helper to extract generic AnalysisManager's extra
  args out of a generic PassManager's extra args. This is the only way I was able to explicitly
  run getResult for PassInstrumentationAnalysis out of a generic code like PassManager::run or
  RepeatedPass::run.
  TODO: Upon lengthy discussions we agreed to accept this as an initial implementation
  and then get rid of getAnalysisResult by improving RepeatedPass implementation.

* PassBuilder takes PassInstrumentationCallbacks object to pass it further into
  PassInstrumentationAnalysis. Callbacks registration should be performed directly
  through PassInstrumentationCallbacks.

* new-pm tests updated to account for PassInstrumentationAnalysis being run

* Added PassInstrumentation tests to PassBuilderCallbacks unit tests.
  Other unit tests updated with registration of the now-required PassInstrumentationAnalysis.

  Made getName helper to return std::string (instead of StringRef initially) to fix
  asan builtbot failures on CGSCC tests.

Reviewers: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D47858

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342664 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-20 17:08:45 +00:00
Eric Christopher
85a14f0491 Temporarily Revert "[New PM] Introducing PassInstrumentation framework"
as it was causing failures in the asan buildbot.

This reverts commit r342597.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342616 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-20 05:16:29 +00:00
Fedor Sergeev
5ffd6db668 [New PM] Introducing PassInstrumentation framework
Pass Execution Instrumentation interface enables customizable instrumentation
of pass execution, as per "RFC: Pass Execution Instrumentation interface"
posted 06/07/2018 on llvm-dev@

The intent is to provide a common machinery to implement all
the pass-execution-debugging features like print-before/after,
opt-bisect, time-passes etc.

Here we get a basic implementation consisting of:
* PassInstrumentationCallbacks class that handles registration of callbacks
  and access to them.

* PassInstrumentation class that handles instrumentation-point interfaces
  that call into PassInstrumentationCallbacks.

* Callbacks accept StringRef which is just a name of the Pass right now.
  There were some ideas to pass an opaque wrapper for the pointer to pass instance,
  however it appears that pointer does not actually identify the instance
  (adaptors and managers might have the same address with the pass they govern).
  Hence it was decided to go simple for now and then later decide on what the proper
  mental model of identifying a "pass in a phase of pipeline" is.

* Callbacks accept llvm::Any serving as a wrapper for const IRUnit*, to remove direct dependencies
  on different IRUnits (e.g. Analyses).

* PassInstrumentationAnalysis analysis is explicitly requested from PassManager through
  usual AnalysisManager::getResult. All pass managers were updated to run that
  to get PassInstrumentation object for instrumentation calls.

* Using tuples/index_sequence getAnalysisResult helper to extract generic AnalysisManager's extra
  args out of a generic PassManager's extra args. This is the only way I was able to explicitly
  run getResult for PassInstrumentationAnalysis out of a generic code like PassManager::run or
  RepeatedPass::run.
  TODO: Upon lengthy discussions we agreed to accept this as an initial implementation
  and then get rid of getAnalysisResult by improving RepeatedPass implementation.

* PassBuilder takes PassInstrumentationCallbacks object to pass it further into
  PassInstrumentationAnalysis. Callbacks registration should be performed directly
  through PassInstrumentationCallbacks.

* new-pm tests updated to account for PassInstrumentationAnalysis being run

* Added PassInstrumentation tests to PassBuilderCallbacks unit tests.
  Other unit tests updated with registration of the now-required PassInstrumentationAnalysis.

Reviewers: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D47858

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342597 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 22:42:57 +00:00
Fedor Sergeev
68fc66e3d3 Revert rL342544: [New PM] Introducing PassInstrumentation framework
A bunch of bots fail to compile unittests. Reverting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342552 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 14:54:48 +00:00
Fedor Sergeev
fa4dbf77f1 [New PM] Introducing PassInstrumentation framework
Summary:
Pass Execution Instrumentation interface enables customizable instrumentation
of pass execution, as per "RFC: Pass Execution Instrumentation interface"
posted 06/07/2018 on llvm-dev@

The intent is to provide a common machinery to implement all
the pass-execution-debugging features like print-before/after,
opt-bisect, time-passes etc.

Here we get a basic implementation consisting of:
* PassInstrumentationCallbacks class that handles registration of callbacks
  and access to them.

* PassInstrumentation class that handles instrumentation-point interfaces
  that call into PassInstrumentationCallbacks.

* Callbacks accept StringRef which is just a name of the Pass right now.
  There were some ideas to pass an opaque wrapper for the pointer to pass instance,
  however it appears that pointer does not actually identify the instance
  (adaptors and managers might have the same address with the pass they govern).
  Hence it was decided to go simple for now and then later decide on what the proper
  mental model of identifying a "pass in a phase of pipeline" is.

* Callbacks accept llvm::Any serving as a wrapper for const IRUnit*, to remove direct dependencies
  on different IRUnits (e.g. Analyses).

* PassInstrumentationAnalysis analysis is explicitly requested from PassManager through
  usual AnalysisManager::getResult. All pass managers were updated to run that
  to get PassInstrumentation object for instrumentation calls.

* Using tuples/index_sequence getAnalysisResult helper to extract generic AnalysisManager's extra
  args out of a generic PassManager's extra args. This is the only way I was able to explicitly
  run getResult for PassInstrumentationAnalysis out of a generic code like PassManager::run or
  RepeatedPass::run.
  TODO: Upon lengthy discussions we agreed to accept this as an initial implementation
  and then get rid of getAnalysisResult by improving RepeatedPass implementation.

* PassBuilder takes PassInstrumentationCallbacks object to pass it further into
  PassInstrumentationAnalysis. Callbacks registration should be performed directly
  through PassInstrumentationCallbacks.

* new-pm tests updated to account for PassInstrumentationAnalysis being run

* Added PassInstrumentation tests to PassBuilderCallbacks unit tests.
  Other unit tests updated with registration of the now-required PassInstrumentationAnalysis.

Reviewers: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D47858

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342544 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 12:25:52 +00:00
Michael Kruse
2f778b8a01 [Loopinfo] Remove one latch-case in getLoopID. NFC.
getLoopID has different control flow for two cases: If there is a
single loop latch and for any other number of loop latches (0 and more
than one). The latter case should return the same result if there is
only a single latch. We can save the preceding redundant search for a
latch by handling both cases with the same code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342406 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-17 18:40:29 +00:00
Matt Arsenault
7fa1548f75 Fix vectorization of canonicalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342390 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-17 13:24:30 +00:00
Florian Hahn
cf397e4d39 [LV] Move InterleaveGroup and InterleavedAccessInfo to VectorUtils.h (NFC)
Move the 2 classes out of LoopVectorize.cpp to make it easier to re-use
them for VPlan outside LoopVectorize.cpp

Reviewers: Ayal, mssimpso, rengolin, dcaballe, mkuper, hsaito, hfinkel, xbolva00

Reviewed By: rengolin, xbolva00

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 08:01:57 +00:00
Ilya Biryukov
ab4b357430 Remove unused include from IVDescriptors.cpp.
This fixes a layering violation:

Analysis/IVDescrtors.cpp can't include Transforms/Utils/BasicBlockUtils.h,
since TransformUtils depends on Analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342024 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 07:22:46 +00:00
Vikram TV
479b4ab2b0 Break LoopUtils into an Analysis file.
Summary:
The InductionDescriptor and RecurrenceDescriptor classes basically analyze the IR to identify the respective IVs. So, it is better to have them in the "Analysis" directory instead of the "Transforms" directory.

The rationale for this is to make the Induction and Recurrence descriptor classes available for analysis passes. Currently including them in an analysis pass produces link error (http://lists.llvm.org/pipermail/llvm-dev/2018-July/124456.html).

Induction and Recurrence descriptors are moved from Transforms/Utils/LoopUtils.h|cpp to Analysis/IVDescriptors.h|cpp.

Reviewers: dmgreen, llvm-commits, hfinkel

Reviewed By: dmgreen

Subscribers: mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342016 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 01:59:43 +00:00
Alexandros Lamprineas
ca08016c45 [MemorySSAUpdater] Avoid creating self-referencing MemoryDefs
Fix for https://bugs.llvm.org/show_bug.cgi?id=38807, which occurred
while compiling SemaTemplateInstantiate.cpp with clang and GVNHoist
enabled. In the following example:

      1=def(entry)
      /        \
2=def(1)       4=def(1)
3=def(2)       5=def(4)

When removing the MemoryDef 2=def(1) from its basic block, and just
before adding it to the end of the parent basic block, we first
replace all its uses with the defining memory access:

3=def(2) -> 3=def(1)

Then we call insertDef for adding 2=def(1) to the parent basic block,
where we replace the uses of 1=def(entry) with 2=def(1). Doing so we
create a self reference:

2=def(1) -> 2=def(2)  (bad)
3=def(1) -> 3=def(2)  (ok)
4=def(1) -> 4=def(2)  (ok)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341947 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 14:29:59 +00:00
Johannes Doerfert
f91f51f647 [LoopInfo] Fix Loop::getLoopID() for loops with multiple latches
The previous implementation traversed all loop blocks and bailed if one
was not a latch block. Since we are only interested in latch blocks, we
should only traverse those.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341926 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 11:44:17 +00:00
Max Kazantsev
0b5496ca62 [NFC] Sanitizing asserts for OrderedBasicBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341917 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 08:46:19 +00:00
Max Kazantsev
281457bf89 [NFC] Rename variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341901 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 05:10:01 +00:00
Peter Collingbourne
b59662095b Prevent Constant Folding From Optimizing inrange GEP
This patch does the following things:

1. update SymbolicallyEvaluateGEP so that it bails out if it cannot preserve inrange arribute;
2. update llvm/test/Analysis/ConstantFolding/gep.ll to remove UB in it;
3. remove inaccurate comment above ConstantFoldInstOperandsImpl in llvm/lib/Analysis/ConstantFolding.cpp;
4. add a new regression test that makes sure that no optimizations change an inrange GEP in an unexpected way.

Patch by Zhaomo Yang!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341888 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-11 01:53:36 +00:00
Alina Sbirlea
bcb266e40d API to update MemorySSA for cloned blocks and added CFG edges.
Summary:
End goal is to update MemorySSA in all loop passes. LoopUnswitch clones all blocks in a loop. SimpleLoopUnswitch clones some blocks. LoopRotate clones some instructions.
Some of these loop passes also make CFG changes.
This is an API based on what I found needed in LoopUnswitch, SimpleLoopUnswitch, LoopRotate, LoopInstSimplify, LoopSimplifyCFG.
Adding dependent patches using this API for context.

Reviewers: george.burgess.iv, dberlin

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341855 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 20:13:01 +00:00
Philip Reames
3e62673386 [AST] Visit memtransfer arguments in order
The only point to this change is the test diffs.  When I remove this code entirely (in favor of the recently added generic handling), I don't want there to be any confusion due to spurious test diffs.

As an aside, the fact out tests are AST construction order dependent is not great.  I thought about fixing that, but the reasonable schemes I might want (e.g. sort by name) need the test diffs anyways.

Philip



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341841 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 16:00:27 +00:00
Alina Sbirlea
68a9873346 [MemorySSA] Relax verification of clobbering accesses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341733 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 23:51:41 +00:00
Philip Reames
fe1f0fea23 [AST] Generalize argument specific aliasing
AliasSetTracker has special case handling for memset, memcpy and memmove which pre-existed argmemonly on functions and readonly and writeonly on arguments. This patch generalizes it using the AA infrastructure to any call correctly annotated.

The motivation here is to cut down on confusion, not performance per se. For most instructions, there is a direct mapping to alias set. However, this is not guaranteed by the interface and was not in fact true for these three intrinsics *and only these three intrinsics*. I kept getting myself confused about this invariant, so I figured it would be good to clearly distinguish between a instructions and alias sets. Calls happened to be an easy target.

The nice side effect is that custom implementations of memset/memcpy/memmove - including wrappers discovered by IPO - can now be optimized the same as builts by LICM.

Note: The actual removal of the memset/memtransfer specific handling will happen in a follow on NFC patch.  It was originally part of this one, but separate for ease of review and rebase.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341713 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 21:36:11 +00:00
Alina Sbirlea
566693531e [MemorySSA] Update MemoryPhi wiring for block splitting to consider if identical edges were merged.
Summary:
Block splitting is done with either identical edges being merged, or not.
Only critical edges can be split without merging identical edges based on an option.
Teach the memoryssa updater to take this into account: for the same edge between two blocks only move one entry from the Phi in Old to the new Phi in New.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341709 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 21:14:48 +00:00
Jessica Paquette
9e21280653 Output per-function size-info remarks
This patch adds per-function size information remarks. Previously, passing
-Rpass-analysis=size-info would only give you per-module changes. By adding
the ability to do this per-function, it's easier to see which functions
contributed the most to size changes.

https://reviews.llvm.org/D51467

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341588 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 21:19:54 +00:00
Alina Sbirlea
bb146ec5a0 [LoopPassManager] MemorySSA should be preserved when enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341587 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 20:54:24 +00:00
Max Kazantsev
62f16664ab [NFC] Simplify inner structure of InstructionPrecedenceTracking
Currently it has a set KnownBlocks that marks blocks as having cached
answers and a map FirstSpecialInsts that maps these blocks to first
special instructions in them. The value in the map is always non-null,
and for blocks that are known to have no special instructions the map
does not have an instance.

This patch removes KnownBlocks as obsolete. Instead, for blocks that
are known to have no special instructions, we just put a nullptr value.
This makes the code much easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 09:29:42 +00:00
Max Kazantsev
d8ffa610fe Return "[NFC] Add severe validation of InstructionPrecedenceTracking"
This validation patch has been reverted as rL341147 because of conserns raised by
@reames. This revision returns it as is to raise a discussion and address the concerns.

Differential Revision: https://reviews.llvm.org/D51523
Reviewed By: reames


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341526 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-06 08:33:02 +00:00
Jessica Paquette
87d50cfb8f [NFC] Optionally pass a function to emitInstrCountChangedRemark
In basic block, loop, and function passes, we already have a function that
we can use to emit optimization remarks. We can use that instead of searching
the module for the first suitable function (that is, one that contains at
least one basic block.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341253 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 20:54:37 +00:00
Jessica Paquette
4f3a2194ad [NFC] Pass the instruction delta to emitInstrCountChangedRemark
Instead of counting the size of the entire module every time we run a pass,
pass along a delta instead and use that to emit the remark.

This means we only have to use (on average) smaller IR units to calculate
instruction counts. E.g, in a BB pass, we only need to look at the delta of
the BB instead of the delta of the entire module.

6/6

(This improved compile time for size remarks on sqlite3 + O2 significantly)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341250 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 20:20:57 +00:00
Jessica Paquette
14667077ec [NFC] Pre-calculate SCC IR counts in size remarks.
Same vein as the previous commits. Pre-calculate the size of
the module and use that to decide if we're going to emit a
remark.

This one comes with a FIXME and TODO. First off, CallGraphSCC
and CallGraphNode don't have a getInstructionCount function. So,
for now, we do the same thing as in a module pass.

Second off, we're not really saving anything here yet, because
as before, I need to change emitInstrCountChangedRemark to take
in a delta. Keeping the patches small though, so that's coming up
next.

5/6

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341249 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 20:20:56 +00:00
Jessica Paquette
6a73860201 [NFC] Pre-calculate loop IR counts in size remarks.
Another commit reducing compile time in size remarks.

Cache the size of the module and loop, and update values based
off of deltas instead. Avoid recalculating the size of the
whole module whenever possible.

3/6

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341247 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 20:20:54 +00:00
Max Kazantsev
d02189d061 Revert "[NFC] Add severe validation of InstructionPrecedenceTracking" for discussion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-31 00:01:54 +00:00
Andrew Kaylor
3e31639276 Reverting r340807.
This patch restores the old behavior of getAllocationDataForFunction in MemoryBuiltins.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341091 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 18:37:18 +00:00
Nicolai Haehnle
b33a403240 [NFC] Rename the DivergenceAnalysis to LegacyDivergenceAnalysis
Summary:
This is patch 1 of the new DivergenceAnalysis (https://reviews.llvm.org/D50433).

The purpose of this patch is to free up the name DivergenceAnalysis for the new generic
implementation. The generic implementation class will be shared by specialized
divergence analysis classes.

Patch by: Simon Moll

Reviewed By: nhaehnle

Subscribers: jvesely, jholewinski, arsenm, nhaehnle, mgorny, jfb, llvm-commits

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

Change-Id: Ie8146b11be2c50d5312f30e11c7a3036a15b48cb

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341071 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 14:21:36 +00:00
Max Kazantsev
9480b0964b [NFC] Add severe validation of InstructionPrecedenceTracking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341051 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 10:26:06 +00:00
Max Kazantsev
009ed30f63 [NFC] Rename map to make the naming consistent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341043 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 09:24:33 +00:00
Max Kazantsev
3a86455ee7 [NFC] Move OrderedInstructions and InstructionPrecedenceTracking to Analysis
These classes don't make any changes to IR and have no reason to be in
Transform/Utils. This patch moves them to Analysis folder. This will allow
us reusing these classes in some analyzes, like MustExecute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341015 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 04:49:03 +00:00
Max Kazantsev
187d9188f7 Re-enable "[NFC] Unify guards detection"
rL340921 has been reverted by rL340923 due to linkage dependency
from Transform/Utils to Analysis which is not allowed. In this patch
this has been fixed, a new utility function moved to Analysis.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341014 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-30 03:39:16 +00:00
Alina Sbirlea
04e389a200 [MemorySSA] Silence warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340995 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 23:20:29 +00:00
Alina Sbirlea
0bac46f10e [MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340981 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 22:38:51 +00:00
Philip Reames
a9f18e972f [LICM] Hoist stores of invariant values to invariant addresses out of loops
Teach LICM to hoist stores out of loops when the store writes to a location otherwise unused in the loop, writes a value which is invariant, and is guaranteed to execute if the loop is entered.

Worth noting is that this transformation is partially overlapping with the existing promotion transformation. Reasons this is worthwhile anyway include:
 * For multi-exit loops, this doesn't require duplication of the store.
 * It kicks in for case where we can't prove we exit through a normal exit (i.e. we may throw), but can prove the store executes before that possible side exit.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340974 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 21:49:30 +00:00
Alina Sbirlea
19135aee74 [MemorySSA] Add expesive check for validating clobber accesses.
Summary: Add validation of clobber accesses as expensive check.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 18:26:04 +00:00
Hans Wennborg
fc1247272f Revert r340921 "[NFC] Unify guards detection"
This broke the build, see e.g.

http://lab.llvm.org:8011/builders/clang-cmake-armv8-lnt/builds/4626/
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18647/
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/5856/
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/22800/

> We have multiple places in code where we try to identify whether or not
> some instruction is a guard. This patch factors out this logic into a separate
> utility function which works uniformly in all places.
>
> Differential Revision: https://reviews.llvm.org/D51152
> Reviewed By: fedor.sergeev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340923 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 12:21:32 +00:00
Max Kazantsev
68de447e4f [NFC] Unify guards detection
We have multiple places in code where we try to identify whether or not
some instruction is a guard. This patch factors out this logic into a separate
utility function which works uniformly in all places.

Differential Revision: https://reviews.llvm.org/D51152
Reviewed By: fedor.sergeev


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340921 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-29 11:37:34 +00:00