Skip to content

Commit f1dc1e9

Browse files
committed
Revert "Add support for samesign flag (AliveToolkit#1098)"
This reverts commit faf59b5.
1 parent a472517 commit f1dc1e9

File tree

4 files changed

+8
-28
lines changed

4 files changed

+8
-28
lines changed

ir/instr.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,11 +2647,8 @@ InlineAsm::InlineAsm(Type &type, string &&name, const string &asm_str,
26472647
std::move(attrs)) {}
26482648

26492649

2650-
ICmp::ICmp(Type &type, string &&name, Cond cond, Value &a, Value &b,
2651-
unsigned flags)
2652-
: Instr(type, std::move(name)), a(&a), b(&b), cond(cond), flags(flags),
2653-
defined(cond != Any) {
2654-
assert((flags & SameSign) == flags);
2650+
ICmp::ICmp(Type &type, string &&name, Cond cond, Value &a, Value &b)
2651+
: Instr(type, std::move(name)), a(&a), b(&b), cond(cond), defined(cond != Any) {
26552652
if (!defined)
26562653
cond_name = getName() + "_cond";
26572654
}
@@ -2699,10 +2696,7 @@ void ICmp::print(ostream &os) const {
26992696
case UGT: condtxt = "ugt "; break;
27002697
case Any: condtxt = ""; break;
27012698
}
2702-
os << getName() << " = icmp ";
2703-
if (flags & SameSign)
2704-
os << "samesign ";
2705-
os << condtxt << *a << ", " << b->getName();
2699+
os << getName() << " = icmp " << condtxt << *a << ", " << b->getName();
27062700
switch (pcmode) {
27072701
case INTEGRAL: break;
27082702
case PROVENANCE: os << ", use_provenance"; break;
@@ -2729,7 +2723,7 @@ StateValue ICmp::toSMT(State &s) const {
27292723
auto &b_eval = s[*b];
27302724

27312725
function<expr(const expr&, const expr&, Cond)> fn =
2732-
[](auto &av, auto &bv, Cond cond) {
2726+
[&](auto &av, auto &bv, Cond cond) {
27332727
switch (cond) {
27342728
case EQ: return av == bv;
27352729
case NE: return av != bv;
@@ -2771,8 +2765,7 @@ StateValue ICmp::toSMT(State &s) const {
27712765
auto scalar = [&](const StateValue &a, const StateValue &b) -> StateValue {
27722766
auto fn2 = [&](Cond c) { return fn(a.value, b.value, c); };
27732767
auto v = cond != Any ? fn2(cond) : build_icmp_chain(cond_var(), fn2);
2774-
auto np = flags & SameSign ? a.value.sign() == b.value.sign() : true;
2775-
return { v.toBVBool(), a.non_poison && b.non_poison && np };
2768+
return { v.toBVBool(), a.non_poison && b.non_poison };
27762769
};
27772770

27782771
auto &elem_ty = a->getType();
@@ -2796,7 +2789,7 @@ expr ICmp::getTypeConstraints(const Function &f) const {
27962789
}
27972790

27982791
unique_ptr<Instr> ICmp::dup(Function &f, const string &suffix) const {
2799-
return make_unique<ICmp>(getType(), getName() + suffix, cond, *a, *b, flags);
2792+
return make_unique<ICmp>(getType(), getName() + suffix, cond, *a, *b);
28002793
}
28012794

28022795

ir/instr.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,20 +427,17 @@ class ICmp final : public Instr {
427427
PROVENANCE, // compare pointer provenance & offsets
428428
OFFSETONLY // cmp ofs only. meaningful only when ptrs are based on same obj
429429
};
430-
enum Flags { None = 0, SameSign = 1 << 0 };
431430

432431
private:
433432
Value *a, *b;
434433
std::string cond_name;
435434
Cond cond;
436-
unsigned flags;
437435
bool defined;
438436
PtrCmpMode pcmode = INTEGRAL;
439437
smt::expr cond_var() const;
440438

441439
public:
442-
ICmp(Type &type, std::string &&name, Cond cond, Value &a, Value &b,
443-
unsigned flags = None);
440+
ICmp(Type &type, std::string &&name, Cond cond, Value &a, Value &b);
444441

445442
bool isPtrCmp() const;
446443
PtrCmpMode getPtrCmpMode() const { return pcmode; }

llvm_util/llvm2alive.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ class llvm2alive_ : public llvm::InstVisitor<llvm2alive_, unique_ptr<Instr>> {
514514
default:
515515
UNREACHABLE();
516516
}
517-
return make_unique<ICmp>(*ty, value_name(i), cond, *a, *b,
518-
i.hasSameSign() ? ICmp::SameSign : ICmp::None);
517+
return make_unique<ICmp>(*ty, value_name(i), cond, *a, *b);
519518
}
520519

521520
RetTy visitFCmpInst(llvm::FCmpInst &i) {

tests/alive-tv/samesign.srctgt.ll

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)