llvm-project/llvm/test/Transforms/LoopUnroll
Roman Lebedev b33fbbaa34
Reland [SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions
This was orginally committed in 2245fb8aaa.
but was immediately reverted in f3abd54958
because of a PHI handling issue.

Original commit message:

1. It doesn't make sense to enforce that the bonus instruction
   is only used once in it's basic block. What matters is
   whether those user instructions fit within our budget, sure,
   but that is another question.
2. It doesn't make sense to enforce that said bonus instructions
   are only used within their basic block. Perhaps the branch
   condition isn't using the value computed by said bonus instruction,
   and said bonus instruction is simply being calculated
   to be used in successors?

So iff we can clone bonus instructions, to lift these restrictions,
we just need to carefully update their external uses
to use the new cloned instructions.

Notably, this transform (even without this change) appears to be
poison-unsafe as per alive2, but is otherwise (including the patch) legal.

We don't introduce any new PHI nodes, but only "move" the instructions
around, i'm not really seeing much potential for extra cost modelling
for the transform, especially since now we allow at most one such
bonus instruction by default.

This causes the fold to fire +11.4% more (13216 -> 14725)
as of vanilla llvm test-suite + RawSpeed.

The motivational pattern is IEEE-754-2008 Binary16->Binary32
extension code:
ca57d77fb2/src/librawspeed/common/FloatingPoint.h (L115-L120)
^ that should be a switch, but it is not now: https://godbolt.org/z/bvja5v
That being said, even thought this seemed like this would fix it: https://godbolt.org/z/xGq3TM
apparently that fold is happening somewhere else afterall,
so something else also has a similar 'artificial' restriction.
2020-11-27 12:47:15 +03:00
..
AArch64 [LoopUnroll] add test for full unroll that is sensitive to cost-model; NFC 2020-11-20 08:15:46 -05:00
AMDGPU [AMDGPU] Add amdgpu specific loop threshold metadata 2020-10-22 17:21:32 +01:00
ARM [ARM] Don't aggressively unroll vector remainder loops 2020-11-10 17:01:31 +00:00
Hexagon [lit] Delete empty lines at the end of lit.local.cfg NFC 2019-06-17 09:51:07 +00:00
PowerPC [NFC][PowerPC] Update test 2020-03-18 16:21:37 +00:00
X86 [CostModel] Fix cast crash 2020-07-03 07:53:45 +01:00
2004-05-13-DontUnrollTooMuch.ll
2005-03-06-BadLoopInfoUpdate.ll
2006-08-24-MultiBlockLoop.ll
2007-04-16-PhiUpdate.ll
2007-05-05-UnrollMiscomp.ll
2007-05-09-UnknownTripCount.ll
2007-11-05-Crash.ll
2011-08-08-PhiUpdate.ll
2011-08-09-IVSimplify.ll
2011-08-09-PhiUpdate.ll
2011-10-01-NoopTrunc.ll
2012-04-09-unroll-indirectbr.ll
FullUnroll.ll [test] Fix FullUnroll.ll 2020-09-17 15:56:13 -07:00
basic.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
callbr.ll [LoopUnroll+LoopUnswitch] do not transform loops containing callbr 2019-07-15 21:16:29 +00:00
complete_unroll_profitability_with_assume.ll StoreInst should store Align, not MaybeAlign 2020-05-15 12:26:58 -07:00
convergent.ll
debug-info.ll
disable-full-unroll-by-opt.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
disable-loop-unrolling_forced.ll
disable_nonforced.ll
disable_nonforced_count.ll
disable_nonforced_enable.ll
disable_nonforced_full.ll
ephemeral.ll
epilog_const_phi.ll
followup.ll
full-unroll-bad-cost.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-crashers.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics-2.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics-cmp.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics-dce.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics-geps.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics-phi-prop.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-heuristics.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
full-unroll-keep-first-exit.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
high-cost-trip-count-computation.ll
ignore-annotation-intrinsic-cost.ll
invalidate_right_loop.ll
loop-remarks-with-hotness.ll
loop-remarks.ll
nonlatchcondbr.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
not-rotated.ll
opt-levels.ll [llvm] Make new pass manager's OptimizationLevel a class 2020-01-16 09:00:56 -08:00
optsize-loop-size.ll [LoopUnroll] Use LoopSize+1 as threshold, to allow unrolling loops matching LoopSize. 2019-09-17 09:02:48 +00:00
partial-unroll-const-bounds.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
partial-unroll-dead-instructions.ll [LoopUnroll] Avoid UB when converting from WeakVH to `Value *` 2020-01-23 10:36:39 -08:00
partially-unroll-unconditional-latch.ll [LoopUnroll] Add support for loops with exiting headers and uncond latches. 2019-06-26 09:16:57 +00:00
peel-loop-conditions-pgo-1.ll [LoopUtils] Better accuracy for getLoopEstimatedTripCount. 2020-01-20 16:58:07 +07:00
peel-loop-conditions-pgo-2.ll [Loop Peeling] Do not close further unroll/peel if profile based peeling was not used. 2019-08-02 04:29:23 +00:00
peel-loop-conditions.ll [Loop Peeling] Add possibility to enable peeling on loop nests. 2020-03-02 08:37:11 -08:00
peel-loop-inner.ll Reland [SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions 2020-11-27 12:47:15 +03:00
peel-loop-irreducible.ll
peel-loop-negative.ll [llvm] Fix missing FileCheck directive colons 2020-04-06 09:59:08 -06:00
peel-loop-nests.ll [Loop Peeling] Add possibility to enable peeling on loop nests. 2020-03-02 08:37:11 -08:00
peel-loop-not-forced.ll
peel-loop-pgo-deopt-idom-2.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
peel-loop-pgo-deopt-idom.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
peel-loop-pgo-deopt.ll Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
peel-loop-pgo.ll Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
peel-loop-scev-invalidate.ll
peel-loop.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
peel-loop2.ll
pr10813.ll
pr11361.ll
pr14167.ll Re-land "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support" 2020-07-28 14:00:11 +00:00
pr18861.ll
pr27157.ll
pr28132.ll
pr31718.ll
pr33437.ll [LoopUnroll] Extend test case with additional loop with larger TC. 2020-05-17 13:55:11 +01:00
pr45939-peel-count-and-complete-unroll.ll [LoopUnroll] Precommit test for PR459393. 2020-05-17 13:29:36 +01:00
rebuild_lcssa.ll
revisit.ll [NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations 2020-07-30 10:07:57 -07:00
runtime-epilog-debuginfo.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
runtime-li.ll [LoopUnroll] Add support for loops with exiting headers and uncond latches. 2019-06-26 09:16:57 +00:00
runtime-loop-branchweight.ll Revert "Use uint64_t for branch weights instead of uint32_t" 2020-10-31 00:25:32 -07:00
runtime-loop-multiexit-dom-verify.ll
runtime-loop-multiple-exits.ll [Value][InstCombine] Fix one-use checks in PHI-of-op -> Op-of-PHI[s] transforms to be one-user checks 2020-08-26 20:20:41 +03:00
runtime-loop-non-exiting-latch.ll
runtime-loop.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
runtime-loop1.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
runtime-loop2.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
runtime-loop3.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
runtime-loop4.ll
runtime-loop5.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
runtime-multiexit-heuristic.ll
runtime-small-upperbound.ll [NFC] run update test script 2020-08-17 13:54:28 +01:00
runtime-unroll-remainder.ll [InstComine] Forego of one-use check in `(X - (X & Y)) --> (X & ~Y)` if Y is a constant 2020-03-06 21:39:07 +03:00
scevunroll.ll [LoopPred] Enable new transformation by default 2019-11-06 15:41:57 -08:00
shifted-tripcount.ll
tripcount-overflow.ll
unloop.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
unroll-cleanup.ll
unroll-cleanuppad.ll
unroll-count.ll
unroll-header-exiting-with-phis.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
unroll-heuristics-pgo.ll
unroll-loop-invalidation.ll [NewPM] Don't print 'Invalidating all non-preserved analyses' 2020-07-30 19:40:29 -07:00
unroll-maxcount.ll
unroll-opt-attribute.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
unroll-pragmas-disabled.ll
unroll-pragmas.ll
unroll-preserve-scev-lcssa.ll [LCSSA] Forget values we create LCSSA phis for 2019-10-29 12:05:09 +00:00
unroll-unconditional-latch.ll [LoopUnroll] Add support for loops with exiting headers and uncond latches. 2019-06-26 09:16:57 +00:00
update-loop-info-in-subloops.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
wrong_assert_in_peeling.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00