A select i1 %c, i1 true, i1 %d is just an or and a select i1 %c, i1 %d, i1 false is just an and. There are better treated as such in the logic of SelectOpt, allowing the backend to optimize them to and/or directly.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This looks fine to me as well and it is okay performance-wise (within noise margins for some testing I did).
My only suggestion is to separate this check in a separate function. See inline comment.
llvm/lib/CodeGen/SelectOptimize.cpp | ||
---|---|---|
538 | I would suggest moving the added check to a new static function maybe called isSpecialSelect and continue if it returns true. It will make the code cleaner and maybe we will add more special select cases that should not be changed to branches. |
I would suggest moving the added check to a new static function maybe called isSpecialSelect and continue if it returns true. It will make the code cleaner and maybe we will add more special select cases that should not be changed to branches.