Skip to content

Commit cbee75e

Browse files
!fixup respect operands order
1 parent 3933698 commit cbee75e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3883,16 +3883,16 @@ Instruction *InstCombinerImpl::visitSwitchInst(SwitchInst &SI) {
38833883

38843884
auto MaybeInvertible = [&](Value *Cond) -> std::optional<InvertFn> {
38853885
if (match(Cond, m_Add(m_Value(Op0), m_APInt(CondOpC))))
3886-
// Change 'switch (X+C) case A:' into 'switch (X) case C-A'.
3887-
return [](const APInt &C, const APInt &Case) { return C - Case; };
3886+
// Change 'switch (X+C) case Case:' into 'switch (X) case Case-C'.
3887+
return [](const APInt &Case, const APInt &C) { return Case - C; };
38883888

38893889
if (match(Cond, m_Sub(m_APInt(CondOpC), m_Value(Op0))))
3890-
// Change 'switch (C-X) case A:' into 'switch (X) case A-C'.
3891-
return [](const APInt &C, const APInt &Case) { return Case - C; };
3890+
// Change 'switch (C-X) case Case:' into 'switch (X) case C-Case'.
3891+
return [](const APInt &Case, const APInt &C) { return C - Case; };
38923892

38933893
if (match(Cond, m_Xor(m_Value(Op0), m_APInt(CondOpC))))
3894-
// Change 'switch (X^C) case A:' into 'switch (X) case A^C'.
3895-
return [](const APInt &C, const APInt &Case) { return C ^ Case; };
3894+
// Change 'switch (X^C) case Case:' into 'switch (X) case Case^C'.
3895+
return [](const APInt &Case, const APInt &C) { return Case ^ C; };
38963896

38973897
return std::nullopt;
38983898
};

0 commit comments

Comments
 (0)