Skip to content

Commit 60aeea2

Browse files
committed
[InstCombine] Fix uninitialized variable usage
m_Specific can only be used if the previous check suceeded. Found by msan.
1 parent 785e094 commit 60aeea2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,12 +4227,9 @@ InstCombinerImpl::foldCommutativeIntrinsicOverSelects(IntrinsicInst &II) {
42274227
assert(II.isCommutative());
42284228

42294229
Value *A, *B, *C;
4230-
bool LHSIsSelect =
4231-
match(II.getOperand(0), m_Select(m_Value(A), m_Value(B), m_Value(C)));
4232-
bool RHSIsSymmetricalSelect = match(
4233-
II.getOperand(1), m_Select(m_Specific(A), m_Specific(C), m_Specific(B)));
4234-
4235-
if (LHSIsSelect && RHSIsSymmetricalSelect) {
4230+
if (match(II.getOperand(0), m_Select(m_Value(A), m_Value(B), m_Value(C))) &&
4231+
match(II.getOperand(1),
4232+
m_Select(m_Specific(A), m_Specific(C), m_Specific(B)))) {
42364233
replaceOperand(II, 0, B);
42374234
replaceOperand(II, 1, C);
42384235
return ⅈ

0 commit comments

Comments
 (0)