Skip to content

Commit

Permalink
Always feed getGuesses() with Vars in LHS, add a switch for big query…
Browse files Browse the repository at this point in the history
… and enable the ctpop test case
  • Loading branch information
zhengyang92 committed Oct 3, 2018
1 parent 6c5baca commit 76e2ab9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Infer/ExhaustiveSynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace {
"The larger the number is, the more fine-grained debug "
"information will be printed"),
cl::init(0));
static cl::opt<bool> NoBigQuery("souper-exhaustive-synthesis-no-big-query",
cl::desc("Disable big query in exhaustive synthesis (default=false)"),
cl::init(true));
}

// TODO
Expand Down Expand Up @@ -365,8 +368,12 @@ ExhaustiveSynthesis::synthesize(SMTLIBSolver *SMTSolver,
const std::vector<InstMapping> &PCs,
Inst *LHS, Inst *&RHS,
InstContext &IC, unsigned Timeout) {
std::vector<Inst *> Inputs;
findCands(LHS, Inputs, /*WidthMustMatch=*/false, /*FilterVars=*/false, MaxLHSCands);
std::vector<Inst *> Vars;
findVars(LHS, Vars);

std::vector<Inst *> Inputs(Vars);
findCands(LHS, Inputs, /*WidthMustMatch=*/false, /*FilterVars=*/true, MaxLHSCands);

if (DebugLevel > 1)
llvm::errs() << "got " << Inputs.size() << " candidates from LHS\n";

Expand All @@ -388,7 +395,7 @@ ExhaustiveSynthesis::synthesize(SMTLIBSolver *SMTSolver,

// Big Query
// TODO: Need to check if big query actually saves us time or just wastes time
{
if (!NoBigQuery) {
Inst *Ante = IC.getConst(APInt(1, true));
BlockPCs BPCsCopy;
std::vector<InstMapping> PCsCopy;
Expand Down Expand Up @@ -468,9 +475,6 @@ ExhaustiveSynthesis::synthesize(SMTLIBSolver *SMTSolver,
}
}

std::vector<Inst *> Vars;
findVars(LHS, Vars);

std::map<Inst *, std::vector<llvm::APInt>> TriedVars;
std::map<Inst *, llvm::APInt> ConstMap;

Expand Down
2 changes: 2 additions & 0 deletions test/Infer/popcount6-syn.opt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
; REQUIRES: solver, solver-model

; RUN: %souper-check %solver -infer-rhs -souper-infer-inst -souper-synthesis-comps=ctpop %s > %t1
; RUN: %souper-check %solver -infer-rhs -souper-exhaustive-synthesis -souper-exhaustive-synthesis-no-big-query %s > %t2
; RUN: %FileCheck %s < %t1
; RUN: %FileCheck %s < %t2

; CHECK: %21:i32 = ctpop %0
; CHECK-NEXT: result %21
Expand Down

0 comments on commit 76e2ab9

Please sign in to comment.