hanchenye-llvm-project/llvm/test/Transforms/LoopVectorize
Robert Lougher b0905209dd [LoopVectorizer] When estimating reg usage, unused insts may "end" another use
The register usage algorithm incorrectly treats instructions whose value is
not used within the loop (e.g. those that do not produce a value).

The algorithm first calculates the usages within the loop.  It iterates over
the instructions in order, and records at which instruction index each use
ends (in fact, they're actually recorded against the next index, as this is
when we want to delete them from the open intervals).

The algorithm then iterates over the instructions again, adding each
instruction in turn to a list of open intervals.  Instructions are then
removed from the list of open intervals when they occur in the list of uses
ended at the current index.

The problem is, instructions which are not used in the loop are skipped.
However, although they aren't used, the last use of a value may have been
recorded against that instruction index.  In this case, the use is not deleted
from the open intervals, which may then bump up the estimated register usage.

This patch fixes the issue by simply moving the "is used" check after the loop
which erases the uses at the current index.

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

llvm-svn: 286969
2016-11-15 14:27:33 +00:00
..
AArch64 Second attempt at r285517. 2016-10-31 13:17:31 +00:00
ARM Second attempt at r285517. 2016-10-31 13:17:31 +00:00
PowerPC [LV] Scalarize instructions marked scalar after vectorization 2016-09-26 17:08:37 +00:00
X86 [LoopVectorizer] When estimating reg usage, unused insts may "end" another use 2016-11-15 14:27:33 +00:00
XCore
12-12-11-if-conv.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
2012-10-20-infloop.ll
2012-10-22-isconsec.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
2016-07-27-loop-vec.ll Fix the assertion error in collectLoopUniforms caused by empty Worklist before expanding. 2016-07-27 23:53:58 +00:00
align.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
bsd_regex.ll
bzip_reverse_loops.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
calloc.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
cast-induction.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
conditional-assignment.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
consec_no_gep.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
consecutive-ptr-uniforms.ll [LV] Sink scalar operands of predicated instructions 2016-10-25 18:59:45 +00:00
control-flow.ll [LV] Stop saying "use -Rpass-analysis=loop-vectorize" 2016-11-11 22:51:46 +00:00
cpp-new-array.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
dbg.value.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
dead_instructions.ll [LV] Avoid emitting trivially dead instructions 2016-10-19 19:22:02 +00:00
debugloc.ll Update vectorization debug info unittest. 2016-11-09 22:25:19 +00:00
diag-missing-instr-debug-loc.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
diag-with-hotness-info-2.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
diag-with-hotness-info.ll [LV] Stop saying "use -Rpass-analysis=loop-vectorize" 2016-11-11 22:51:46 +00:00
duplicated-metadata.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
ee-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
exact.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
flags.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
float-induction.ll [Loop Vectorizer] Handling loops FP induction variables. 2016-07-24 07:24:54 +00:00
float-reduction.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
funcall.ll
gcc-examples.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
gep_with_bitcast.ll [LV] Don't widen trivial induction variables 2016-07-06 14:26:59 +00:00
global_alias.ll [LV] Scalarize instructions marked scalar after vectorization 2016-09-26 17:08:37 +00:00
hints-trans.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
hoist-loads.ll
i8-induction.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
icmp-uniforms.ll [LV] Don't mark multi-use branch conditions uniform 2016-10-07 15:20:13 +00:00
if-conv-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-conversion-edgemasks.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-conversion-nest.ll
if-conversion-reduction.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-conversion.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-pred-non-void.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-pred-not-when-safe.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
if-pred-stores.ll [LV] Sink scalar operands of predicated instructions 2016-10-25 18:59:45 +00:00
incorrect-dom-info.ll
increment.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
induction-step.ll [LoopVectorize] Handling induction variable with non-constant step. 2016-05-10 07:33:35 +00:00
induction.ll [LV] Sink scalar operands of predicated instructions 2016-10-25 18:59:45 +00:00
induction_plus.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
infiniteloop.ll
interleaved-accesses-1.ll Second attempt at r285517. 2016-10-31 13:17:31 +00:00
interleaved-accesses-2.ll Second attempt at r285517. 2016-10-31 13:17:31 +00:00
interleaved-accesses-3.ll Second attempt at r285517. 2016-10-31 13:17:31 +00:00
interleaved-accesses-pred-stores.ll [ValueTracking] Teach computeKnownBits about [su]min/max 2016-08-06 08:16:00 +00:00
interleaved-accesses.ll [LV] Ensure reverse interleaved group GEPs remain uniform 2016-09-02 16:19:22 +00:00
intrinsic.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
iv_outside_user.ll [LV] Remove wrong assumption about LCSSA 2016-07-12 21:24:06 +00:00
lcssa-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
lifetime.ll
loop-form.ll
loop-vect-memdep.ll
memdep.ll
metadata-unroll.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
metadata-width.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
metadata.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
miniters.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
minmax_reduction.ll
multi-use-reduction-bug.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
multiple-address-spaces.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
multiple-strides-vectorization.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
no_array_bounds.ll [PR27284] Reverse the ownership between DICompileUnit and DISubprogram. 2016-04-15 15:57:41 +00:00
no_idiv_reduction.ll
no_int_induction.ll
no_outside_user.ll Recommit [LV] Enable vectorization of loops where the IV has an external use 2016-06-15 00:35:26 +00:00
no_switch.ll [LV] Stop saying "use -Rpass-analysis=loop-vectorize" 2016-11-11 22:51:46 +00:00
noalias-md-licm.ll
noalias-md.ll
nofloat.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
non-const-n.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
nontemporal.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
nsw-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
opt.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
optsize.ll
phi-hang.ll
pr25281.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
pr28541.ll [LoopVectorize] Detect loops in the innermost loop before creating InnerLoopVectorizer 2016-08-12 22:47:13 +00:00
ptr-induction.ll Reverted patch 273864 2016-06-29 10:01:06 +00:00
ptr_loops.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
read-only.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
reduction.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
reverse_induction.ll [LV] Don't emit unused scalars for uniform instructions 2016-09-21 16:50:24 +00:00
reverse_iter.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
runtime-check-address-space.ll
runtime-check-readonly-address-space.ll
runtime-check-readonly.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
runtime-check.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
runtime-limit.ll
safegep.ll
same-base-access.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
scalar-select.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
scalar_after_vectorization.ll [LV] Scalarize instructions marked scalar after vectorization 2016-09-26 17:08:37 +00:00
scev-exitlim-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
simple-unroll.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
small-loop.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
start-non-zero.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
store-shuffle-bug.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
struct_access.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
tbaa-nodep.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
undef-inst-bug.ll
unroll.ll
unroll_novec.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
unsafe-dep-remark.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
unsized-pointee-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
value-ptr-bug.ll
vect.omp.persistence.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
vect.stats.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
vectorize-once.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
version-mem-access.ll
write-only.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00
zero-sized-pointee-crash.ll [LV] Remove triples from target-independent vectorizer tests. NFC. 2016-10-06 23:57:25 +00:00