Split off from D150398 to avoid builder-related diff changes there.
Using IRBuilder to create ICmps simplifies the result if both operands
are constants.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Rather than have IRBuilder detect and optimize this implicitly at code-gen/ILV::completeLoopSkeleton() time, better do so explicitly at VPlan transform time, probably after VF and UF have been set, i.e., optimize the compare and conditional branch recipes into an unconditional branch recipe. Is the intent to do so as a subsequent patch? If so would be good to add a TODO to replace IRBuilder here; code-gen should ideally be straightforward.
nit: typo in title. The use of IRBuilder to create the compare also optimizes it.
The immediate goal is to bring this code in line with how VPInstruction creates compares, so the diff for D150398 is as small as possible.
Once we have the branch modeled in VPlan, we should simplify it there directly as well, but this patch is a first step to get there, I added a TODO.
nit: typo in title. The use of IRBuilder to create the compare also optimizes it.
Typo should be fixed, thanks!
Well, better avoid optimizing compares implicitly by VPInstruction's code-gen as well... but the goal is clear.
Once we have the branch modeled in VPlan, we should simplify it there directly as well, but this patch is a first step to get there, I added a TODO.
Thanks! Simplification is for both compare and branch.