[PATCH] D103424: [IndVars] Don't forget value when inferring nowrap flags

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 4 11:57:37 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG14f350daf290: [IndVars] Don't forget value when inferring nowrap flags (authored by nikic).

Changed prior to commit:
  https://reviews.llvm.org/D103424?vs=348851&id=349935#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103424/new/

https://reviews.llvm.org/D103424

Files:
  llvm/lib/Transforms/Utils/SimplifyIndVar.cpp


Index: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -772,17 +772,20 @@
   if (!BO->hasNoUnsignedWrap() &&
       willNotOverflow(SE, BO->getOpcode(), /* Signed */ false, LHS, RHS)) {
     BO->setHasNoUnsignedWrap();
-    SE->forgetValue(BO);
     Changed = true;
   }
 
   if (!BO->hasNoSignedWrap() &&
       willNotOverflow(SE, BO->getOpcode(), /* Signed */ true, LHS, RHS)) {
     BO->setHasNoSignedWrap();
-    SE->forgetValue(BO);
     Changed = true;
   }
 
+  // The willNotOverflow() check might infer additional nowrap flags on addrecs
+  // while performing zero/sign extensions. We could call forgetValue() here
+  // to make sure those flags also propagate to any other SCEV expressions
+  // based on the addrec. However, this can have pathological compile-time
+  // impact, see https://bugs.llvm.org/show_bug.cgi?id=50384.
   return Changed;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103424.349935.patch
Type: text/x-patch
Size: 1031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210604/3df0ece7/attachment.bin>


More information about the llvm-commits mailing list