summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-04-15 15:32:12 +0000
committerSanjay Patel <spatel@rotateright.com>2016-04-15 15:32:12 +0000
commitf11ab05bdb2f032c1fbddf11987e073e112d9b0a (patch)
tree77c26ebae2ae94271efd63d47520b6f3a59fb27d
parentc5727ecd8884dff1a6abb0559275638f5d235469 (diff)
downloadbcm5719-llvm-f11ab05bdb2f032c1fbddf11987e073e112d9b0a.tar.gz
bcm5719-llvm-f11ab05bdb2f032c1fbddf11987e073e112d9b0a.zip
[SimplifyCFG] propagate branch metadata when creating select (PR27344)
This is almost identical to: http://reviews.llvm.org/rL264527 This doesn't solve PR27344; it just allows the profile weights to survive. To solve the bug, we need to use the profile weights in the backend. llvm-svn: 266442
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp4
-rw-r--r--llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll2
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 456ad2a62b7..1c27bc67cfb 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1678,8 +1678,8 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB,
Value *TrueV = ThenV, *FalseV = OrigV;
if (Invert)
std::swap(TrueV, FalseV);
- Value *V = Builder.CreateSelect(BrCond, TrueV, FalseV,
- TrueV->getName() + "." + FalseV->getName());
+ Value *V = Builder.CreateSelect(
+ BrCond, TrueV, FalseV, TrueV->getName() + "." + FalseV->getName(), BI);
PN->setIncomingValue(OrigI, V);
PN->setIncomingValue(ThenI, V);
}
diff --git a/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll b/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
index 56474ce7189..1e9aa6b48f6 100644
--- a/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
+++ b/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
@@ -6,7 +6,7 @@ define i1 @qux(i8* %m, i8* %n, i8* %o, i8* %p) nounwind {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i8* %m, %n
; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i8* %o, %p
-; CHECK-NEXT: [[TMP15_:%.*]] = select i1 [[TMP7]], i1 [[TMP15]], i1 false
+; CHECK-NEXT: [[TMP15_:%.*]] = select i1 [[TMP7]], i1 [[TMP15]], i1 false, !prof !0
; CHECK-NEXT: ret i1 [[TMP15_]]
;
entry:
OpenPOWER on IntegriCloud