fix lowering of LLVM's 'fcmp true/false'
MODIFY
ir/instr.cpp
ir/instr.cpp
@@ -2262,6 +2262,8 @@ void FCmp::print(ostream &os) const {
case ULE: condtxt = "ule "; break;
case UNE: condtxt = "une "; break;
case UNO: condtxt = "uno "; break;
+ case TRUE: condtxt = "true "; break;
+ case FALSE: condtxt = "false "; break;
}
os << getName() << " = fcmp " << fmath << condtxt << *a << ", "
<< b->getName();
@@ -2288,6 +2290,8 @@ StateValue FCmp::toSMT(State &s) const {
case ULE: return a.fule(b);
case UNE: return a.fune(b);
case UNO: return a.funo(b);
+ case TRUE: return expr(true);
+ case FALSE: return expr(false);
}
UNREACHABLE();
};

MODIFY
ir/instr.h
ir/instr.h
@@ -358,7 +358,7 @@ public:
class FCmp final : public Instr {
public:
enum Cond { OEQ, OGT, OGE, OLT, OLE, ONE, ORD,
- UEQ, UGT, UGE, ULT, ULE, UNE, UNO };
+ UEQ, UGT, UGE, ULT, ULE, UNE, UNO, TRUE, FALSE };
private:
Value *a, *b;

MODIFY
llvm_util/llvm2alive.cpp
llvm_util/llvm2alive.cpp
@@ -444,16 +444,8 @@ public:
case llvm::CmpInst::FCMP_ULE: cond = FCmp::ULE; break;
case llvm::CmpInst::FCMP_UNE: cond = FCmp::UNE; break;
case llvm::CmpInst::FCMP_UNO: cond = FCmp::UNO; break;
- case llvm::CmpInst::FCMP_TRUE: {
- auto tru = get_operand(llvm::ConstantInt::getTrue(i.getType()));
- RETURN_IDENTIFIER(make_unique<UnaryOp>(*ty, value_name(i), *tru,
- UnaryOp::Copy));
- }
- case llvm::CmpInst::FCMP_FALSE: {
- auto fals = get_operand(llvm::ConstantInt::getFalse(i.getType()));
- RETURN_IDENTIFIER(make_unique<UnaryOp>(*ty, value_name(i), *fals,
- UnaryOp::Copy));
- }
+ case llvm::CmpInst::FCMP_TRUE: cond = FCmp::TRUE; break;
+ case llvm::CmpInst::FCMP_FALSE: cond = FCmp::FALSE; break;
default:
UNREACHABLE();
}

fix lowering of LLVM's 'fcmp true/false'
https://reviews.llvm.org/D121243