[PATCH] D157276: [NFC][LoopPredication] Extract guard parsing to GuardUtils

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 10:23:21 PDT 2023


anna accepted this revision.
anna added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Analysis/GuardUtils.cpp:145
+
+  parseCondition(Condition, [&](Value *Check) -> bool {
+    if (!isWidenableCondition(Check))
----------------
aleksandr.popov wrote:
> anna wrote:
> > This always returns true. Why do you need a templated function for `parseCondition`  in this patch?  I'd suggest  the non-templated version and once you add support for parsing it in GuardWidening, we can see if we need a templated version or not. 
> Yep, returning true was change in advance. I'll turn callback's type into void.
> The reason why I need templated function for `parseCondition` - is an intent to separate condition parsing and checks collecting.
> So in the `parseCondition` I just want to parse the condition while in the `parseWidenableGuard` I want to make a decision whether to add check in the resulting list or not (in case if it's widenable-condition)
had a chat with Aleksandr offline. The need for the template arises because a later patch will use the same logic but with a different Callback function (which will be modified to return a bool). 


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

https://reviews.llvm.org/D157276



More information about the llvm-commits mailing list