1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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
This commit is contained in:
Sanjay Patel 2016-04-15 15:32:12 +00:00
parent d8734ae63f
commit d65ab200a1
2 changed files with 3 additions and 3 deletions

View File

@ -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);
}

View File

@ -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: