Extract logic of parsing guards and widenable branches in order to reuse
it in the GuardWidening
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Analysis/GuardUtils.cpp | ||
---|---|---|
121 | Pls leave default value for SmallVector (i.e. SmallVector<Value *> Worklist = {Condition};). If we happen to have more than 4 conditions, we end up resizing. | |
123 | You can delay adding Condition into Visited and make this entire loop as: do { Value *Check = Worklist.pop_back_val(); if (!Visited.insert(Check).second) continue; Value *LHS, *RHS; if (match(Check, m_And(m_Value(LHS), m_Value(RHS)))) { Worklist.push_back(LHS); Worklist.push_back(RHS); continue; } if (!Callback(Check)) break; } while (!Worklist.empty()); | |
145 | 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. | |
llvm/lib/Transforms/Scalar/LoopPredication.cpp | ||
778 | Pls land this and the added debug statement in the test separately (can land without review), since it is unrelated to patch. |
llvm/lib/Analysis/GuardUtils.cpp | ||
---|---|---|
123 | Do you mind if I do that refactoring in the next separate patch? | |
145 | Yep, returning true was change in advance. I'll turn callback's type into void. | |
llvm/lib/Transforms/Scalar/LoopPredication.cpp | ||
778 | Ok, will do it in the separate patch, thanks! |
llvm/lib/Analysis/GuardUtils.cpp | ||
---|---|---|
145 | 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). |
Pls leave default value for SmallVector (i.e. SmallVector<Value *> Worklist = {Condition};). If we happen to have more than 4 conditions, we end up resizing.