mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Revert r170020, "Simplify negated bit test", for now.
This assumes (1 << n) is always not zero. Consider n is greater than word size. Although I know it is undefined, this transforms undefined behavior hidden. This led clang unexpected behavior with some failures. I will investigate to fix undefined shl in clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2034,15 +2034,6 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
CI->countTrailingZeros()));
|
||||
}
|
||||
|
||||
// Turn x&~y == 0 into x&y != 0 if x is a power of 2.
|
||||
Value *X = 0, *Y = 0;
|
||||
if (match(Op0, m_And(m_Value(X), m_Not(m_Value(Y)))) &&
|
||||
match(Op1, m_Zero()) && isKnownToBeAPowerOfTwo(X, TD)) {
|
||||
return new ICmpInst(ICmpInst::ICMP_NE,
|
||||
Builder->CreateAnd(X, Y),
|
||||
Op1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ICmpInst::ICMP_NE: {
|
||||
@@ -2080,15 +2071,6 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
CI->countTrailingZeros()));
|
||||
}
|
||||
|
||||
// Turn x&~y != 0 into x&y == 0 if x is a power of 2.
|
||||
Value *X = 0, *Y = 0;
|
||||
if (match(Op0, m_And(m_Value(X), m_Not(m_Value(Y)))) &&
|
||||
match(Op1, m_Zero()) && isKnownToBeAPowerOfTwo(X, TD)) {
|
||||
return new ICmpInst(ICmpInst::ICMP_EQ,
|
||||
Builder->CreateAnd(X, Y),
|
||||
Op1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ICmpInst::ICMP_ULT:
|
||||
|
||||
Reference in New Issue
Block a user