<div dir="ltr">As discussed on IRC, this makes some compiles slow/endless, e.g. of this project:<div><a href="https://github.com/gdslang/gdsl-toolkit">https://github.com/gdslang/gdsl-toolkit</a><br></div><div><br></div><div>I attached the preprocessed file that's problematic and I can reproduce the issue with:</div><div>$ clang -O2 -xc gdsl-x86-rreil.ii<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 15, 2016 at 5:32 AM, Hal Finkel via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">FYI: The iterator-invalidation issue is fixed; there is also a problem being triggered during self-hosting with bundle operands and AA. Working on that now...<br>
<span class="im HOEnZb"><br>
-Hal<br>
<br>
----- Original Message -----<br>
</span><div class="HOEnZb"><div class="h5">> From: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Cc: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> Sent: Wednesday, December 14, 2016 9:22:50 PM<br>
> Subject: Re: [llvm] r289755 - Make processing @llvm.assume more efficient by using operand bundles<br>
><br>
> This is causing some bots to fail, for example:<br>
><br>
> opt:<br>
> /home/buildbot/Buildbot/Slave/<wbr>llvm-clang-lld-x86_64-scei-<wbr>ps4-ubuntu-fast/llvm.src/<wbr>include/llvm/ADT/DenseMap.h:<wbr>1074:<br>
> pointer llvm::DenseMapIterator<const llvm::SCEV *,<br>
> llvm::SetVector<llvm::Value *, std::vector<llvm::Value *,<br>
> std::allocator<llvm::Value *> >, llvm::DenseSet<llvm::Value *,<br>
> llvm::DenseMapInfo<llvm::Value *> > >, llvm::DenseMapInfo<const<br>
> llvm::SCEV *>, llvm::detail::DenseMapPair<<wbr>const llvm::SCEV *,<br>
> llvm::SetVector<llvm::Value *, std::vector<llvm::Value *,<br>
> std::allocator<llvm::Value *> >, llvm::DenseSet<llvm::Value *,<br>
> llvm::DenseMapInfo<llvm::Value *> > > >, false>::operator->() const<br>
> [KeyT = const llvm::SCEV *, ValueT = llvm::SetVector<llvm::Value *,<br>
> std::vector<llvm::Value *, std::allocator<llvm::Value *> >,<br>
> llvm::DenseSet<llvm::Value *, llvm::DenseMapInfo<llvm::Value *> > >,<br>
> KeyInfoT = llvm::DenseMapInfo<const llvm::SCEV *>, Bucket =<br>
> llvm::detail::DenseMapPair<<wbr>const llvm::SCEV *,<br>
> llvm::SetVector<llvm::Value *, std::vector<llvm::Value *,<br>
> std::allocator<llvm::Value *> >, llvm::DenseSet<llvm::Value *,<br>
> llvm::DenseMapInfo<llvm::Value *> > > >, IsConst = false]: Assertion<br>
> `isHandleInSync() && "invalid iterator access!"' failed.<br>
><br>
> I'm looking at it now...<br>
><br>
> -Hal<br>
><br>
> ----- Original Message -----<br>
> > From: "Hal Finkel via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
> > To: <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> > Sent: Wednesday, December 14, 2016 8:53:43 PM<br>
> > Subject: [llvm] r289755 - Make processing @llvm.assume more<br>
> > efficient by using operand bundles<br>
> ><br>
> > Author: hfinkel<br>
> > Date: Wed Dec 14 20:53:42 2016<br>
> > New Revision: 289755<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289755&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=289755&view=rev</a><br>
> > Log:<br>
> > Make processing @llvm.assume more efficient by using operand<br>
> > bundles<br>
> ><br>
> > There was an efficiency problem with how we processed @llvm.assume<br>
> > in<br>
> > ValueTracking (and other places). The AssumptionCache tracked all<br>
> > of<br>
> > the<br>
> > assumptions in a given function. In order to find assumptions<br>
> > relevant to<br>
> > computing known bits, etc. we searched every assumption in the<br>
> > function. For<br>
> > ValueTracking, that means that we did O(#assumes * #values) work in<br>
> > InstCombine<br>
> > and other passes (with a constant factor that can be quite large<br>
> > because we'd<br>
> > repeat this search at every level of recursion of the analysis).<br>
> ><br>
> > Several of us discussed this situation at the last developers'<br>
> > meeting, and<br>
> > this implements the discussed solution: Make the values that an<br>
> > assume might<br>
> > affect operands of the assume itself. To avoid exposing this detail<br>
> > to<br>
> > frontends and passes that need not worry about it, I've used the<br>
> > new<br>
> > operand-bundle feature to add these extra call "operands" in a way<br>
> > that does<br>
> > not affect the intrinsic's signature. I think this solution is<br>
> > relatively<br>
> > clean. InstCombine adds these extra operands based on what<br>
> > ValueTracking, LVI,<br>
> > etc. will need and then those passes need only search the users of<br>
> > the values<br>
> > under consideration. This should fix the computational-complexity<br>
> > problem.<br>
> ><br>
> > At this point, no passes depend on the AssumptionCache, and so I'll<br>
> > remove<br>
> > that as a follow-up change.<br>
> ><br>
> > Differential Revision: <a href="https://reviews.llvm.org/D27259" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D27259</a><br>
> ><br>
> > Modified:<br>
> > llvm/trunk/docs/LangRef.rst<br>
> > llvm/trunk/include/llvm/<wbr>Analysis/ScalarEvolution.h<br>
> > llvm/trunk/lib/Analysis/<wbr>CodeMetrics.cpp<br>
> > llvm/trunk/lib/Analysis/<wbr>LazyValueInfo.cpp<br>
> > llvm/trunk/lib/Analysis/<wbr>ScalarEvolution.cpp<br>
> > llvm/trunk/lib/Analysis/<wbr>ValueTracking.cpp<br>
> > llvm/trunk/lib/Transforms/<wbr>InstCombine/InstCombineCalls.<wbr>cpp<br>
> > llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>AlignmentFromAssumptions.cpp<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/no-wrap-<wbr>unknown-becount.ll<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/nsw-offset-<wbr>assume.ll<br>
> > llvm/trunk/test/Transforms/<wbr>CorrelatedValuePropagation/<wbr>conflict.ll<br>
> > llvm/trunk/test/Transforms/<wbr>InstCombine/assume-redundant.<wbr>ll<br>
> > llvm/trunk/test/Transforms/<wbr>InstCombine/assume.ll<br>
> > llvm/trunk/test/Transforms/<wbr>InstCombine/assume2.ll<br>
> > llvm/trunk/test/Transforms/<wbr>InstSimplify/add-mask.ll<br>
> > llvm/trunk/test/Transforms/<wbr>JumpThreading/assume-edge-dom.<wbr>ll<br>
> > llvm/trunk/test/Transforms/<wbr>JumpThreading/assume.ll<br>
> > llvm/trunk/test/Transforms/<wbr>NaryReassociate/NVPTX/nary-<wbr>gep.ll<br>
> > llvm/trunk/test/Transforms/<wbr>SimplifyCFG/switch-dead-<wbr>default.ll<br>
> ><br>
> > Modified: llvm/trunk/docs/LangRef.rst<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/docs/<wbr>LangRef.rst?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/docs/LangRef.rst (original)<br>
> > +++ llvm/trunk/docs/LangRef.rst Wed Dec 14 20:53:42 2016<br>
> > @@ -1753,6 +1753,15 @@ site, these bundles may contain any valu<br>
> > generated code. For more details, see :ref:`GC Transitions<br>
> > <gc_transition_args>`.<br>
> ><br>
> > +Affected Operand Bundles<br>
> > +^^^^^^^^^^^^^^^^^^^^^^^^<br>
> > +<br>
> > +Affected operand bundles are characterized by the ``"affected"``<br>
> > operand bundle<br>
> > +tag. These operand bundles indicate that a call, specifically a<br>
> > call<br>
> > to an<br>
> > +intrinsic like ``llvm.assume``, implies some additional knowledge<br>
> > about the<br>
> > +values within the bundle. This enables the optimizer to<br>
> > efficiently<br>
> > find these<br>
> > +relationships. The optimizer will add these automatically.<br>
> > +<br>
> > .. _moduleasm:<br>
> ><br>
> > Module-Level Inline Assembly<br>
> ><br>
> > Modified: llvm/trunk/include/llvm/<wbr>Analysis/ScalarEvolution.h<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/Analysis/ScalarEvolution.<wbr>h?rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/include/llvm/<wbr>Analysis/ScalarEvolution.h (original)<br>
> > +++ llvm/trunk/include/llvm/<wbr>Analysis/ScalarEvolution.h Wed Dec 14<br>
> > 20:53:42 2016<br>
> > @@ -532,6 +532,10 @@ private:<br>
> > ///<br>
> > ValueExprMapType ValueExprMap;<br>
> ><br>
> > + /// This is a map of SCEVs to intrinsics (e.g. assumptions) that<br>
> > might affect<br>
> > + /// (i.e. imply something about) them.<br>
> > + DenseMap<const SCEV *, SetVector<Value *>> AffectedMap;<br>
> > +<br>
> > /// Mark predicate values currently being processed by<br>
> > isImpliedCond.<br>
> > SmallPtrSet<Value *, 6> PendingLoopPredicates;<br>
> ><br>
> > @@ -800,6 +804,9 @@ private:<br>
> > ConstantRange getRangeViaFactoring(const SCEV *Start, const SCEV<br>
> > *Stop,<br>
> > const SCEV *MaxBECount,<br>
> > unsigned BitWidth);<br>
> ><br>
> > + /// Add to the AffectedMap this SCEV if its operands are in the<br>
> > AffectedMap.<br>
> > + void addAffectedFromOperands(const SCEV *S);<br>
> > +<br>
> > /// We know that there is no SCEV for the specified value.<br>
> > Analyze the<br>
> > /// expression.<br>
> > const SCEV *createSCEV(Value *V);<br>
> ><br>
> > Modified: llvm/trunk/lib/Analysis/<wbr>CodeMetrics.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CodeMetrics.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/CodeMetrics.cpp?rev=<wbr>289755&r1=289754&r2=289755&<wbr>view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Analysis/<wbr>CodeMetrics.cpp (original)<br>
> > +++ llvm/trunk/lib/Analysis/<wbr>CodeMetrics.cpp Wed Dec 14 20:53:42<br>
> > 2016<br>
> > @@ -76,20 +76,12 @@ void CodeMetrics::<wbr>collectEphemeralValues<br>
> > SmallPtrSet<const Value *, 32> Visited;<br>
> > SmallVector<const Value *, 16> Worklist;<br>
> ><br>
> > - for (auto &AssumeVH : AC->assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > - continue;<br>
> > - Instruction *I = cast<Instruction>(AssumeVH);<br>
> > -<br>
> > - // Filter out call sites outside of the loop so we don't do a<br>
> > function's<br>
> > - // worth of work for each of its loops (and, in the common<br>
> > case,<br>
> > ephemeral<br>
> > - // values in the loop are likely due to @llvm.assume calls in<br>
> > the loop).<br>
> > - if (!L->contains(I->getParent()))<br>
> > - continue;<br>
> > -<br>
> > - if (EphValues.insert(I).second)<br>
> > - appendSpeculatableOperands(I, Visited, Worklist);<br>
> > - }<br>
> > + for (auto &B : L->blocks())<br>
> > + for (auto &I : *B)<br>
> > + if (auto *II = dyn_cast<IntrinsicInst>(&I))<br>
> > + if (II->getIntrinsicID() == Intrinsic::assume &&<br>
> > + EphValues.insert(II).second)<br>
> > + appendSpeculatableOperands(II, Visited, Worklist);<br>
> ><br>
> > completeEphemeralValues(<wbr>Visited, Worklist, EphValues);<br>
> > }<br>
> > @@ -100,16 +92,12 @@ void CodeMetrics::<wbr>collectEphemeralValues<br>
> > SmallPtrSet<const Value *, 32> Visited;<br>
> > SmallVector<const Value *, 16> Worklist;<br>
> ><br>
> > - for (auto &AssumeVH : AC->assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > - continue;<br>
> > - Instruction *I = cast<Instruction>(AssumeVH);<br>
> > - assert(I->getParent()-><wbr>getParent() == F &&<br>
> > - "Found assumption for the wrong function!");<br>
> > -<br>
> > - if (EphValues.insert(I).second)<br>
> > - appendSpeculatableOperands(I, Visited, Worklist);<br>
> > - }<br>
> > + for (auto &B : *F)<br>
> > + for (auto &I : B)<br>
> > + if (auto *II = dyn_cast<IntrinsicInst>(&I))<br>
> > + if (II->getIntrinsicID() == Intrinsic::assume &&<br>
> > + EphValues.insert(II).second)<br>
> > + appendSpeculatableOperands(II, Visited, Worklist);<br>
> ><br>
> > completeEphemeralValues(<wbr>Visited, Worklist, EphValues);<br>
> > }<br>
> ><br>
> > Modified: llvm/trunk/lib/Analysis/<wbr>LazyValueInfo.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/LazyValueInfo.cpp?<wbr>rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Analysis/<wbr>LazyValueInfo.cpp (original)<br>
> > +++ llvm/trunk/lib/Analysis/<wbr>LazyValueInfo.cpp Wed Dec 14 20:53:42<br>
> > 2016<br>
> > @@ -924,14 +924,16 @@ void LazyValueInfoImpl::<wbr>intersectAssumeO<br>
> > if (!BBI)<br>
> > return;<br>
> ><br>
> > - for (auto &AssumeVH : AC->assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > + for (auto *U : Val->users()) {<br>
> > + auto *II = dyn_cast<IntrinsicInst>(U);<br>
> > + if (!II)<br>
> > continue;<br>
> > - auto *I = cast<CallInst>(AssumeVH);<br>
> > - if (!isValidAssumeForContext(I, BBI, DT))<br>
> > + if (II->getIntrinsicID() != Intrinsic::assume)<br>
> > + continue;<br>
> > + if (!isValidAssumeForContext(II, BBI, DT))<br>
> > continue;<br>
> ><br>
> > - BBLV = intersect(BBLV, getValueFromCondition(Val,<br>
> > I->getArgOperand(0)));<br>
> > + BBLV = intersect(BBLV, getValueFromCondition(Val,<br>
> > II->getArgOperand(0)));<br>
> > }<br>
> ><br>
> > // If guards are not used in the module, don't spend time<br>
> > looking<br>
> > for them<br>
> ><br>
> > Modified: llvm/trunk/lib/Analysis/<wbr>ScalarEvolution.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/ScalarEvolution.cpp?<wbr>rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Analysis/<wbr>ScalarEvolution.cpp (original)<br>
> > +++ llvm/trunk/lib/Analysis/<wbr>ScalarEvolution.cpp Wed Dec 14 20:53:42<br>
> > 2016<br>
> > @@ -1212,6 +1212,7 @@ const SCEV *ScalarEvolution::getTruncate<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVTruncateExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > Op, Ty);<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -1598,7 +1599,7 @@ const SCEV *ScalarEvolution::getZeroExte<br>
> > // these to prove lack of overflow. Use this fact to avoid<br>
> > // doing extra work that may not pay off.<br>
> > if (!isa<SCEVCouldNotCompute>(<wbr>MaxBECount) || HasGuards ||<br>
> > - !AC.assumptions().empty()) {<br>
> > + !AffectedMap.empty()) {<br>
> > // If the backedge is guarded by a comparison with the<br>
> > pre-inc<br>
> > // value the addrec is safe. Also, if the entry is guarded<br>
> > by<br>
> > // a comparison with the start value and the backedge is<br>
> > @@ -1664,6 +1665,7 @@ const SCEV *ScalarEvolution::getZeroExte<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVZeroExtendExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > Op, Ty);<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -1833,7 +1835,7 @@ const SCEV *ScalarEvolution::getSignExte<br>
> > // doing extra work that may not pay off.<br>
> ><br>
> > if (!isa<SCEVCouldNotCompute>(<wbr>MaxBECount) || HasGuards ||<br>
> > - !AC.assumptions().empty()) {<br>
> > + !AffectedMap.empty()) {<br>
> > // If the backedge is guarded by a comparison with the<br>
> > pre-inc<br>
> > // value the addrec is safe. Also, if the entry is guarded<br>
> > by<br>
> > // a comparison with the start value and the backedge is<br>
> > @@ -1891,6 +1893,7 @@ const SCEV *ScalarEvolution::getSignExte<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVSignExtendExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > Op, Ty);<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -2444,6 +2447,7 @@ const SCEV *ScalarEvolution::getAddExpr(<br>
> > S = new (SCEVAllocator) SCEVAddExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > O, Ops.size());<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > }<br>
> > S->setNoWrapFlags(Flags);<br>
> > return S;<br>
> > @@ -2736,6 +2740,7 @@ const SCEV *ScalarEvolution::getMulExpr(<br>
> > S = new (SCEVAllocator) SCEVMulExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > O, Ops.size());<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > }<br>
> > S->setNoWrapFlags(Flags);<br>
> > return S;<br>
> > @@ -2856,6 +2861,7 @@ const SCEV *ScalarEvolution::getUDivExpr<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVUDivExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > LHS, RHS);<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -3036,6 +3042,7 @@ ScalarEvolution::<wbr>getAddRecExpr(SmallVect<br>
> > S = new (SCEVAllocator)<br>
> > SCEVAddRecExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > O, Operands.size(), L);<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > }<br>
> > S->setNoWrapFlags(Flags);<br>
> > return S;<br>
> > @@ -3191,6 +3198,7 @@ ScalarEvolution::getSMaxExpr(<wbr>SmallVector<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVSMaxExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > O, Ops.size());<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -3292,6 +3300,7 @@ ScalarEvolution::getUMaxExpr(<wbr>SmallVector<br>
> > SCEV *S = new (SCEVAllocator)<br>
> > SCEVUMaxExpr(ID.Intern(<wbr>SCEVAllocator),<br>
> > O, Ops.size());<br>
> > UniqueSCEVs.InsertNode(S, IP);<br>
> > + addAffectedFromOperands(S);<br>
> > return S;<br>
> > }<br>
> ><br>
> > @@ -3492,9 +3501,38 @@ const SCEV *ScalarEvolution::getSCEV(Val<br>
> > ExprValueMap[Stripped].insert(<wbr>{V, Offset});<br>
> > }<br>
> > }<br>
> > +<br>
> > + // If this value is an instruction or an argument, and might be<br>
> > affected by<br>
> > + // an assumption, and its SCEV to the AffectedMap.<br>
> > + if (isa<Instruction>(V) || isa<Argument>(V)) {<br>
> > + for (auto *U : V->users()) {<br>
> > + auto *II = dyn_cast<IntrinsicInst>(U);<br>
> > + if (!II)<br>
> > + continue;<br>
> > + if (II->getIntrinsicID() != Intrinsic::assume)<br>
> > + continue;<br>
> > +<br>
> > + AffectedMap[S].insert(II);<br>
> > + }<br>
> > + }<br>
> > +<br>
> > return S;<br>
> > }<br>
> ><br>
> > +// If one of this SCEV's operands is in the AffectedMap (meaning<br>
> > that it might<br>
> > +// be affected by an assumption), then this SCEV might be affected<br>
> > by the same<br>
> > +// assumption.<br>
> > +void ScalarEvolution::<wbr>addAffectedFromOperands(const SCEV *S) {<br>
> > + if (auto *NS = dyn_cast<SCEVNAryExpr>(S))<br>
> > + for (auto *Op : NS->operands()) {<br>
> > + auto AMI = AffectedMap.find(Op);<br>
> > + if (AMI == AffectedMap.end())<br>
> > + continue;<br>
> > +<br>
> > + AffectedMap[S].insert(AMI-><wbr>second.begin(),<br>
> > AMI->second.end());<br>
> > + }<br>
> > +}<br>
> > +<br>
> > const SCEV *ScalarEvolution::<wbr>getExistingSCEV(Value *V) {<br>
> > assert(isSCEVable(V->getType()<wbr>) && "Value is not SCEVable!");<br>
> ><br>
> > @@ -7926,16 +7964,23 @@ ScalarEvolution::<wbr>isLoopBackedgeGuardedBy<br>
> > }<br>
> ><br>
> > // Check conditions due to any @llvm.assume intrinsics.<br>
> > - for (auto &AssumeVH : AC.assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > - continue;<br>
> > - auto *CI = cast<CallInst>(AssumeVH);<br>
> > - if (!DT.dominates(CI, Latch->getTerminator()))<br>
> > - continue;<br>
> > + auto CheckAssumptions = [&](const SCEV *S) {<br>
> > + auto AMI = AffectedMap.find(S);<br>
> > + if (AMI != AffectedMap.end())<br>
> > + for (auto *Assume : AMI->second) {<br>
> > + auto *CI = cast<CallInst>(Assume);<br>
> > + if (!DT.dominates(CI, Latch->getTerminator()))<br>
> > + continue;<br>
> ><br>
> > - if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0),<br>
> > false))<br>
> > - return true;<br>
> > - }<br>
> > + if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0),<br>
> > false))<br>
> > + return true;<br>
> > + }<br>
> > +<br>
> > + return false;<br>
> > + };<br>
> > +<br>
> > + if (CheckAssumptions(LHS) || CheckAssumptions(RHS))<br>
> > + return true;<br>
> ><br>
> > // If the loop is not reachable from the entry block, we risk<br>
> > running into an<br>
> > // infinite loop as we walk up into the dom tree. These loops<br>
> > do<br>
> > not matter<br>
> > @@ -8020,16 +8065,23 @@ ScalarEvolution::<wbr>isLoopEntryGuardedByCon<br>
> > }<br>
> ><br>
> > // Check conditions due to any @llvm.assume intrinsics.<br>
> > - for (auto &AssumeVH : AC.assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > - continue;<br>
> > - auto *CI = cast<CallInst>(AssumeVH);<br>
> > - if (!DT.dominates(CI, L->getHeader()))<br>
> > - continue;<br>
> > + auto CheckAssumptions = [&](const SCEV *S) {<br>
> > + auto AMI = AffectedMap.find(S);<br>
> > + if (AMI != AffectedMap.end())<br>
> > + for (auto *Assume : AMI->second) {<br>
> > + auto *CI = cast<CallInst>(Assume);<br>
> > + if (!DT.dominates(CI, L->getHeader()))<br>
> > + continue;<br>
> ><br>
> > - if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0),<br>
> > false))<br>
> > - return true;<br>
> > - }<br>
> > + if (isImpliedCond(Pred, LHS, RHS, CI->getArgOperand(0),<br>
> > false))<br>
> > + return true;<br>
> > + }<br>
> > +<br>
> > + return false;<br>
> > + };<br>
> > +<br>
> > + if (CheckAssumptions(LHS) || CheckAssumptions(RHS))<br>
> > + return true;<br>
> ><br>
> > return false;<br>
> > }<br>
> ><br>
> > Modified: llvm/trunk/lib/Analysis/<wbr>ValueTracking.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/ValueTracking.cpp?<wbr>rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Analysis/<wbr>ValueTracking.cpp (original)<br>
> > +++ llvm/trunk/lib/Analysis/<wbr>ValueTracking.cpp Wed Dec 14 20:53:42<br>
> > 2016<br>
> > @@ -526,31 +526,28 @@ static void computeKnownBitsFromAssume(c<br>
> ><br>
> > unsigned BitWidth = KnownZero.getBitWidth();<br>
> ><br>
> > - for (auto &AssumeVH : Q.AC->assumptions()) {<br>
> > - if (!AssumeVH)<br>
> > + for (auto *U : V->users()) {<br>
> > + auto *II = dyn_cast<IntrinsicInst>(U);<br>
> > + if (!II)<br>
> > continue;<br>
> > - CallInst *I = cast<CallInst>(AssumeVH);<br>
> > - assert(I->getParent()-><wbr>getParent() ==<br>
> > Q.CxtI->getParent()-><wbr>getParent() &&<br>
> > - "Got assumption for the wrong function!");<br>
> > - if (Q.isExcluded(I))<br>
> > + if (II->getIntrinsicID() != Intrinsic::assume)<br>
> > + continue;<br>
> > + if (Q.isExcluded(II))<br>
> > continue;<br>
> ><br>
> > - // Warning: This loop can end up being somewhat performance<br>
> > sensetive.<br>
> > - // We're running this loop for once for each value queried<br>
> > resulting in a<br>
> > - // runtime of ~O(#assumes * #values).<br>
> > -<br>
> > - assert(I->getCalledFunction()-<wbr>>getIntrinsicID() ==<br>
> > Intrinsic::assume &&<br>
> > - "must be an assume intrinsic");<br>
> > -<br>
> > - Value *Arg = I->getArgOperand(0);<br>
> > + Value *Arg = II->getArgOperand(0);<br>
> ><br>
> > - if (Arg == V && isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + if (Arg == V && isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > assert(BitWidth == 1 && "assume operand is not i1?");<br>
> > KnownZero.clearAllBits();<br>
> > KnownOne.setAllBits();<br>
> > return;<br>
> > }<br>
> ><br>
> > + // Note that the patterns below need to be kept in sync with<br>
> > the<br>
> > code<br>
> > + // in InstCombiner::visitCallInst that adds relevant values to<br>
> > each<br>
> > + // assume's operand bundles.<br>
> > +<br>
> > // The remaining tests are all recursive, so bail out if we<br>
> > hit<br>
> > the limit.<br>
> > if (Depth == MaxDepth)<br>
> > continue;<br>
> > @@ -564,20 +561,20 @@ static void computeKnownBitsFromAssume(c<br>
> > ConstantInt *C;<br>
> > // assume(v = a)<br>
> > if (match(Arg, m_c_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > - Pred == ICmpInst::ICMP_EQ && isValidAssumeForContext(I,<br>
> > Q.CxtI, Q.DT)) {<br>
> > + Pred == ICmpInst::ICMP_EQ && isValidAssumeForContext(II,<br>
> > Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > KnownZero |= RHSKnownZero;<br>
> > KnownOne |= RHSKnownOne;<br>
> > // assume(v & b = a)<br>
> > } else if (match(Arg,<br>
> > m_c_ICmp(Pred, m_c_And(m_V, m_Value(B)),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt MaskKnownZero(BitWidth, 0), MaskKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, MaskKnownZero, MaskKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(B, MaskKnownZero, MaskKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > // For those bits in the mask that are known to be one, we<br>
> > can<br>
> > propagate<br>
> > // known bits from the RHS to V.<br>
> > @@ -587,11 +584,11 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg, m_c_ICmp(Pred, m_Not(m_c_And(m_V,<br>
> > m_Value(B))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt MaskKnownZero(BitWidth, 0), MaskKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, MaskKnownZero, MaskKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(B, MaskKnownZero, MaskKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > // For those bits in the mask that are known to be one, we<br>
> > can<br>
> > propagate<br>
> > // inverted known bits from the RHS to V.<br>
> > @@ -601,11 +598,11 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg,<br>
> > m_c_ICmp(Pred, m_c_Or(m_V, m_Value(B)),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt BKnownZero(BitWidth, 0), BKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > I));<br>
> > + computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > II));<br>
> ><br>
> > // For those bits in B that are known to be zero, we can<br>
> > propagate known<br>
> > // bits from the RHS to V.<br>
> > @@ -615,11 +612,11 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg, m_c_ICmp(Pred, m_Not(m_c_Or(m_V,<br>
> > m_Value(B))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt BKnownZero(BitWidth, 0), BKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > I));<br>
> > + computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > II));<br>
> ><br>
> > // For those bits in B that are known to be zero, we can<br>
> > propagate<br>
> > // inverted known bits from the RHS to V.<br>
> > @@ -629,11 +626,11 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg,<br>
> > m_c_ICmp(Pred, m_c_Xor(m_V, m_Value(B)),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt BKnownZero(BitWidth, 0), BKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > I));<br>
> > + computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > II));<br>
> ><br>
> > // For those bits in B that are known to be zero, we can<br>
> > propagate known<br>
> > // bits from the RHS to V. For those bits in B that are<br>
> > known<br>
> > to be one,<br>
> > @@ -646,11 +643,11 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg, m_c_ICmp(Pred, m_Not(m_c_Xor(m_V,<br>
> > m_Value(B))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > APInt BKnownZero(BitWidth, 0), BKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > I));<br>
> > + computeKnownBits(B, BKnownZero, BKnownOne, Depth+1, Query(Q,<br>
> > II));<br>
> ><br>
> > // For those bits in B that are known to be zero, we can<br>
> > propagate<br>
> > // inverted known bits from the RHS to V. For those bits in<br>
> > B<br>
> > that are<br>
> > @@ -663,9 +660,9 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg, m_c_ICmp(Pred, m_Shl(m_V,<br>
> > m_ConstantInt(C)),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > // For those bits in RHS that are known, we can propagate<br>
> > them<br>
> > to known<br>
> > // bits in V shifted to the right by C.<br>
> > KnownZero |= RHSKnownZero.lshr(C-><wbr>getZExtValue());<br>
> > @@ -674,9 +671,9 @@ static void computeKnownBitsFromAssume(c<br>
> > } else if (match(Arg, m_c_ICmp(Pred, m_Not(m_Shl(m_V,<br>
> > m_ConstantInt(C))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > // For those bits in RHS that are known, we can propagate<br>
> > them<br>
> > inverted<br>
> > // to known bits in V shifted to the right by C.<br>
> > KnownZero |= RHSKnownOne.lshr(C-><wbr>getZExtValue());<br>
> > @@ -687,9 +684,9 @@ static void computeKnownBitsFromAssume(c<br>
> > m_AShr(m_V,<br>
> > m_ConstantInt(C))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > // For those bits in RHS that are known, we can propagate<br>
> > them<br>
> > to known<br>
> > // bits in V shifted to the right by C.<br>
> > KnownZero |= RHSKnownZero << C->getZExtValue();<br>
> > @@ -700,9 +697,9 @@ static void computeKnownBitsFromAssume(c<br>
> > m_AShr(m_V,<br>
> > m_ConstantInt(C)))),<br>
> > m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_EQ &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> > // For those bits in RHS that are known, we can propagate<br>
> > them<br>
> > inverted<br>
> > // to known bits in V shifted to the right by C.<br>
> > KnownZero |= RHSKnownOne << C->getZExtValue();<br>
> > @@ -710,9 +707,9 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v >=_s c) where c is non-negative<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_SGE &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > if (RHSKnownZero.isNegative()) {<br>
> > // We know that the sign bit is zero.<br>
> > @@ -721,9 +718,9 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v >_s c) where c is at least -1.<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_SGT &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > if (RHSKnownOne.isAllOnesValue() ||<br>
> > RHSKnownZero.isNegative())<br>
> > {<br>
> > // We know that the sign bit is zero.<br>
> > @@ -732,9 +729,9 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v <=_s c) where c is negative<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_SLE &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > if (RHSKnownOne.isNegative()) {<br>
> > // We know that the sign bit is one.<br>
> > @@ -743,9 +740,9 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v <_s c) where c is non-positive<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_SLT &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > if (RHSKnownZero.isAllOnesValue() ||<br>
> > RHSKnownOne.isNegative())<br>
> > {<br>
> > // We know that the sign bit is one.<br>
> > @@ -754,9 +751,9 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v <=_u c)<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_ULE &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > // Whatever high bits in c are zero are known to be zero.<br>
> > KnownZero |=<br>
> > @@ -764,13 +761,13 @@ static void computeKnownBitsFromAssume(c<br>
> > // assume(v <_u c)<br>
> > } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) &&<br>
> > Pred == ICmpInst::ICMP_ULT &&<br>
> > - isValidAssumeForContext(I, Q.CxtI, Q.DT)) {<br>
> > + isValidAssumeForContext(II, Q.CxtI, Q.DT)) {<br>
> > APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);<br>
> > - computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, I));<br>
> > + computeKnownBits(A, RHSKnownZero, RHSKnownOne, Depth+1,<br>
> > Query(Q, II));<br>
> ><br>
> > // Whatever high bits in c are zero are known to be zero (if<br>
> > c<br>
> > is a power<br>
> > // of 2, then one more).<br>
> > - if (isKnownToBeAPowerOfTwo(A, false, Depth + 1, Query(Q,<br>
> > I)))<br>
> > + if (isKnownToBeAPowerOfTwo(A, false, Depth + 1, Query(Q,<br>
> > II)))<br>
> > KnownZero |=<br>
> > APInt::getHighBitsSet(<wbr>BitWidth,<br>
> > RHSKnownZero.countLeadingOnes(<wbr>)+1);<br>
> > else<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/lib/Transforms/<wbr>InstCombine/InstCombineCalls.<wbr>cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/InstCombine/<wbr>InstCombineCalls.cpp?rev=<wbr>289755&r1=289754&r2=289755&<wbr>view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Transforms/<wbr>InstCombine/InstCombineCalls.<wbr>cpp<br>
> > (original)<br>
> > +++ llvm/trunk/lib/Transforms/<wbr>InstCombine/InstCombineCalls.<wbr>cpp Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -2518,6 +2518,78 @@ Instruction *InstCombiner::visitCallInst<br>
> > if (KnownOne.isAllOnesValue())<br>
> > return eraseInstFromFunction(*II);<br>
> ><br>
> > + // For assumptions, add to the associated operand bundle the<br>
> > values to which<br>
> > + // the assumption might apply.<br>
> > + // Note: This code must be kept in-sync with the code in<br>
> > + // computeKnownBitsFromAssume in ValueTracking.<br>
> > + SmallVector<Value *, 16> Affected;<br>
> > + auto AddAffected = [&Affected](Value *V) {<br>
> > + if (isa<Argument>(V)) {<br>
> > + Affected.push_back(V);<br>
> > + } else if (auto *I = dyn_cast<Instruction>(V)) {<br>
> > + Affected.push_back(I);<br>
> > +<br>
> > + if (I->getOpcode() == Instruction::BitCast ||<br>
> > + I->getOpcode() == Instruction::PtrToInt) {<br>
> > + V = I->getOperand(0);<br>
> > + if (isa<Instruction>(V) || isa<Argument>(V))<br>
> > + Affected.push_back(V);<br>
> > + }<br>
> > + }<br>
> > + };<br>
> > +<br>
> > + CmpInst::Predicate Pred;<br>
> > + if (match(IIOperand, m_ICmp(Pred, m_Value(A), m_Value(B)))) {<br>
> > + AddAffected(A);<br>
> > + AddAffected(B);<br>
> > +<br>
> > + if (Pred == ICmpInst::ICMP_EQ) {<br>
> > + // For equality comparisons, we handle the case of bit<br>
> > inversion.<br>
> > + auto AddAffectedFromEq = [&AddAffected](Value *V) {<br>
> > + Value *A;<br>
> > + if (match(V, m_Not(m_Value(A)))) {<br>
> > + AddAffected(A);<br>
> > + V = A;<br>
> > + }<br>
> > +<br>
> > + Value *B;<br>
> > + ConstantInt *C;<br>
> > + if (match(V,<br>
> > + m_CombineOr(m_And(m_Value(A), m_Value(B)),<br>
> > + m_CombineOr(m_Or(m_Value(A), m_Value(B)),<br>
> > + m_Xor(m_Value(A),<br>
> > m_Value(B))))))<br>
> > {<br>
> > + AddAffected(A);<br>
> > + AddAffected(B);<br>
> > + } else if (match(V,<br>
> > + m_CombineOr(m_Shl(m_Value(A),<br>
> > m_ConstantInt(C)),<br>
> > + m_CombineOr(m_LShr(m_Value(A),<br>
> > m_ConstantInt(C)),<br>
> > + m_AShr(m_Value(A),<br>
> > +<br>
> > m_ConstantInt(C))))))<br>
> > {<br>
> > + AddAffected(A);<br>
> > + }<br>
> > + };<br>
> > +<br>
> > + AddAffectedFromEq(A);<br>
> > + AddAffectedFromEq(B);<br>
> > + }<br>
> > + }<br>
> > +<br>
> > + // If the list of affected values is the same as the existing<br>
> > list then<br>
> > + // there's nothing more to do here.<br>
> > + if (!Affected.empty())<br>
> > + if (auto OB = CI.getOperandBundle("affected"<wbr>))<br>
> > + if (Affected.size() == OB.getValue().Inputs.size() &&<br>
> > + std::equal(Affected.begin(), Affected.end(),<br>
> > + OB.getValue().Inputs.begin()))<br>
> > + Affected.clear();<br>
> > +<br>
> > + if (!Affected.empty()) {<br>
> > + Builder->CreateCall(<wbr>AssumeIntrinsic, IIOperand,<br>
> > + OperandBundleDef("affected", Affected),<br>
> > + II->getName());<br>
> > + return eraseInstFromFunction(*II);<br>
> > + }<br>
> > +<br>
> > break;<br>
> > }<br>
> > case Intrinsic::experimental_gc_<wbr>relocate: {<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>AlignmentFromAssumptions.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Scalar/<wbr>AlignmentFromAssumptions.cpp?<wbr>rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>AlignmentFromAssumptions.cpp<br>
> > (original)<br>
> > +++ llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>AlignmentFromAssumptions.cpp<br>
> > Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -425,9 +425,12 @@ bool AlignmentFromAssumptionsPass::<wbr>runIm<br>
> > NewSrcAlignments.clear();<br>
> ><br>
> > bool Changed = false;<br>
> > - for (auto &AssumeVH : AC.assumptions())<br>
> > - if (AssumeVH)<br>
> > - Changed |= processAssumption(cast<<wbr>CallInst>(AssumeVH));<br>
> > +<br>
> > + for (auto &B : F)<br>
> > + for (auto &I : B)<br>
> > + if (auto *II = dyn_cast<IntrinsicInst>(&I))<br>
> > + if (II->getIntrinsicID() == Intrinsic::assume)<br>
> > + Changed |= processAssumption(II);<br>
> ><br>
> > return Changed;<br>
> > }<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/no-wrap-<wbr>unknown-becount.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/no-wrap-unknown-becount.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Analysis/ScalarEvolution/no-<wbr>wrap-unknown-becount.ll?rev=<wbr>289755&r1=289754&r2=289755&<wbr>view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > ---<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/no-wrap-<wbr>unknown-becount.ll<br>
> > (original)<br>
> > +++<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/no-wrap-<wbr>unknown-becount.ll<br>
> > Wed Dec 14 20:53:42 2016<br>
> > @@ -55,7 +55,7 @@ loop:<br>
> > %cmp = icmp slt i32 %iv, 10000<br>
> > ; CHECK: %iv.sext = sext i32 %iv to i64<br>
> > ; CHECK-NEXT: --> {0,+,3}<nuw><nsw><%loop><br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i32 %iv) ]<br>
> > %c = load volatile i1, i1* %cond<br>
> > br i1 %c, label %loop, label %leave<br>
> ><br>
> > @@ -159,7 +159,7 @@ loop:<br>
> > %cmp = icmp ugt i32 %iv.inc, -10000<br>
> > ; CHECK: %iv.zext = zext i32 %iv to i64<br>
> > ; CHECK-NEXT: --> {30000,+,-2}<nw><%loop><br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i32 %iv.inc) ]<br>
> > %c = load volatile i1, i1* %cond<br>
> > br i1 %c, label %loop, label %leave<br>
> ><br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Analysis/<wbr>ScalarEvolution/nsw-offset-<wbr>assume.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Analysis/ScalarEvolution/nsw-<wbr>offset-assume.ll?rev=289755&<wbr>r1=289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Analysis/<wbr>ScalarEvolution/nsw-offset-<wbr>assume.ll<br>
> > (original)<br>
> > +++ llvm/trunk/test/Analysis/<wbr>ScalarEvolution/nsw-offset-<wbr>assume.ll<br>
> > Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -11,7 +11,7 @@ define void @foo(i32 %no, double* nocapt<br>
> > entry:<br>
> > %n = and i32 %no, 4294967294<br>
> > %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]<br>
> > - tail call void @llvm.assume(i1 %0)<br>
> > + tail call void @llvm.assume(i1 %0) [ "affected"(i32 %n) ]<br>
> > br label %bb.nph<br>
> ><br>
> > bb.nph: ; preds = %entry<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Transforms/<wbr>CorrelatedValuePropagation/<wbr>conflict.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/conflict.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/<wbr>CorrelatedValuePropagation/<wbr>conflict.ll?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > ---<br>
> > llvm/trunk/test/Transforms/<wbr>CorrelatedValuePropagation/<wbr>conflict.ll<br>
> > (original)<br>
> > +++<br>
> > llvm/trunk/test/Transforms/<wbr>CorrelatedValuePropagation/<wbr>conflict.ll<br>
> > Wed Dec 14 20:53:42 2016<br>
> > @@ -26,7 +26,7 @@ declare void @llvm.assume(i1)<br>
> > define i8 @test2(i8 %a) {<br>
> > ; CHECK-LABEL: @test2<br>
> > %cmp1 = icmp eq i8 %a, 5<br>
> > - call void @llvm.assume(i1 %cmp1)<br>
> > + call void @llvm.assume(i1 %cmp1) [ "affected"(i8 %a) ]<br>
> > %cmp2 = icmp eq i8 %a, 3<br>
> > ; CHECK: br i1 false, label %dead, label %exit<br>
> > br i1 %cmp2, label %dead, label %exit<br>
> > @@ -43,7 +43,7 @@ define i8 @test3(i8 %a) {<br>
> > dead:<br>
> > %cmp2 = icmp eq i8 %a, 3<br>
> > ; CHECK: call void @llvm.assume(i1 false)<br>
> > - call void @llvm.assume(i1 %cmp2)<br>
> > + call void @llvm.assume(i1 %cmp2) [ "affected"(i8 %a) ]<br>
> > ret i8 %a<br>
> > exit:<br>
> > ret i8 0<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Transforms/<wbr>InstCombine/assume-redundant.<wbr>ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/assume-redundant.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/InstCombine/assume-<wbr>redundant.ll?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>InstCombine/assume-redundant.<wbr>ll<br>
> > (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>InstCombine/assume-redundant.<wbr>ll Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -11,7 +11,7 @@ target triple = "x86_64-unknown-linux-gn<br>
> > define void @_Z3fooR1s(%struct.s* nocapture readonly<br>
> > dereferenceable(8) %x) #0 {<br>
> ><br>
> > ; CHECK-LABEL: @_Z3fooR1s<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %maskcond) [ "affected"(i64<br>
> > %maskedptr, i64 %ptrint, double* %{{.*}}) ]<br>
> > ; CHECK-NOT: call void @llvm.assume<br>
> ><br>
> > entry:<br>
> ><br>
> > Modified: llvm/trunk/test/Transforms/<wbr>InstCombine/assume.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/assume.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/InstCombine/assume.<wbr>ll?rev=289755&r1=289754&r2=<wbr>289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>InstCombine/assume.ll (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>InstCombine/assume.ll Wed Dec 14<br>
> > 20:53:42 2016<br>
> > @@ -11,7 +11,7 @@ entry:<br>
> > ; been removed:<br>
> > ; CHECK-LABEL: @foo1<br>
> > ; CHECK-DAG: load i32, i32* %a, align 32<br>
> > -; CHECK-DAG: call void @llvm.assume<br>
> > +; CHECK-DAG: call void @llvm.assume(i1 %maskcond) [ "affected"(i64<br>
> > %maskedptr, i64 %ptrint, i32* %a) ]<br>
> > ; CHECK: ret i32<br>
> ><br>
> > %ptrint = ptrtoint i32* %a to i64<br>
> > @@ -28,7 +28,7 @@ entry:<br>
> > ; Same check as in @foo1, but make sure it works if the assume is<br>
> > first too.<br>
> > ; CHECK-LABEL: @foo2<br>
> > ; CHECK-DAG: load i32, i32* %a, align 32<br>
> > -; CHECK-DAG: call void @llvm.assume<br>
> > +; CHECK-DAG: call void @llvm.assume(i1 %maskcond) [ "affected"(i64<br>
> > %maskedptr, i64 %ptrint, i32* %a) ]<br>
> > ; CHECK: ret i32<br>
> ><br>
> > %ptrint = ptrtoint i32* %a to i64<br>
> > @@ -51,7 +51,7 @@ entry:<br>
> > ; CHECK: ret i32 4<br>
> ><br>
> > %cmp = icmp eq i32 %a, 4<br>
> > - tail call void @llvm.assume(i1 %cmp)<br>
> > + tail call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ret i32 %a<br>
> > }<br>
> ><br>
> > @@ -93,7 +93,7 @@ entry:<br>
> > %and1 = and i32 %a, 3<br>
> ><br>
> > ; CHECK-LABEL: @bar1<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %and,<br>
> > i32<br>
> > %a) ]<br>
> > ; CHECK: ret i32 1<br>
> ><br>
> > %and = and i32 %a, 7<br>
> > @@ -107,7 +107,7 @@ entry:<br>
> > define i32 @bar2(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @bar2<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %and,<br>
> > i32<br>
> > %a) ]<br>
> > ; CHECK: ret i32 1<br>
> ><br>
> > %and = and i32 %a, 7<br>
> > @@ -125,7 +125,7 @@ entry:<br>
> ><br>
> > ; Don't be fooled by other assumes around.<br>
> > ; CHECK-LABEL: @bar3<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %and,<br>
> > i32<br>
> > %a) ]<br>
> > ; CHECK: ret i32 1<br>
> ><br>
> > tail call void @llvm.assume(i1 %x)<br>
> > @@ -145,8 +145,8 @@ entry:<br>
> > %and1 = and i32 %b, 3<br>
> ><br>
> > ; CHECK-LABEL: @bar4<br>
> > -; CHECK: call void @llvm.assume<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %and,<br>
> > i32<br>
> > %a) ]<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp2) [ "affected"(i32 %a, i32<br>
> > %b) ]<br>
> > ; CHECK: ret i32 1<br>
> ><br>
> > %and = and i32 %a, 7<br>
> > @@ -167,7 +167,7 @@ entry:<br>
> > ret i32 %conv<br>
> ><br>
> > ; CHECK-LABEL: @icmp1<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 1<br>
> ><br>
> > }<br>
> > @@ -182,7 +182,7 @@ entry:<br>
> > ret i32 %lnot.ext<br>
> ><br>
> > ; CHECK-LABEL: @icmp2<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 0<br>
> > }<br>
> ><br>
> > @@ -217,7 +217,7 @@ entry:<br>
> ><br>
> > ; CHECK-LABEL: @nonnull2<br>
> > ; CHECK-NOT: !nonnull<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %load) ]<br>
> > }<br>
> ><br>
> > ; Make sure the above canonicalization does not trigger<br>
> > @@ -236,7 +236,7 @@ not_taken:<br>
> ><br>
> > ; CHECK-LABEL: @nonnull3<br>
> > ; CHECK-NOT: !nonnull<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32* %load)<br>
> > ]<br>
> > }<br>
> ><br>
> > ; Make sure the above canonicalization does not trigger<br>
> > @@ -254,7 +254,7 @@ entry:<br>
> ><br>
> > ; CHECK-LABEL: @nonnull4<br>
> > ; CHECK-NOT: !nonnull<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32* %load)<br>
> > ]<br>
> > }<br>
> ><br>
> ><br>
> ><br>
> > Modified: llvm/trunk/test/Transforms/<wbr>InstCombine/assume2.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/assume2.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/InstCombine/<wbr>assume2.ll?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>InstCombine/assume2.ll (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>InstCombine/assume2.ll Wed Dec 14<br>
> > 20:53:42 2016<br>
> > @@ -9,7 +9,7 @@ declare void @llvm.assume(i1) #1<br>
> > define i32 @test1(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test1<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %and,<br>
> > i32<br>
> > %a) ]<br>
> > ; CHECK: ret i32 5<br>
> ><br>
> > %and = and i32 %a, 15<br>
> > @@ -24,7 +24,7 @@ entry:<br>
> > define i32 @test2(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test2<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a.not,<br>
> > i32 %a) ]<br>
> > ; CHECK: ret i32 2<br>
> ><br>
> > %and = and i32 %a, 15<br>
> > @@ -40,7 +40,7 @@ entry:<br>
> > define i32 @test3(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test3<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %v, i32<br>
> > %a) ]<br>
> > ; CHECK: ret i32 5<br>
> ><br>
> > %v = or i32 %a, 4294967280<br>
> > @@ -55,7 +55,7 @@ entry:<br>
> > define i32 @test4(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test4<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a.not,<br>
> > i32 %a) ]<br>
> > ; CHECK: ret i32 2<br>
> ><br>
> > %v = or i32 %a, 4294967280<br>
> > @@ -71,7 +71,7 @@ entry:<br>
> > define i32 @test5(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test5<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 4<br>
> ><br>
> > %v = xor i32 %a, 1<br>
> > @@ -86,7 +86,7 @@ entry:<br>
> > define i32 @test6(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test6<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %v.mask,<br>
> > i32 %a) ]<br>
> > ; CHECK: ret i32 5<br>
> ><br>
> > %v = shl i32 %a, 2<br>
> > @@ -101,7 +101,7 @@ entry:<br>
> > define i32 @test7(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test7<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %v.mask,<br>
> > i32 %a) ]<br>
> > ; CHECK: ret i32 20<br>
> ><br>
> > %v = lshr i32 %a, 2<br>
> > @@ -116,7 +116,7 @@ entry:<br>
> > define i32 @test8(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test8<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %v.mask,<br>
> > i32 %a) ]<br>
> > ; CHECK: ret i32 20<br>
> ><br>
> > %v = lshr i32 %a, 2<br>
> > @@ -131,7 +131,7 @@ entry:<br>
> > define i32 @test9(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test9<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 0<br>
> ><br>
> > %cmp = icmp sgt i32 %a, 5<br>
> > @@ -145,7 +145,7 @@ entry:<br>
> > define i32 @test10(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test10<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 -2147483648<br>
> ><br>
> > %cmp = icmp sle i32 %a, -2<br>
> > @@ -159,7 +159,7 @@ entry:<br>
> > define i32 @test11(i32 %a) #0 {<br>
> > entry:<br>
> > ; CHECK-LABEL: @test11<br>
> > -; CHECK: call void @llvm.assume<br>
> > +; CHECK: call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > ; CHECK: ret i32 0<br>
> ><br>
> > %cmp = icmp ule i32 %a, 256<br>
> ><br>
> > Modified: llvm/trunk/test/Transforms/<wbr>InstSimplify/add-mask.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/add-mask.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/InstSimplify/add-<wbr>mask.ll?rev=289755&r1=289754&<wbr>r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>InstSimplify/add-mask.ll (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>InstSimplify/add-mask.ll Wed Dec 14<br>
> > 20:53:42 2016<br>
> > @@ -46,7 +46,7 @@ define i1 @test4(i32 %a) {<br>
> > %b = load i32, i32* @B<br>
> > %b.and = and i32 %b, 1<br>
> > %b.cnd = icmp eq i32 %b.and, 1<br>
> > - call void @llvm.assume(i1 %b.cnd)<br>
> > + call void @llvm.assume(i1 %b.cnd) [ "affected"(i32 %b.and, i32<br>
> > %b)<br>
> > ]<br>
> ><br>
> > %rhs = add i32 %a, %b<br>
> > %and = and i32 %a, %rhs<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Transforms/<wbr>JumpThreading/assume-edge-dom.<wbr>ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/assume-edge-dom.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/JumpThreading/<wbr>assume-edge-dom.ll?rev=289755&<wbr>r1=289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>JumpThreading/assume-edge-dom.<wbr>ll<br>
> > (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>JumpThreading/assume-edge-dom.<wbr>ll Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -14,12 +14,12 @@ entry:<br>
> > taken:<br>
> > %res1 = call i8* @escape()<br>
> > %a = icmp eq i8* %res1, null<br>
> > - tail call void @llvm.assume(i1 %a)<br>
> > + tail call void @llvm.assume(i1 %a) [ "affected"(i8* %res1) ]<br>
> > br label %done<br>
> > not_taken:<br>
> > %res2 = call i8* @escape()<br>
> > %b = icmp ne i8* %res2, null<br>
> > - tail call void @llvm.assume(i1 %b)<br>
> > + tail call void @llvm.assume(i1 %b) [ "affected"(i8* %res2) ]<br>
> > br label %done<br>
> ><br>
> > ; An assume that can be used to simplify this comparison dominates<br>
> > each<br>
> ><br>
> > Modified: llvm/trunk/test/Transforms/<wbr>JumpThreading/assume.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/assume.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/JumpThreading/<wbr>assume.ll?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>JumpThreading/assume.ll (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>JumpThreading/assume.ll Wed Dec 14<br>
> > 20:53:42 2016<br>
> > @@ -6,7 +6,7 @@ target triple = "x86_64-unknown-linux-gn<br>
> > define i32 @test1(i32 %a, i32 %b) #0 {<br>
> > entry:<br>
> > %cmp = icmp sgt i32 %a, 5<br>
> > - tail call void @llvm.assume(i1 %cmp)<br>
> > + tail call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > %cmp1 = icmp sgt i32 %b, 1234<br>
> > br i1 %cmp1, label %if.then, label %if.else<br>
> ><br>
> > @@ -36,7 +36,7 @@ return:<br>
> > define i32 @test2(i32 %a) #0 {<br>
> > entry:<br>
> > %cmp = icmp sgt i32 %a, 5<br>
> > - tail call void @llvm.assume(i1 %cmp)<br>
> > + tail call void @llvm.assume(i1 %cmp) [ "affected"(i32 %a) ]<br>
> > %cmp1 = icmp sgt i32 %a, 3<br>
> > br i1 %cmp1, label %if.then, label %return<br>
> ><br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Transforms/<wbr>NaryReassociate/NVPTX/nary-<wbr>gep.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/NaryReassociate/NVPTX/nary-gep.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/NaryReassociate/<wbr>NVPTX/nary-gep.ll?rev=289755&<wbr>r1=289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>NaryReassociate/NVPTX/nary-<wbr>gep.ll<br>
> > (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>NaryReassociate/NVPTX/nary-<wbr>gep.ll<br>
> > Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -75,10 +75,10 @@ define void @reassociate_gep_assume(floa<br>
> > ; CHECK-LABEL: @reassociate_gep_assume(<br>
> > ; assume(j >= 0)<br>
> > %cmp = icmp sgt i32 %j, -1<br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i32 %j) ]<br>
> > %1 = add i32 %i, %j<br>
> > %cmp2 = icmp sgt i32 %1, -1<br>
> > - call void @llvm.assume(i1 %cmp2)<br>
> > + call void @llvm.assume(i1 %cmp2) [ "affected"(i32 %1) ]<br>
> ><br>
> > %idxprom.j = zext i32 %j to i64<br>
> > %2 = getelementptr float, float* %a, i64 %idxprom.j<br>
> ><br>
> > Modified:<br>
> > llvm/trunk/test/Transforms/<wbr>SimplifyCFG/switch-dead-<wbr>default.ll<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch-dead-default.ll?rev=289755&r1=289754&r2=289755&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/SimplifyCFG/switch-<wbr>dead-default.ll?rev=289755&r1=<wbr>289754&r2=289755&view=diff</a><br>
> > ==============================<wbr>==============================<wbr>==================<br>
> > --- llvm/trunk/test/Transforms/<wbr>SimplifyCFG/switch-dead-<wbr>default.ll<br>
> > (original)<br>
> > +++ llvm/trunk/test/Transforms/<wbr>SimplifyCFG/switch-dead-<wbr>default.ll<br>
> > Wed<br>
> > Dec 14 20:53:42 2016<br>
> > @@ -91,7 +91,7 @@ define void @test5(i8 %a) {<br>
> > ; CHECK-LABEL: @test5<br>
> > ; CHECK: br i1 [[IGNORE:%.*]], label %true, label %false<br>
> > %cmp = icmp ult i8 %a, 2<br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i8 %a) ]<br>
> > switch i8 %a, label %default [i8 1, label %true<br>
> > i8 0, label %false]<br>
> > true:<br>
> > @@ -112,7 +112,7 @@ define void @test6(i8 %a) {<br>
> > ; CHECK: br i1 [[IGNORE:%.*]], label %true, label %false<br>
> > %and = and i8 %a, 254<br>
> > %cmp = icmp eq i8 %and, 254<br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i8 %and, i8 %a) ]<br>
> > switch i8 %a, label %default [i8 255, label %true<br>
> > i8 254, label %false]<br>
> > true:<br>
> > @@ -134,7 +134,7 @@ define void @test7(i8 %a) {<br>
> > ; CHECK: br i1 [[IGNORE:%.*]], label %true, label %false<br>
> > %and = and i8 %a, 254<br>
> > %cmp = icmp eq i8 %and, 254<br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i8 %and, i8 %a) ]<br>
> > switch i8 %a, label %default [i8 255, label %true<br>
> > i8 254, label %false<br>
> > i8 0, label %also_dead]<br>
> > @@ -162,7 +162,7 @@ define void @test8(i8 %a) {<br>
> > ; CHECK: switch i8<br>
> > %and = and i8 %a, 254<br>
> > %cmp = icmp eq i8 %and, undef<br>
> > - call void @llvm.assume(i1 %cmp)<br>
> > + call void @llvm.assume(i1 %cmp) [ "affected"(i8 %and, i8 %a) ]<br>
> > switch i8 %a, label %default [i8 255, label %true<br>
> > i8 254, label %false]<br>
> > true:<br>
> ><br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > llvm-commits mailing list<br>
> > <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
> ><br>
><br>
> --<br>
> Hal Finkel<br>
> Lead, Compiler Technology and Programming Languages<br>
> Leadership Computing Facility<br>
> Argonne National Laboratory<br>
><br>
<br>
--<br>
Hal Finkel<br>
Lead, Compiler Technology and Programming Languages<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>