[llvm] 60aeea2 - [InstCombine] Fix uninitialized variable usage
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 07:33:41 PST 2023
Author: Benjamin Kramer
Date: 2023-12-13T16:31:19+01:00
New Revision: 60aeea21fd885de1e03b354f455b91c47ed0d7e1
URL: https://github.com/llvm/llvm-project/commit/60aeea21fd885de1e03b354f455b91c47ed0d7e1
DIFF: https://github.com/llvm/llvm-project/commit/60aeea21fd885de1e03b354f455b91c47ed0d7e1.diff
LOG: [InstCombine] Fix uninitialized variable usage
m_Specific can only be used if the previous check suceeded. Found by
msan.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 104c736022236..1539fa9a3269e 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -4227,12 +4227,9 @@ InstCombinerImpl::foldCommutativeIntrinsicOverSelects(IntrinsicInst &II) {
assert(II.isCommutative());
Value *A, *B, *C;
- bool LHSIsSelect =
- match(II.getOperand(0), m_Select(m_Value(A), m_Value(B), m_Value(C)));
- bool RHSIsSymmetricalSelect = match(
- II.getOperand(1), m_Select(m_Specific(A), m_Specific(C), m_Specific(B)));
-
- if (LHSIsSelect && RHSIsSymmetricalSelect) {
+ if (match(II.getOperand(0), m_Select(m_Value(A), m_Value(B), m_Value(C))) &&
+ match(II.getOperand(1),
+ m_Select(m_Specific(A), m_Specific(C), m_Specific(B)))) {
replaceOperand(II, 0, B);
replaceOperand(II, 1, C);
return ⅈ
More information about the llvm-commits
mailing list