<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">It looks like oss-fuzz started detecting an issue in indvar over the last day or 2: <a href="https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15237" class="">https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15237</a> .</div><div class=""><br class=""></div><div class=""> I had a quick look over the changes in the range and it looks like this patch is one of the few that touched IndVarSimplify over that period (as well as r 363293). It would be great if you could have a quick look. In case I missed the real culprit, apologies for the noise!</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Florian<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 13, 2019, at 19:32, Philip Reames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: reames<br class="">Date: Thu Jun 13 11:32:55 2019<br class="">New Revision: 363292<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=363292&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=363292&view=rev</a><br class="">Log:<br class="">[LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC]<br class=""><br class=""><br class="">Modified:<br class="">    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp<br class=""><br class="">Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=363292&r1=363291&r2=363292&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=363292&r1=363291&r2=363292&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)<br class="">+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Jun 13 11:32:55 2019<br class="">@@ -2385,12 +2385,15 @@ bool IndVarSimplify::<br class=""> linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB,<br class="">                           const SCEV *BackedgeTakenCount,<br class="">                           PHINode *IndVar, SCEVExpander &Rewriter) {<br class="">+  assert(isLoopCounter(IndVar, L, SE));<br class="">+  assert(L->getLoopLatch() && "Loop no longer in simplified form?");<br class="">+  Instruction * const IncVar =<br class="">+    cast<Instruction>(IndVar->getIncomingValueForBlock(L->getLoopLatch()));<br class="">+<br class="">   // Initialize CmpIndVar and IVCount to their preincremented values.<br class="">   Value *CmpIndVar = IndVar;<br class="">   const SCEV *IVCount = BackedgeTakenCount;<br class=""><br class="">-  assert(L->getLoopLatch() && "Loop no longer in simplified form?");<br class="">-<br class="">   // If the exiting block is the same as the backedge block, we prefer to<br class="">   // compare against the post-incremented value, otherwise we must compare<br class="">   // against the preincremented value.<br class="">@@ -2401,12 +2404,10 @@ linearFunctionTestReplace(Loop *L, Basic<br class="">       // to add a potentially UB introducing use.  We need to either a) show<br class="">       // the loop test we're modifying is already in post-inc form, or b) show<br class="">       // that adding a use must not introduce UB.<br class="">-      Instruction *Inc =<br class="">-        cast<Instruction>(IndVar->getIncomingValueForBlock(L->getLoopLatch()));<br class="">       ICmpInst *LoopTest = getLoopTest(L, ExitingBB);<br class="">-      SafeToPostInc = LoopTest->getOperand(0) == Inc ||<br class="">-        LoopTest->getOperand(1) == Inc ||<br class="">-        mustExecuteUBIfPoisonOnPathTo(Inc, ExitingBB->getTerminator(), DT);<br class="">+      SafeToPostInc = LoopTest->getOperand(0) == IncVar ||<br class="">+        LoopTest->getOperand(1) == IncVar ||<br class="">+        mustExecuteUBIfPoisonOnPathTo(IncVar, ExitingBB->getTerminator(), DT);<br class="">     }<br class="">     if (SafeToPostInc) {<br class="">       // Add one to the "backedge-taken" count to get the trip count.<br class="">@@ -2417,7 +2418,7 @@ linearFunctionTestReplace(Loop *L, Basic<br class="">       // The BackedgeTaken expression contains the number of times that the<br class="">       // backedge branches to the loop header.  This is one less than the<br class="">       // number of times the loop executes, so use the incremented indvar.<br class="">-      CmpIndVar = IndVar->getIncomingValueForBlock(ExitingBB);<br class="">+      CmpIndVar = IncVar;<br class="">     }<br class="">   }<br class=""><br class="">@@ -2433,7 +2434,6 @@ linearFunctionTestReplace(Loop *L, Basic<br class="">   // dynamically dead IV that wraps on the first loop iteration only, which is<br class="">   // not covered by the post-inc addrec. (If the new IV was not dynamically<br class="">   // dead, it could not be poison on the first iteration in the first place.)<br class="">-  Value *IncVar = IndVar->getIncomingValueForBlock(L->getLoopLatch());<br class="">   if (auto *BO = dyn_cast<BinaryOperator>(IncVar)) {<br class="">     const SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(SE->getSCEV(IncVar));<br class="">     if (BO->hasNoUnsignedWrap())<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>