mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Implement xform: (X != 0) -> (bool)X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6506 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d6404f762
commit
074d84c746
@ -682,6 +682,9 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
|
|||||||
// integers at the end of their ranges...
|
// integers at the end of their ranges...
|
||||||
//
|
//
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
|
||||||
|
if (CI->isNullValue() && I.getOpcode() == Instruction::SetNE)
|
||||||
|
return new CastInst(Op0, Type::BoolTy, I.getName());
|
||||||
|
|
||||||
// Check to see if we are comparing against the minimum or maximum value...
|
// Check to see if we are comparing against the minimum or maximum value...
|
||||||
if (CI->isMinValue()) {
|
if (CI->isMinValue()) {
|
||||||
if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE
|
if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE
|
||||||
|
Loading…
Reference in New Issue
Block a user