xref: /freebsd/contrib/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp (revision 2fb4f839f3fc72ce2bab12f9ba4760f97f73e97f)
1 //===-- ConstraintElimination.cpp - Eliminate conds using constraints. ----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Eliminate conditions based on constraints collected from dominating
10 // conditions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/Transforms/Scalar/ConstraintElimination.h"
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/ADT/ScopeExit.h"
17 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/ADT/Statistic.h"
19 #include "llvm/Analysis/ConstraintSystem.h"
20 #include "llvm/Analysis/GlobalsModRef.h"
21 #include "llvm/Analysis/ValueTracking.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/IR/Dominators.h"
24 #include "llvm/IR/Function.h"
25 #include "llvm/IR/Instructions.h"
26 #include "llvm/IR/PatternMatch.h"
27 #include "llvm/InitializePasses.h"
28 #include "llvm/Pass.h"
29 #include "llvm/Support/Debug.h"
30 #include "llvm/Support/DebugCounter.h"
31 #include "llvm/Transforms/Scalar.h"
32 
33 #include <string>
34 
35 using namespace llvm;
36 using namespace PatternMatch;
37 
38 #define DEBUG_TYPE "constraint-elimination"
39 
40 STATISTIC(NumCondsRemoved, "Number of instructions removed");
41 DEBUG_COUNTER(EliminatedCounter, "conds-eliminated",
42               "Controls which conditions are eliminated");
43 
44 static int64_t MaxConstraintValue = std::numeric_limits<int64_t>::max();
45 
46 namespace {
47 struct ConstraintTy {
48   SmallVector<int64_t, 8> Coefficients;
49 
50   ConstraintTy(SmallVector<int64_t, 8> Coefficients)
51       : Coefficients(Coefficients) {}
52 
53   unsigned size() const { return Coefficients.size(); }
54 };
55 
56 /// Struct to manage a list of constraints.
57 struct ConstraintListTy {
58   SmallVector<ConstraintTy, 4> Constraints;
59 
60   ConstraintListTy() {}
61 
62   ConstraintListTy(const SmallVector<ConstraintTy, 4> &Constraints)
63       : Constraints(Constraints) {}
64 
65   void mergeIn(const ConstraintListTy &Other) {
66     append_range(Constraints, Other.Constraints);
67   }
68 
69   unsigned size() const { return Constraints.size(); }
70 
71   unsigned empty() const { return Constraints.empty(); }
72 
73   /// Returns true if any constraint has a non-zero coefficient for any of the
74   /// newly added indices. Zero coefficients for new indices are removed. If it
75   /// returns true, no new variable need to be added to the system.
76   bool needsNewIndices(const DenseMap<Value *, unsigned> &NewIndices) {
77     assert(size() == 1);
78     for (unsigned I = 0; I < NewIndices.size(); ++I) {
79       int64_t Last = get(0).Coefficients.pop_back_val();
80       if (Last != 0)
81         return true;
82     }
83     return false;
84   }
85 
86   ConstraintTy &get(unsigned I) { return Constraints[I]; }
87 };
88 
89 } // namespace
90 
91 // Decomposes \p V into a vector of pairs of the form { c, X } where c * X. The
92 // sum of the pairs equals \p V.  The first pair is the constant-factor and X
93 // must be nullptr. If the expression cannot be decomposed, returns an empty
94 // vector.
95 static SmallVector<std::pair<int64_t, Value *>, 4> decompose(Value *V) {
96   if (auto *CI = dyn_cast<ConstantInt>(V)) {
97     if (CI->isNegative() || CI->uge(MaxConstraintValue))
98       return {};
99     return {{CI->getSExtValue(), nullptr}};
100   }
101   auto *GEP = dyn_cast<GetElementPtrInst>(V);
102   if (GEP && GEP->getNumOperands() == 2 && GEP->isInBounds()) {
103     Value *Op0, *Op1;
104     ConstantInt *CI;
105 
106     // If the index is zero-extended, it is guaranteed to be positive.
107     if (match(GEP->getOperand(GEP->getNumOperands() - 1),
108               m_ZExt(m_Value(Op0)))) {
109       if (match(Op0, m_NUWShl(m_Value(Op1), m_ConstantInt(CI))))
110         return {{0, nullptr},
111                 {1, GEP->getPointerOperand()},
112                 {std::pow(int64_t(2), CI->getSExtValue()), Op1}};
113       if (match(Op0, m_NSWAdd(m_Value(Op1), m_ConstantInt(CI))))
114         return {{CI->getSExtValue(), nullptr},
115                 {1, GEP->getPointerOperand()},
116                 {1, Op1}};
117       return {{0, nullptr}, {1, GEP->getPointerOperand()}, {1, Op0}};
118     }
119 
120     if (match(GEP->getOperand(GEP->getNumOperands() - 1), m_ConstantInt(CI)) &&
121         !CI->isNegative())
122       return {{CI->getSExtValue(), nullptr}, {1, GEP->getPointerOperand()}};
123 
124     SmallVector<std::pair<int64_t, Value *>, 4> Result;
125     if (match(GEP->getOperand(GEP->getNumOperands() - 1),
126               m_NUWShl(m_Value(Op0), m_ConstantInt(CI))))
127       Result = {{0, nullptr},
128                 {1, GEP->getPointerOperand()},
129                 {std::pow(int64_t(2), CI->getSExtValue()), Op0}};
130     else if (match(GEP->getOperand(GEP->getNumOperands() - 1),
131                    m_NSWAdd(m_Value(Op0), m_ConstantInt(CI))))
132       Result = {{CI->getSExtValue(), nullptr},
133                 {1, GEP->getPointerOperand()},
134                 {1, Op0}};
135     else {
136       Op0 = GEP->getOperand(GEP->getNumOperands() - 1);
137       Result = {{0, nullptr}, {1, GEP->getPointerOperand()}, {1, Op0}};
138     }
139     return Result;
140   }
141 
142   Value *Op0;
143   if (match(V, m_ZExt(m_Value(Op0))))
144     V = Op0;
145 
146   Value *Op1;
147   ConstantInt *CI;
148   if (match(V, m_NUWAdd(m_Value(Op0), m_ConstantInt(CI))))
149     return {{CI->getSExtValue(), nullptr}, {1, Op0}};
150   if (match(V, m_NUWAdd(m_Value(Op0), m_Value(Op1))))
151     return {{0, nullptr}, {1, Op0}, {1, Op1}};
152 
153   if (match(V, m_NUWSub(m_Value(Op0), m_ConstantInt(CI))))
154     return {{-1 * CI->getSExtValue(), nullptr}, {1, Op0}};
155   if (match(V, m_NUWSub(m_Value(Op0), m_Value(Op1))))
156     return {{0, nullptr}, {1, Op0}, {-1, Op1}};
157 
158   return {{0, nullptr}, {1, V}};
159 }
160 
161 /// Turn a condition \p CmpI into a vector of constraints, using indices from \p
162 /// Value2Index. Additional indices for newly discovered values are added to \p
163 /// NewIndices.
164 static ConstraintListTy
165 getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
166               const DenseMap<Value *, unsigned> &Value2Index,
167               DenseMap<Value *, unsigned> &NewIndices) {
168   int64_t Offset1 = 0;
169   int64_t Offset2 = 0;
170 
171   // First try to look up \p V in Value2Index and NewIndices. Otherwise add a
172   // new entry to NewIndices.
173   auto GetOrAddIndex = [&Value2Index, &NewIndices](Value *V) -> unsigned {
174     auto V2I = Value2Index.find(V);
175     if (V2I != Value2Index.end())
176       return V2I->second;
177     auto NewI = NewIndices.find(V);
178     if (NewI != NewIndices.end())
179       return NewI->second;
180     auto Insert =
181         NewIndices.insert({V, Value2Index.size() + NewIndices.size() + 1});
182     return Insert.first->second;
183   };
184 
185   if (Pred == CmpInst::ICMP_UGT || Pred == CmpInst::ICMP_UGE)
186     return getConstraint(CmpInst::getSwappedPredicate(Pred), Op1, Op0,
187                          Value2Index, NewIndices);
188 
189   if (Pred == CmpInst::ICMP_EQ) {
190     if (match(Op1, m_Zero()))
191       return getConstraint(CmpInst::ICMP_ULE, Op0, Op1, Value2Index,
192                            NewIndices);
193 
194     auto A =
195         getConstraint(CmpInst::ICMP_UGE, Op0, Op1, Value2Index, NewIndices);
196     auto B =
197         getConstraint(CmpInst::ICMP_ULE, Op0, Op1, Value2Index, NewIndices);
198     A.mergeIn(B);
199     return A;
200   }
201 
202   if (Pred == CmpInst::ICMP_NE && match(Op1, m_Zero())) {
203     return getConstraint(CmpInst::ICMP_UGT, Op0, Op1, Value2Index, NewIndices);
204   }
205 
206   // Only ULE and ULT predicates are supported at the moment.
207   if (Pred != CmpInst::ICMP_ULE && Pred != CmpInst::ICMP_ULT)
208     return {};
209 
210   auto ADec = decompose(Op0->stripPointerCastsSameRepresentation());
211   auto BDec = decompose(Op1->stripPointerCastsSameRepresentation());
212   // Skip if decomposing either of the values failed.
213   if (ADec.empty() || BDec.empty())
214     return {};
215 
216   // Skip trivial constraints without any variables.
217   if (ADec.size() == 1 && BDec.size() == 1)
218     return {};
219 
220   Offset1 = ADec[0].first;
221   Offset2 = BDec[0].first;
222   Offset1 *= -1;
223 
224   // Create iterator ranges that skip the constant-factor.
225   auto VariablesA = llvm::drop_begin(ADec);
226   auto VariablesB = llvm::drop_begin(BDec);
227 
228   // Make sure all variables have entries in Value2Index or NewIndices.
229   for (const auto &KV :
230        concat<std::pair<int64_t, Value *>>(VariablesA, VariablesB))
231     GetOrAddIndex(KV.second);
232 
233   // Build result constraint, by first adding all coefficients from A and then
234   // subtracting all coefficients from B.
235   SmallVector<int64_t, 8> R(Value2Index.size() + NewIndices.size() + 1, 0);
236   for (const auto &KV : VariablesA)
237     R[GetOrAddIndex(KV.second)] += KV.first;
238 
239   for (const auto &KV : VariablesB)
240     R[GetOrAddIndex(KV.second)] -= KV.first;
241 
242   R[0] = Offset1 + Offset2 + (Pred == CmpInst::ICMP_ULT ? -1 : 0);
243   return {{R}};
244 }
245 
246 static ConstraintListTy
247 getConstraint(CmpInst *Cmp, const DenseMap<Value *, unsigned> &Value2Index,
248               DenseMap<Value *, unsigned> &NewIndices) {
249   return getConstraint(Cmp->getPredicate(), Cmp->getOperand(0),
250                        Cmp->getOperand(1), Value2Index, NewIndices);
251 }
252 
253 namespace {
254 /// Represents either a condition that holds on entry to a block or a basic
255 /// block, with their respective Dominator DFS in and out numbers.
256 struct ConstraintOrBlock {
257   unsigned NumIn;
258   unsigned NumOut;
259   bool IsBlock;
260   bool Not;
261   union {
262     BasicBlock *BB;
263     CmpInst *Condition;
264   };
265 
266   ConstraintOrBlock(DomTreeNode *DTN)
267       : NumIn(DTN->getDFSNumIn()), NumOut(DTN->getDFSNumOut()), IsBlock(true),
268         BB(DTN->getBlock()) {}
269   ConstraintOrBlock(DomTreeNode *DTN, CmpInst *Condition, bool Not)
270       : NumIn(DTN->getDFSNumIn()), NumOut(DTN->getDFSNumOut()), IsBlock(false),
271         Not(Not), Condition(Condition) {}
272 };
273 
274 struct StackEntry {
275   unsigned NumIn;
276   unsigned NumOut;
277   CmpInst *Condition;
278   bool IsNot;
279 
280   StackEntry(unsigned NumIn, unsigned NumOut, CmpInst *Condition, bool IsNot)
281       : NumIn(NumIn), NumOut(NumOut), Condition(Condition), IsNot(IsNot) {}
282 };
283 } // namespace
284 
285 #ifndef NDEBUG
286 static void dumpWithNames(ConstraintTy &C,
287                           DenseMap<Value *, unsigned> &Value2Index) {
288   SmallVector<std::string> Names(Value2Index.size(), "");
289   for (auto &KV : Value2Index) {
290     Names[KV.second - 1] = std::string("%") + KV.first->getName().str();
291   }
292   ConstraintSystem CS;
293   CS.addVariableRowFill(C.Coefficients);
294   CS.dump(Names);
295 }
296 #endif
297 
298 static bool eliminateConstraints(Function &F, DominatorTree &DT) {
299   bool Changed = false;
300   DT.updateDFSNumbers();
301   ConstraintSystem CS;
302 
303   SmallVector<ConstraintOrBlock, 64> WorkList;
304 
305   // First, collect conditions implied by branches and blocks with their
306   // Dominator DFS in and out numbers.
307   for (BasicBlock &BB : F) {
308     if (!DT.getNode(&BB))
309       continue;
310     WorkList.emplace_back(DT.getNode(&BB));
311 
312     // True as long as long as the current instruction is guaranteed to execute.
313     bool GuaranteedToExecute = true;
314     // Scan BB for assume calls.
315     // TODO: also use this scan to queue conditions to simplify, so we can
316     // interleave facts from assumes and conditions to simplify in a single
317     // basic block. And to skip another traversal of each basic block when
318     // simplifying.
319     for (Instruction &I : BB) {
320       Value *Cond;
321       // For now, just handle assumes with a single compare as condition.
322       if (match(&I, m_Intrinsic<Intrinsic::assume>(m_Value(Cond))) &&
323           isa<CmpInst>(Cond)) {
324         if (GuaranteedToExecute) {
325           // The assume is guaranteed to execute when BB is entered, hence Cond
326           // holds on entry to BB.
327           WorkList.emplace_back(DT.getNode(&BB), cast<CmpInst>(Cond), false);
328         } else {
329           // Otherwise the condition only holds in the successors.
330           for (BasicBlock *Succ : successors(&BB))
331             WorkList.emplace_back(DT.getNode(Succ), cast<CmpInst>(Cond), false);
332         }
333       }
334       GuaranteedToExecute &= isGuaranteedToTransferExecutionToSuccessor(&I);
335     }
336 
337     auto *Br = dyn_cast<BranchInst>(BB.getTerminator());
338     if (!Br || !Br->isConditional())
339       continue;
340 
341     // Returns true if we can add a known condition from BB to its successor
342     // block Succ. Each predecessor of Succ can either be BB or be dominated by
343     // Succ (e.g. the case when adding a condition from a pre-header to a loop
344     // header).
345     auto CanAdd = [&BB, &DT](BasicBlock *Succ) {
346       return all_of(predecessors(Succ), [&BB, &DT, Succ](BasicBlock *Pred) {
347         return Pred == &BB || DT.dominates(Succ, Pred);
348       });
349     };
350     // If the condition is an OR of 2 compares and the false successor only has
351     // the current block as predecessor, queue both negated conditions for the
352     // false successor.
353     Value *Op0, *Op1;
354     if (match(Br->getCondition(), m_LogicalOr(m_Value(Op0), m_Value(Op1))) &&
355         match(Op0, m_Cmp()) && match(Op1, m_Cmp())) {
356       BasicBlock *FalseSuccessor = Br->getSuccessor(1);
357       if (CanAdd(FalseSuccessor)) {
358         WorkList.emplace_back(DT.getNode(FalseSuccessor), cast<CmpInst>(Op0),
359                               true);
360         WorkList.emplace_back(DT.getNode(FalseSuccessor), cast<CmpInst>(Op1),
361                               true);
362       }
363       continue;
364     }
365 
366     // If the condition is an AND of 2 compares and the true successor only has
367     // the current block as predecessor, queue both conditions for the true
368     // successor.
369     if (match(Br->getCondition(), m_LogicalAnd(m_Value(Op0), m_Value(Op1))) &&
370         match(Op0, m_Cmp()) && match(Op1, m_Cmp())) {
371       BasicBlock *TrueSuccessor = Br->getSuccessor(0);
372       if (CanAdd(TrueSuccessor)) {
373         WorkList.emplace_back(DT.getNode(TrueSuccessor), cast<CmpInst>(Op0),
374                               false);
375         WorkList.emplace_back(DT.getNode(TrueSuccessor), cast<CmpInst>(Op1),
376                               false);
377       }
378       continue;
379     }
380 
381     auto *CmpI = dyn_cast<CmpInst>(Br->getCondition());
382     if (!CmpI)
383       continue;
384     if (CanAdd(Br->getSuccessor(0)))
385       WorkList.emplace_back(DT.getNode(Br->getSuccessor(0)), CmpI, false);
386     if (CanAdd(Br->getSuccessor(1)))
387       WorkList.emplace_back(DT.getNode(Br->getSuccessor(1)), CmpI, true);
388   }
389 
390   // Next, sort worklist by dominance, so that dominating blocks and conditions
391   // come before blocks and conditions dominated by them. If a block and a
392   // condition have the same numbers, the condition comes before the block, as
393   // it holds on entry to the block.
394   sort(WorkList, [](const ConstraintOrBlock &A, const ConstraintOrBlock &B) {
395     return std::tie(A.NumIn, A.IsBlock) < std::tie(B.NumIn, B.IsBlock);
396   });
397 
398   // Finally, process ordered worklist and eliminate implied conditions.
399   SmallVector<StackEntry, 16> DFSInStack;
400   DenseMap<Value *, unsigned> Value2Index;
401   for (ConstraintOrBlock &CB : WorkList) {
402     // First, pop entries from the stack that are out-of-scope for CB. Remove
403     // the corresponding entry from the constraint system.
404     while (!DFSInStack.empty()) {
405       auto &E = DFSInStack.back();
406       LLVM_DEBUG(dbgs() << "Top of stack : " << E.NumIn << " " << E.NumOut
407                         << "\n");
408       LLVM_DEBUG(dbgs() << "CB: " << CB.NumIn << " " << CB.NumOut << "\n");
409       assert(E.NumIn <= CB.NumIn);
410       if (CB.NumOut <= E.NumOut)
411         break;
412       LLVM_DEBUG(dbgs() << "Removing " << *E.Condition << " " << E.IsNot
413                         << "\n");
414       DFSInStack.pop_back();
415       CS.popLastConstraint();
416     }
417 
418     LLVM_DEBUG({
419       dbgs() << "Processing ";
420       if (CB.IsBlock)
421         dbgs() << *CB.BB;
422       else
423         dbgs() << *CB.Condition;
424       dbgs() << "\n";
425     });
426 
427     // For a block, check if any CmpInsts become known based on the current set
428     // of constraints.
429     if (CB.IsBlock) {
430       for (Instruction &I : *CB.BB) {
431         auto *Cmp = dyn_cast<CmpInst>(&I);
432         if (!Cmp)
433           continue;
434 
435         DenseMap<Value *, unsigned> NewIndices;
436         auto R = getConstraint(Cmp, Value2Index, NewIndices);
437         if (R.size() != 1)
438           continue;
439 
440         if (R.needsNewIndices(NewIndices))
441           continue;
442 
443         if (CS.isConditionImplied(R.get(0).Coefficients)) {
444           if (!DebugCounter::shouldExecute(EliminatedCounter))
445             continue;
446 
447           LLVM_DEBUG(dbgs() << "Condition " << *Cmp
448                             << " implied by dominating constraints\n");
449           LLVM_DEBUG({
450             for (auto &E : reverse(DFSInStack))
451               dbgs() << "   C " << *E.Condition << " " << E.IsNot << "\n";
452           });
453           Cmp->replaceUsesWithIf(
454               ConstantInt::getTrue(F.getParent()->getContext()), [](Use &U) {
455                 // Conditions in an assume trivially simplify to true. Skip uses
456                 // in assume calls to not destroy the available information.
457                 auto *II = dyn_cast<IntrinsicInst>(U.getUser());
458                 return !II || II->getIntrinsicID() != Intrinsic::assume;
459               });
460           NumCondsRemoved++;
461           Changed = true;
462         }
463         if (CS.isConditionImplied(
464                 ConstraintSystem::negate(R.get(0).Coefficients))) {
465           if (!DebugCounter::shouldExecute(EliminatedCounter))
466             continue;
467 
468           LLVM_DEBUG(dbgs() << "Condition !" << *Cmp
469                             << " implied by dominating constraints\n");
470           LLVM_DEBUG({
471             for (auto &E : reverse(DFSInStack))
472               dbgs() << "   C " << *E.Condition << " " << E.IsNot << "\n";
473           });
474           Cmp->replaceAllUsesWith(
475               ConstantInt::getFalse(F.getParent()->getContext()));
476           NumCondsRemoved++;
477           Changed = true;
478         }
479       }
480       continue;
481     }
482 
483     // Set up a function to restore the predicate at the end of the scope if it
484     // has been negated. Negate the predicate in-place, if required.
485     auto *CI = dyn_cast<CmpInst>(CB.Condition);
486     auto PredicateRestorer = make_scope_exit([CI, &CB]() {
487       if (CB.Not && CI)
488         CI->setPredicate(CI->getInversePredicate());
489     });
490     if (CB.Not) {
491       if (CI) {
492         CI->setPredicate(CI->getInversePredicate());
493       } else {
494         LLVM_DEBUG(dbgs() << "Can only negate compares so far.\n");
495         continue;
496       }
497     }
498 
499     // Otherwise, add the condition to the system and stack, if we can transform
500     // it into a constraint.
501     DenseMap<Value *, unsigned> NewIndices;
502     auto R = getConstraint(CB.Condition, Value2Index, NewIndices);
503     if (R.empty())
504       continue;
505 
506     for (auto &KV : NewIndices)
507       Value2Index.insert(KV);
508 
509     LLVM_DEBUG(dbgs() << "Adding " << *CB.Condition << " " << CB.Not << "\n");
510     bool Added = false;
511     for (auto &C : R.Constraints) {
512       auto Coeffs = C.Coefficients;
513       LLVM_DEBUG({
514         dbgs() << "  constraint: ";
515         dumpWithNames(C, Value2Index);
516       });
517       Added |= CS.addVariableRowFill(Coeffs);
518       // If R has been added to the system, queue it for removal once it goes
519       // out-of-scope.
520       if (Added)
521         DFSInStack.emplace_back(CB.NumIn, CB.NumOut, CB.Condition, CB.Not);
522     }
523   }
524 
525   assert(CS.size() == DFSInStack.size() &&
526          "updates to CS and DFSInStack are out of sync");
527   return Changed;
528 }
529 
530 PreservedAnalyses ConstraintEliminationPass::run(Function &F,
531                                                  FunctionAnalysisManager &AM) {
532   auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
533   if (!eliminateConstraints(F, DT))
534     return PreservedAnalyses::all();
535 
536   PreservedAnalyses PA;
537   PA.preserve<DominatorTreeAnalysis>();
538   PA.preserveSet<CFGAnalyses>();
539   return PA;
540 }
541 
542 namespace {
543 
544 class ConstraintElimination : public FunctionPass {
545 public:
546   static char ID;
547 
548   ConstraintElimination() : FunctionPass(ID) {
549     initializeConstraintEliminationPass(*PassRegistry::getPassRegistry());
550   }
551 
552   bool runOnFunction(Function &F) override {
553     auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
554     return eliminateConstraints(F, DT);
555   }
556 
557   void getAnalysisUsage(AnalysisUsage &AU) const override {
558     AU.setPreservesCFG();
559     AU.addRequired<DominatorTreeWrapperPass>();
560     AU.addPreserved<GlobalsAAWrapperPass>();
561     AU.addPreserved<DominatorTreeWrapperPass>();
562   }
563 };
564 
565 } // end anonymous namespace
566 
567 char ConstraintElimination::ID = 0;
568 
569 INITIALIZE_PASS_BEGIN(ConstraintElimination, "constraint-elimination",
570                       "Constraint Elimination", false, false)
571 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
572 INITIALIZE_PASS_DEPENDENCY(LazyValueInfoWrapperPass)
573 INITIALIZE_PASS_END(ConstraintElimination, "constraint-elimination",
574                     "Constraint Elimination", false, false)
575 
576 FunctionPass *llvm::createConstraintEliminationPass() {
577   return new ConstraintElimination();
578 }
579