[llvm] r334993 - Revert "Simplify blockaddress usage before giving up in MergeBlockIntoPredecessor"
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 18 17:52:07 PDT 2018
You should use the revert instructions in http://llvm.org/docs/GettingStarted.html#for-developers-to-work-with-git-svn so that you end up with an SVN revision number instead of a git hash in your commit message.
From: llvm-commits <llvm-commits-bounces at lists.llvm.org> on behalf of Xin Tong via llvm-commits <llvm-commits at lists.llvm.org>
Reply-To: Xin Tong <trent.xin.tong at gmail.com>
Date: Monday, June 18, 2018 at 4:25 PM
To: "llvm-commits at lists.llvm.org" <llvm-commits at lists.llvm.org>
Subject: [llvm] r334993 - Revert "Simplify blockaddress usage before giving up in MergeBlockIntoPredecessor"
Author: trentxintong
Date: Mon Jun 18 16:20:08 2018
New Revision: 334993
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D334993-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h3HKGcX0-trl93_e29E2Foso6t9GNBoAdDczCRJmg1I&s=2qYaafNd6i42bQ2Xwvnip27p30pkuvnKpL5QywXf_A8&e=
Log:
Revert "Simplify blockaddress usage before giving up in MergeBlockIntoPredecessor"
This reverts commit f976cf4cca0794267f28b54e468007fd476d37d9.
I am reverting this because it causes break in a few bots and its going
to take me sometime to look at this.
Modified:
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/trunk/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll
llvm/trunk/unittests/Transforms/Utils/BasicBlockUtils.cpp
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Transforms_Utils_BasicBlockUtils.cpp-3Frev-3D334993-26r1-3D334992-26r2-3D334993-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h3HKGcX0-trl93_e29E2Foso6t9GNBoAdDczCRJmg1I&s=1XbIuLzOOqRkP_cDH4VZRJ-egaPnK9G9gjIV3NNh618&e=
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Jun 18 16:20:08 2018
@@ -119,14 +119,7 @@ bool llvm::MergeBlockIntoPredecessor(Bas
LoopInfo *LI,
MemoryDependenceResults *MemDep) {
// Don't merge away blocks who have their address taken.
- if (BB->hasAddressTaken()) {
- // If the block has its address taken, it may be a tree of dead constants
- // hanging off of it. These shouldn't keep the block alive.
- BlockAddress *BA = BlockAddress::get(BB);
- BA->removeDeadConstantUsers();
- if (!BA->use_empty())
- return false;
- }
+ if (BB->hasAddressTaken()) return false;
// Can't merge if there are multiple predecessors, or no predecessors.
BasicBlock *PredBB = BB->getUniquePredecessor();
Modified: llvm/trunk/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Transforms_SimplifyCFG_dce-2Dcond-2Dafter-2Dfolding-2Dterminator.ll-3Frev-3D334993-26r1-3D334992-26r2-3D334993-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h3HKGcX0-trl93_e29E2Foso6t9GNBoAdDczCRJmg1I&s=XsJTlGj2vpGLC8P2J7zUGT2-ikb0IuuqssWqqua-CO8&e=
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/dce-cond-after-folding-terminator.ll Mon Jun 18 16:20:08 2018
@@ -37,7 +37,10 @@ define void @test_indirectbr(i32 %x) {
entry:
; CHECK-LABEL: @test_indirectbr(
; CHECK-NEXT: entry:
-; CHECK-NEXT: ret void
+; Ideally this should now check:
+; CHK-NEXT: ret void
+; But that doesn't happen yet. Instead:
+; CHECK-NEXT: br label %L1
%label = bitcast i8* blockaddress(@test_indirectbr, %L1) to i8*
indirectbr i8* %label, [label %L1, label %L2]
Modified: llvm/trunk/unittests/Transforms/Utils/BasicBlockUtils.cpp
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_Transforms_Utils_BasicBlockUtils.cpp-3Frev-3D334993-26r1-3D334992-26r2-3D334993-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h3HKGcX0-trl93_e29E2Foso6t9GNBoAdDczCRJmg1I&s=uF13OrC35SzcMBdDs5ZpeDqDLkeaz9fhNdujwaEiyMw&e=
==============================================================================
--- llvm/trunk/unittests/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/unittests/Transforms/Utils/BasicBlockUtils.cpp Mon Jun 18 16:20:08 2018
@@ -50,31 +50,3 @@ TEST(BasicBlockUtils, SplitBlockPredeces
SplitBlockPredecessors(&F->getEntryBlock(), {}, "split.entry", &DT);
EXPECT_TRUE(DT.verify());
}
-
-TEST(BasicBlockUtils, MergeBlockIntoPredecessor) {
- LLVMContext C;
- std::unique_ptr<Module> M = parseIR(C,
- R"(
-
- define i32 @f(i8* %str) {
- entry:
- %dead = extractvalue [1 x i8*] [ i8* blockaddress(@f, %L0) ], 0
- br label %L0
- L0:
- ret i32 0
- }
- )");
-
- // First remove the dead instruction to empty the usage of the constant
- // containing blockaddress(@f, %L0)
- Function *F = M->getFunction("f");
- auto BBI = F->begin();
- Instruction *DI = &*((*BBI).begin());
- EXPECT_TRUE(DI->use_empty());
- DI->eraseFromParent();
-
- // Get L0 and make sure that it can be merged into entry block.
- ++BBI;
- BasicBlock *BB = &(*BBI);
- EXPECT_TRUE(MergeBlockIntoPredecessor(BB));
-}
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=h3HKGcX0-trl93_e29E2Foso6t9GNBoAdDczCRJmg1I&s=ll3nyaoQ2HBe9WbfPnyHr9Exod9O9Xss7ddce0mEIIw&e=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180619/04013b90/attachment-0001.html>
More information about the llvm-commits
mailing list