|
23 | 23 | #include "llvm/IR/IRBuilder.h"
|
24 | 24 | #include "llvm/IR/InstVisitor.h"
|
25 | 25 | #include "llvm/IR/PatternMatch.h"
|
| 26 | +#include "llvm/IR/ProfDataUtils.h" |
26 | 27 | #include "llvm/IR/Value.h"
|
27 | 28 | #include "llvm/Support/Debug.h"
|
28 | 29 | #include "llvm/Support/KnownBits.h"
|
@@ -62,14 +63,14 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
|
62 | 63 | public InstVisitor<InstCombinerImpl, Instruction *> {
|
63 | 64 | public:
|
64 | 65 | InstCombinerImpl(InstructionWorklist &Worklist, BuilderTy &Builder,
|
65 |
| - bool MinimizeSize, AAResults *AA, AssumptionCache &AC, |
| 66 | + Function &F, AAResults *AA, AssumptionCache &AC, |
66 | 67 | TargetLibraryInfo &TLI, TargetTransformInfo &TTI,
|
67 | 68 | DominatorTree &DT, OptimizationRemarkEmitter &ORE,
|
68 | 69 | BlockFrequencyInfo *BFI, BranchProbabilityInfo *BPI,
|
69 | 70 | ProfileSummaryInfo *PSI, const DataLayout &DL,
|
70 | 71 | ReversePostOrderTraversal<BasicBlock *> &RPOT)
|
71 |
| - : InstCombiner(Worklist, Builder, MinimizeSize, AA, AC, TLI, TTI, DT, ORE, |
72 |
| - BFI, BPI, PSI, DL, RPOT) {} |
| 72 | + : InstCombiner(Worklist, Builder, F, AA, AC, TLI, TTI, DT, ORE, BFI, BPI, |
| 73 | + PSI, DL, RPOT) {} |
73 | 74 |
|
74 | 75 | virtual ~InstCombinerImpl() = default;
|
75 | 76 |
|
@@ -469,6 +470,17 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
|
469 | 470 | Value *simplifyNonNullOperand(Value *V, bool HasDereferenceable,
|
470 | 471 | unsigned Depth = 0);
|
471 | 472 |
|
| 473 | + SelectInst *createSelectInst(Value *C, Value *S1, Value *S2, |
| 474 | + const Twine &NameStr = "", |
| 475 | + InsertPosition InsertBefore = nullptr, |
| 476 | + Instruction *MDFrom = nullptr) { |
| 477 | + SelectInst *SI = |
| 478 | + SelectInst::Create(C, S1, S2, NameStr, InsertBefore, MDFrom); |
| 479 | + if (!MDFrom) |
| 480 | + setExplicitlyUnknownBranchWeightsIfProfiled(*SI, F, DEBUG_TYPE); |
| 481 | + return SI; |
| 482 | + } |
| 483 | + |
472 | 484 | public:
|
473 | 485 | /// Create and insert the idiom we use to indicate a block is unreachable
|
474 | 486 | /// without having to rewrite the CFG from within InstCombine.
|
|
0 commit comments