This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH GCC][2/2]Refine CFG and bound information for split loops


Hi,
Loop split currently generates below control flow graph for split loops:
+
+               .------ guard1  ------.
+               v                     v
+         pre1(loop1)    .---------->pre2(loop2)
+              |         |            |
+        .--->h1         |           h2<----.
+        |     |         |            |     |
+        |    ex1---.    |       .---ex2    |
+        |    /     v    |       |     \    |
+        '---l1 guard2---'       |     l2---'
+                   |            |
+                   |            |
+                   '--->join<---'
+
In which,
+   LOOP2 is the second loop after split, GUARD1 and GUARD2 are the two bbs
+   controling if loop2 should be executed.

Take added test case as an example, the second loop only iterates for 1 time,
as a result, the CFG and loop niter bound information can be refined.  In general,
guard1/guard2 can be folded to true/false if loop2's niters is known at compilation
time.  This patch does such improvement by analyzing and refining niters of
loop2; as well as using that information to simplify CFG.  With this patch,
the second split loop as in test can be completely unrolled by later passes.

Bootstrap and test on x86_64 and AArch64.  Is it OK?

Thanks,
bin
2017-06-12  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-loop-split.c (compute_new_first_bound): Compute and
	return bound information for the second split loop.
	(adjust_loop_split): New function.
	(split_loop): Update calls to above functions.

gcc/testsuite/ChangeLog
2017-06-12  Bin Cheng  <bin.cheng@arm.com>

	* gcc.dg/loop-split-1.c: New test.

Attachment: 0002-lsplit-refine-cfg-niter-bound-20170601.txt
Description: 0002-lsplit-refine-cfg-niter-bound-20170601.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]