Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davemgreen committed May 22, 2024
1 parent 10d4675 commit 0b7e99d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llvm/lib/CodeGen/SelectOptimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class SelectOptimizeImpl {

/// Invert the select by inverting the condition and switching the operands.
void setInverted() {
assert(!Inverted && "Trying to invert and inverted SelectLike");
assert(!Inverted && "Trying to invert an inverted SelectLike");
assert(isa<Instruction>(getCondition()) &&
cast<Instruction>(getCondition())->getOpcode() ==
Instruction::Xor);
Expand Down Expand Up @@ -193,6 +193,8 @@ class SelectOptimizeImpl {
/// condition of a select or c in `or(zext(c), x)`
Value *getCondition() const {
Value *CC = getNonInvertedCondition();
// For inverted conditions the CC is checked above to be a not / xor
// instruction.
if (Inverted)
return cast<Instruction>(CC)->getOperand(0);
return CC;
Expand Down

0 comments on commit 0b7e99d

Please sign in to comment.