[llvm] 035aaae - [ValueTracking] Check likely to be canonicalized constant operands first in ; NFC
Noah Goldstein via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 12:45:50 PDT 2023
Author: Noah Goldstein
Date: 2023-08-09T14:42:55-05:00
New Revision: 035aaae45cf42ed469e4cb60001307ecbeebd947
URL: https://github.com/llvm/llvm-project/commit/035aaae45cf42ed469e4cb60001307ecbeebd947
DIFF: https://github.com/llvm/llvm-project/commit/035aaae45cf42ed469e4cb60001307ecbeebd947.diff
LOG: [ValueTracking] Check likely to be canonicalized constant operands first in ; NFC
Checking operands that a likely to be canonicalized constants first makes sense
from a compile time perspective as it puts whats expected to be a cheaper check first.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D157313
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 936bddfcdbdd11..aa1514129f5d3c 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2061,8 +2061,8 @@ bool isKnownToBeAPowerOfTwo(const Value *V, bool OrZero, unsigned Depth,
case Instruction::And:
if (OrZero) {
// A power of two and'd with anything is a power of two or zero.
- if (isKnownToBeAPowerOfTwo(I->getOperand(0), /*OrZero*/ true, Depth, Q) ||
- isKnownToBeAPowerOfTwo(I->getOperand(1), /*OrZero*/ true, Depth, Q))
+ if (isKnownToBeAPowerOfTwo(I->getOperand(1), /*OrZero*/ true, Depth, Q) ||
+ isKnownToBeAPowerOfTwo(I->getOperand(0), /*OrZero*/ true, Depth, Q))
return true;
// X & (-X) is always a power of two or zero.
if (match(I->getOperand(0), m_Neg(m_Specific(I->getOperand(1)))) ||
More information about the llvm-commits
mailing list