[PATCH] D11175: [CGP] DisableBranchOpts guards against EliminateMostlyEmptyBlocks
Jingyue Wu
jingyue at google.com
Mon Jul 13 22:46:39 PDT 2015
jingyue created this revision.
jingyue added reviewers: ributzka, echristo.
jingyue added a subscriber: llvm-commits.
DisableBranchOpts is designed to disable all branch optimizations including
EliminateMostlyEmptyBlocks.
http://reviews.llvm.org/D11175
Files:
lib/CodeGen/CodeGenPrepare.cpp
test/Transforms/CodeGenPrepare/disable-branch-opts.ll
Index: test/Transforms/CodeGenPrepare/disable-branch-opts.ll
===================================================================
--- /dev/null
+++ test/Transforms/CodeGenPrepare/disable-branch-opts.ll
@@ -0,0 +1,20 @@
+; RUN: opt < %s -S -codegenprepare -disable-cgp-branch-opts | FileCheck %s
+
+define void @foo(i32 %x, float* %output) {
+; CHECK-LABEL: @foo(
+ %1 = icmp eq i32 %x, 1
+ br i1 %1, label %then, label %else
+
+then:
+; CHECK: then:
+ br label %merge
+
+else:
+; CHECK: else:
+ br label %merge
+
+merge:
+; CHECK: merge:
+ store float 2.0, float* %output
+ ret void
+}
Index: lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- lib/CodeGen/CodeGenPrepare.cpp
+++ lib/CodeGen/CodeGenPrepare.cpp
@@ -231,7 +231,8 @@
// Eliminate blocks that contain only PHI nodes and an
// unconditional branch.
- EverMadeChange |= EliminateMostlyEmptyBlocks(F);
+ if (!DisableBranchOpts)
+ EverMadeChange |= EliminateMostlyEmptyBlocks(F);
// llvm.dbg.value is far away from the value then iSel may not be able
// handle it properly. iSel will drop llvm.dbg.value if it can not
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11175.29644.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150714/a7d477a0/attachment.bin>
More information about the llvm-commits
mailing list