|
15 | 15 | #include "llvm/ADT/STLExtras.h"
|
16 | 16 | #include "llvm/ADT/SmallPtrSet.h"
|
17 | 17 | #include "llvm/Analysis/AssumptionCache.h"
|
| 18 | +#include "llvm/Analysis/IteratedDominanceFrontier.h" |
18 | 19 | #include "llvm/IR/AssemblyAnnotationWriter.h"
|
19 | 20 | #include "llvm/IR/Dominators.h"
|
20 | 21 | #include "llvm/IR/IRBuilder.h"
|
@@ -213,6 +214,8 @@ class PredicateInfoBuilder {
|
213 | 214 | // whether it returned a valid result.
|
214 | 215 | DenseMap<Value *, unsigned int> ValueInfoNums;
|
215 | 216 |
|
| 217 | + DenseMap<BasicBlock *, SmallVector<Value *, 4>> PHICandidates; |
| 218 | + |
216 | 219 | BumpPtrAllocator &Allocator;
|
217 | 220 |
|
218 | 221 | ValueInfo &getOrCreateValueInfo(Value *);
|
@@ -478,6 +481,9 @@ void PredicateInfoBuilder::buildPredicateInfo() {
|
478 | 481 | if (DT.isReachableFromEntry(II->getParent()))
|
479 | 482 | processAssume(II, II->getParent(), OpsToRename);
|
480 | 483 | }
|
| 484 | + |
| 485 | + // ... |
| 486 | + |
481 | 487 | // Now rename all our operations.
|
482 | 488 | renameUses(OpsToRename);
|
483 | 489 | }
|
@@ -773,6 +779,8 @@ std::optional<PredicateConstraint> PredicateBase::getConstraint() const {
|
773 | 779 | }
|
774 | 780 |
|
775 | 781 | return {{CmpInst::ICMP_EQ, cast<PredicateSwitch>(this)->CaseValue}};
|
| 782 | + case PT_PHI: |
| 783 | + return cast<PredicatePHI>(this)->getConstraint(); |
776 | 784 | }
|
777 | 785 | llvm_unreachable("Unknown predicate type");
|
778 | 786 | }
|
@@ -838,6 +846,10 @@ class PredicateInfoAnnotatedWriter : public AssemblyAnnotationWriter {
|
838 | 846 | } else if (const auto *PA = dyn_cast<PredicateAssume>(PI)) {
|
839 | 847 | OS << "; assume predicate info {"
|
840 | 848 | << " Comparison:" << *PA->Condition;
|
| 849 | + } else if (const auto *PP = dyn_cast<PredicatePHI>(PI)) { |
| 850 | + OS << "; phi predicate info { PHIBlock: "; |
| 851 | + PP->PHIBlock->printAsOperand(OS); |
| 852 | + OS << " IncomingEdges: " << PP->IncomingPredicates.size(); |
841 | 853 | }
|
842 | 854 | OS << ", RenamedOp: ";
|
843 | 855 | PI->RenamedOp->printAsOperand(OS, false);
|
|
0 commit comments