[llvm] [SelectOpt] Add handling for not conditions. (PR #92517)
Sotiris Apostolakis via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 06:09:50 PDT 2024
================
@@ -177,11 +189,22 @@ class SelectOptimizeImpl {
llvm_unreachable("Unhandled case in getCondition");
}
+ /// Return the condition for the SelectLike instruction. For example the
+ /// condition of a select or c in `or(zext(c), x)`
+ Value *getCondition() const {
+ Value *CC = getNonInvertedCondition();
+ if (Inverted)
+ return cast<Instruction>(CC)->getOperand(0);
----------------
sapostolakis wrote:
add a comment on what type of instruction can be inverted and why it is safe/correct to get the first operand for the condition
https://github.com/llvm/llvm-project/pull/92517
More information about the llvm-commits
mailing list