Alina Sbirlea
dfd14adeb0
Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.
...
Summary:
Two utils methods have essentially the same functionality. This is an attempt to merge them into one.
1. lib/Transforms/Utils/Local.cpp : MergeBasicBlockIntoOnlyPred
2. lib/Transforms/Utils/BasicBlockUtils.cpp : MergeBlockIntoPredecessor
Prior to the patch:
1. MergeBasicBlockIntoOnlyPred
Updates either DomTree or DeferredDominance
Moves all instructions from Pred to BB, deletes Pred
Asserts BB has single predecessor
If address was taken, replace the block address with constant 1 (?)
2. MergeBlockIntoPredecessor
Updates DomTree, LoopInfo and MemoryDependenceResults
Moves all instruction from BB to Pred, deletes BB
Returns if doesn't have a single predecessor
Returns if BB's address was taken
After the patch:
Method 2. MergeBlockIntoPredecessor is attempting to become the new default:
Updates DomTree or DeferredDominance, and LoopInfo and MemoryDependenceResults
Moves all instruction from BB to Pred, deletes BB
Returns if doesn't have a single predecessor
Returns if BB's address was taken
Uses of MergeBasicBlockIntoOnlyPred that need to be replaced:
1. lib/Transforms/Scalar/LoopSimplifyCFG.cpp
Updated in this patch. No challenges.
2. lib/CodeGen/CodeGenPrepare.cpp
Updated in this patch.
i. eliminateFallThrough is straightforward, but I added using a temporary array to avoid the iterator invalidation.
ii. eliminateMostlyEmptyBlock(s) methods also now use a temporary array for blocks
Some interesting aspects:
- Since Pred is not deleted (BB is), the entry block does not need updating.
- The entry block was being updated with the deleted block in eliminateMostlyEmptyBlock. Added assert to make obvious that BB=SinglePred.
- isMergingEmptyBlockProfitable assumes BB is the one to be deleted.
- eliminateMostlyEmptyBlock(BB) does not delete BB on one path, it deletes its unique predecessor instead.
- adding some test owner as subscribers for the interesting tests modified:
test/CodeGen/X86/avx-cmp.ll
test/CodeGen/AMDGPU/nested-loop-conditions.ll
test/CodeGen/AMDGPU/si-annotate-cf.ll
test/CodeGen/X86/hoist-spill.ll
test/CodeGen/X86/2006-11-17-IllegalMove.ll
3. lib/Transforms/Scalar/JumpThreading.cpp
Not covered in this patch. It is the only use case using the DeferredDominance.
I would defer to Brian Rzycki to make this replacement.
Reviewers: chandlerc, spatel, davide, brzycki, bkramer, javed.absar
Subscribers: qcolombet, sanjoy, nemanjai, nhaehnle, jlebar, tpr, kbarton, RKSimon, wmi, arsenm, llvm-commits
Differential Revision: https://reviews.llvm.org/D48202
llvm-svn: 335183
2018-06-20 22:01:04 +00:00
..
2018-05-16 10:32:02 +00:00
2018-05-14 21:32:52 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-01-19 17:13:12 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-30 14:57:12 +00:00
2018-05-17 18:09:56 +00:00
2017-07-28 20:21:02 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-30 18:06:51 +00:00
2017-12-07 10:40:31 +00:00
2017-07-28 20:21:02 +00:00
2018-05-09 02:40:45 +00:00
2018-01-19 17:13:12 +00:00
2018-05-09 02:40:45 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-01-09 17:31:07 +00:00
2017-08-01 22:20:49 +00:00
2018-01-19 17:13:12 +00:00
2018-03-14 21:52:13 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-06-11 21:27:41 +00:00
2018-02-10 15:14:00 +00:00
2018-01-31 22:04:26 +00:00
2018-05-09 02:40:45 +00:00
2018-02-16 09:35:16 +00:00
2017-11-30 16:12:24 +00:00
2014-08-21 12:50:31 +00:00
2018-06-20 12:09:44 +00:00
2017-12-13 10:45:21 +00:00
2015-02-24 17:22:34 +00:00
2018-03-27 16:44:41 +00:00
2018-03-27 16:44:41 +00:00
2016-01-26 00:03:25 +00:00
2017-11-28 04:07:59 +00:00
2017-08-01 22:20:49 +00:00
2018-06-19 00:07:30 +00:00
2018-02-16 09:23:59 +00:00
2017-07-07 13:41:33 +00:00
2017-07-07 13:41:33 +00:00
2017-06-30 00:03:54 +00:00
2017-12-04 17:18:51 +00:00
2018-01-19 17:13:12 +00:00
2017-08-23 11:53:24 +00:00
2017-08-18 19:13:56 +00:00
2017-11-13 11:56:48 +00:00
2018-04-07 10:57:03 +00:00
2017-12-06 15:30:13 +00:00
2018-06-02 16:40:03 +00:00
2018-06-10 09:27:27 +00:00
2018-05-09 02:40:45 +00:00
2017-08-28 20:20:47 +00:00
2018-02-16 09:23:59 +00:00
2018-02-28 17:13:07 +00:00
2017-12-04 17:18:51 +00:00
2017-12-21 01:22:13 +00:00
2017-08-01 22:20:49 +00:00
2014-04-03 16:01:44 +00:00
2017-12-04 17:18:51 +00:00
2018-06-06 18:56:00 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-06-19 00:09:44 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-02-16 09:23:59 +00:00
2017-06-30 19:51:02 +00:00
2018-02-16 09:23:59 +00:00
2017-12-04 17:18:51 +00:00
2018-05-09 02:40:45 +00:00
2017-06-28 07:07:03 +00:00
2018-01-20 01:26:46 +00:00
2018-02-22 08:41:55 +00:00
2017-07-01 02:55:22 +00:00
2018-05-09 02:40:45 +00:00
2017-09-07 04:00:13 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2017-12-04 17:18:51 +00:00
2017-12-04 17:18:51 +00:00
2017-07-12 15:30:59 +00:00
2017-07-12 15:30:59 +00:00
2017-07-12 15:30:59 +00:00
2017-12-04 17:18:51 +00:00
2017-12-04 17:18:51 +00:00
2017-07-12 15:30:59 +00:00
2017-07-12 15:30:59 +00:00
2017-07-12 15:30:59 +00:00
2017-12-04 17:18:51 +00:00
2018-04-27 11:29:49 +00:00
2017-12-07 10:40:31 +00:00
2018-01-19 17:13:12 +00:00
2017-12-04 17:18:51 +00:00
2017-08-22 11:02:37 +00:00
2017-08-01 22:20:49 +00:00
2017-06-30 00:03:54 +00:00
2017-06-30 00:03:54 +00:00
2018-04-07 19:09:50 +00:00
2014-05-30 10:09:59 +00:00
2018-05-09 02:40:45 +00:00
2016-08-23 09:19:22 +00:00
2015-06-17 20:52:32 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-01-19 17:13:12 +00:00
2018-05-16 21:57:00 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-16 21:57:19 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2016-01-29 10:23:32 +00:00
2016-06-24 21:14:33 +00:00
2017-12-04 17:18:51 +00:00
2018-01-22 10:05:23 +00:00
2018-01-12 09:24:41 +00:00
2018-02-09 17:13:37 +00:00
2018-01-19 17:13:12 +00:00
2018-05-09 02:40:45 +00:00
2018-02-09 17:13:37 +00:00
2018-02-09 17:13:37 +00:00
2017-11-17 08:04:40 +00:00
2017-08-01 22:20:49 +00:00
2018-02-28 17:48:55 +00:00
2018-02-28 17:48:55 +00:00
2017-07-01 02:55:22 +00:00
2017-07-01 02:55:22 +00:00
2017-11-13 11:56:48 +00:00
2018-01-31 22:04:26 +00:00
2015-02-27 18:32:11 +00:00
2018-04-11 16:03:07 +00:00
2016-05-10 19:17:47 +00:00
2014-07-16 22:20:51 +00:00
2018-04-11 16:03:07 +00:00
2018-04-11 16:03:07 +00:00
2018-04-13 22:25:20 +00:00
2018-04-11 16:03:07 +00:00
2018-03-28 10:02:26 +00:00
2017-07-11 22:23:00 +00:00
2017-07-28 09:21:00 +00:00
2018-02-02 11:51:06 +00:00
2017-09-22 09:50:52 +00:00
2018-06-14 20:54:13 +00:00
2018-05-09 02:40:45 +00:00
2017-02-15 19:49:14 +00:00
2018-05-09 02:40:45 +00:00
2018-05-15 14:16:24 +00:00
2018-03-19 13:35:25 +00:00
2018-03-19 13:35:25 +00:00
2018-04-25 18:58:06 +00:00
2018-04-25 18:58:06 +00:00
2018-02-22 10:43:57 +00:00
2018-02-22 10:43:57 +00:00
2018-02-16 09:23:59 +00:00
2018-04-13 15:34:26 +00:00
2018-04-13 15:34:26 +00:00
2018-01-31 22:04:26 +00:00
2018-02-17 19:59:29 +00:00
2018-04-20 15:07:55 +00:00
2018-06-06 14:48:32 +00:00
2018-06-06 14:48:32 +00:00
2018-03-27 16:44:41 +00:00
2018-03-27 16:44:41 +00:00
2018-05-19 18:00:02 +00:00
2013-07-14 06:24:09 +00:00
2017-08-22 11:02:37 +00:00
2018-05-16 22:20:33 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2018-02-09 00:10:31 +00:00
2018-02-09 00:10:31 +00:00
2017-08-01 22:20:49 +00:00
2017-12-07 10:40:31 +00:00
2018-02-09 00:10:31 +00:00
2017-12-04 17:18:51 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2017-11-30 16:12:24 +00:00
2017-08-11 06:57:08 +00:00
2018-06-20 22:01:04 +00:00
2015-02-27 21:17:42 +00:00
2014-04-03 16:01:44 +00:00
2016-07-20 09:48:24 +00:00
2014-04-03 16:01:44 +00:00
2015-02-27 19:29:02 +00:00
2018-02-15 19:17:55 +00:00
2016-04-08 18:15:37 +00:00
2016-04-25 14:29:18 +00:00
2018-02-15 14:44:22 +00:00
2018-01-19 17:13:12 +00:00
2016-09-13 12:18:15 +00:00
2018-02-27 16:59:10 +00:00
2017-12-04 17:18:51 +00:00
2015-02-27 21:17:42 +00:00
2018-05-03 12:54:25 +00:00
2018-01-19 17:13:12 +00:00
2018-03-14 21:52:13 +00:00
2017-08-03 02:16:21 +00:00
2017-11-30 16:12:24 +00:00
2018-06-08 21:16:56 +00:00
2017-12-14 18:06:25 +00:00
2018-01-31 22:04:26 +00:00
2018-03-27 17:33:50 +00:00
2018-03-27 17:33:50 +00:00
2017-11-13 20:45:38 +00:00
2017-11-30 16:12:24 +00:00
2018-02-16 09:23:59 +00:00
2018-02-16 09:51:01 +00:00
2017-09-18 17:28:15 +00:00
2016-04-13 23:08:27 +00:00
2018-01-31 22:04:26 +00:00
2018-01-19 17:13:12 +00:00
2017-12-04 17:18:51 +00:00
2018-04-13 22:25:20 +00:00
2018-05-16 15:36:52 +00:00
2018-01-19 17:13:12 +00:00
2018-01-19 17:13:12 +00:00
2018-02-06 23:22:14 +00:00
2018-01-19 17:13:12 +00:00
2017-12-07 10:40:31 +00:00
2017-05-25 21:26:32 +00:00
2018-03-14 21:52:13 +00:00
2018-01-31 22:04:26 +00:00
2017-08-01 22:20:49 +00:00
2017-12-04 17:18:51 +00:00
2015-02-27 21:17:42 +00:00
2017-12-04 17:18:51 +00:00
2018-04-27 12:50:40 +00:00
2017-12-04 17:18:51 +00:00
2017-08-09 15:39:10 +00:00
2017-08-30 18:06:51 +00:00
2017-09-01 18:36:26 +00:00
2017-12-04 17:18:51 +00:00
2018-04-07 10:57:03 +00:00
2018-01-19 17:46:27 +00:00
2017-08-01 22:20:49 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2017-04-06 22:42:18 +00:00
2017-11-30 16:12:24 +00:00
2018-02-06 23:00:17 +00:00
2017-11-28 01:17:52 +00:00
2017-12-11 12:13:45 +00:00
2017-12-11 12:13:45 +00:00
2017-12-11 12:13:45 +00:00
2018-03-07 09:10:44 +00:00
2018-01-31 22:04:26 +00:00
2018-01-08 14:47:19 +00:00
2017-11-30 16:12:24 +00:00
2015-02-27 19:29:02 +00:00
2018-01-31 22:04:26 +00:00
2018-01-31 22:04:26 +00:00
2017-09-14 14:48:59 +00:00
2018-05-17 18:08:27 +00:00
2018-06-06 09:40:06 +00:00
2017-07-05 17:55:42 +00:00
2018-02-28 17:13:07 +00:00
2017-08-01 22:20:49 +00:00
2018-01-31 22:04:26 +00:00
2018-05-09 02:40:45 +00:00
2011-07-02 20:43:11 +00:00
2017-08-28 20:20:47 +00:00
2017-08-28 20:20:47 +00:00
2017-12-04 17:18:51 +00:00
2018-02-16 09:51:01 +00:00
2018-02-16 09:23:59 +00:00
2018-01-31 22:55:19 +00:00
2018-02-16 09:23:59 +00:00
2017-09-28 19:04:30 +00:00
2018-06-20 12:09:44 +00:00
2018-01-24 18:00:57 +00:00
2018-03-14 21:52:13 +00:00
2018-03-14 15:44:07 +00:00
2017-09-28 19:04:14 +00:00
2018-05-29 18:17:16 +00:00
2017-07-19 12:57:16 +00:00
2018-05-16 22:20:11 +00:00
2018-02-02 00:08:19 +00:00
2017-08-01 22:20:49 +00:00
2015-02-27 21:17:42 +00:00
2014-04-23 01:09:29 +00:00
2018-01-19 17:13:12 +00:00
2018-03-26 20:40:22 +00:00
2014-12-15 19:07:53 +00:00
2017-06-30 00:03:54 +00:00
2018-02-16 09:51:01 +00:00
2018-01-19 17:13:12 +00:00
2017-08-22 11:02:37 +00:00
2018-01-09 17:31:07 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-04-11 16:03:07 +00:00
2016-09-08 13:12:22 +00:00
2018-01-31 22:04:26 +00:00
2018-02-09 00:10:31 +00:00
2018-01-19 17:13:12 +00:00
2018-02-09 00:10:31 +00:00
2016-12-27 18:35:19 +00:00
2017-11-27 10:13:14 +00:00
2017-08-01 22:20:49 +00:00
2018-01-31 22:04:26 +00:00
2017-06-29 14:51:54 +00:00
2017-11-30 16:12:24 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 22:20:49 +00:00
2018-02-12 11:06:27 +00:00
2018-05-21 12:43:54 +00:00
2017-11-02 10:43:10 +00:00
2017-08-01 22:20:49 +00:00
2017-08-01 00:28:40 +00:00
2017-12-20 11:13:57 +00:00
2018-01-31 22:04:26 +00:00
2018-01-26 10:20:58 +00:00
2017-12-04 17:18:51 +00:00
2017-08-01 22:20:49 +00:00
2017-12-04 17:18:51 +00:00
2017-11-30 16:12:24 +00:00
2017-08-01 22:20:49 +00:00
2017-12-04 17:18:51 +00:00
2017-11-30 16:12:24 +00:00
2018-05-01 19:26:15 +00:00
2017-08-01 22:20:49 +00:00
2017-12-04 17:18:51 +00:00
2017-08-01 22:20:49 +00:00
2018-05-09 02:40:45 +00:00
2018-01-31 22:04:26 +00:00
2018-03-02 13:02:55 +00:00
2018-03-02 13:02:55 +00:00
2018-01-31 22:04:26 +00:00
2017-08-01 22:20:49 +00:00
2017-12-04 17:18:51 +00:00
2018-04-13 12:45:12 +00:00
2017-08-01 22:20:49 +00:00
2017-09-25 19:26:08 +00:00
2018-03-02 13:02:55 +00:00
2018-03-02 13:02:55 +00:00
2017-12-04 17:18:51 +00:00
2018-05-03 12:54:25 +00:00
2017-12-04 17:18:51 +00:00
2016-08-23 09:19:22 +00:00
2018-05-29 18:17:16 +00:00
2017-09-04 05:34:58 +00:00
2017-09-04 05:34:58 +00:00
2016-04-19 23:51:52 +00:00
2018-04-07 23:36:10 +00:00
2017-08-01 22:20:49 +00:00