[PATCH] D85971: [IndVarSimplify] Fix Modified status for removal of overflow intrinsics

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 00:23:09 PDT 2020


dstenb added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:480
 
+  Changed = true;
   return true;
----------------
bjope wrote:
> I got a feeling that these eliminate functions return true/false depending on if any changes where made. So why aren't we setting Changed=true at the using side.
> 
> Otherwise I'd expect that also eliminateTrunc below should set Changed=true before returning true. Or it would be really hard to know what to expect from these functions if only some of them update Changed.
Yes, that is a good point.

I initially thought about modifying Changed in `simplifyUsers()` depending on if `eliminateIVUser()` returns true. However, that function may return true without actually making any changes, e.g. in the case of ICmpInst, SRem, and URem instructions. I don't really know why that is the case. Therefore, I thought that this patch could be kept simple, and just align with the current behavior. 

(And yes, the trunc case probably needs to be handled also.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85971



More information about the llvm-commits mailing list