mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 12:15:46 +00:00
Fix a tautological comparison bug caught during post-commit
This amends fd874e5fb1
to correctly set
the bit width of a '!' operator to be the same width as an 'int'. This
fixes a failed assertion about unexpected bit widths that was reported
during post-commit testing.
This commit is contained in:
parent
8dd3ff62f5
commit
96a79cb308
@ -1002,7 +1002,7 @@ private:
|
||||
if (BuildOpts.Observer)
|
||||
BuildOpts.Observer->compareBitwiseEquality(B,
|
||||
B->getOpcode() != BO_EQ);
|
||||
TryResult(B->getOpcode() != BO_EQ);
|
||||
return TryResult(B->getOpcode() != BO_EQ);
|
||||
}
|
||||
} else if (BoolExpr->isKnownToHaveBooleanValue()) {
|
||||
if ((*IntLiteral1 == 1) || (*IntLiteral1 == 0)) {
|
||||
@ -1041,7 +1041,7 @@ private:
|
||||
case UO_Not:
|
||||
return ~Value;
|
||||
case UO_LNot:
|
||||
return llvm::APInt(Value.getBitWidth(), !Value);
|
||||
return llvm::APInt(Context->getTypeSize(Context->IntTy), !Value);
|
||||
default:
|
||||
assert(false && "Unexpected unary operator!");
|
||||
return llvm::None;
|
||||
|
@ -91,6 +91,8 @@ void f(int x) {
|
||||
if ((x | mydefine2) == 4) {}
|
||||
|
||||
if ((x & 1) == 1L) {}
|
||||
|
||||
if (0 != (x | !0LL)) {} // expected-warning {{bitwise comparison always evaluates to true}}
|
||||
}
|
||||
|
||||
void g(int x) {
|
||||
|
Loading…
Reference in New Issue
Block a user