Skip to content

Commit 4d706b2

Browse files
committed
[InstCombine] Mark as unknown the branch weights of packed integer selecting shifts
1 parent a4015d9 commit 4d706b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/IR/GetElementPtrTypeIterator.h"
1717
#include "llvm/IR/IntrinsicInst.h"
1818
#include "llvm/IR/PatternMatch.h"
19+
#include "llvm/IR/ProfDataUtils.h"
1920
#include "llvm/Support/KnownBits.h"
2021
#include "llvm/Transforms/InstCombine/InstCombiner.h"
2122

@@ -108,6 +109,11 @@ static Value *simplifyShiftSelectingPackedElement(Instruction *I,
108109
IC.Builder.CreateICmpEQ(ShrAmt, Constant::getNullValue(ShrAmt->getType()),
109110
ShrAmt->getName() + ".z");
110111
Value *Select = IC.Builder.CreateSelect(ShrAmtZ, Lower, Upper);
112+
// There is no existing !prof metadata we can derive the !prof metadata for
113+
// this select.
114+
if (auto *SI = dyn_cast<SelectInst>(Select))
115+
setExplicitlyUnknownBranchWeightsIfProfiled(
116+
*SI, *SI->getParent()->getParent(), DEBUG_TYPE);
111117
Select->takeName(I);
112118
return Select;
113119
}

0 commit comments

Comments
 (0)