Skip to content

Commit

Permalink
[X86] FindSingleBitChange - reduce scope of dyn_cast checks. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
RKSimon committed Aug 8, 2024
1 parent 4d2009c commit 9ddff0b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30529,8 +30529,7 @@ enum BitTestKind : unsigned {
static std::pair<Value *, BitTestKind> FindSingleBitChange(Value *V) {
using namespace llvm::PatternMatch;
BitTestKind BTK = UndefBit;
auto *C = dyn_cast<ConstantInt>(V);
if (C) {
if (auto *C = dyn_cast<ConstantInt>(V)) {
// Check if V is a power of 2 or NOT power of 2.
if (isPowerOf2_64(C->getZExtValue()))
BTK = ConstantBit;
Expand All @@ -30540,8 +30539,7 @@ static std::pair<Value *, BitTestKind> FindSingleBitChange(Value *V) {
}

// Check if V is some power of 2 pattern known to be non-zero
auto *I = dyn_cast<Instruction>(V);
if (I) {
if (auto *I = dyn_cast<Instruction>(V)) {
bool Not = false;
// Check if we have a NOT
Value *PeekI;
Expand Down

0 comments on commit 9ddff0b

Please sign in to comment.