mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-07 11:16:42 +01:00
FIX discard unused signals
This commit is contained in:
@@ -81,10 +81,6 @@ async function compile(srcFile, options) {
|
|||||||
throw new Error("A main component must be defined");
|
throw new Error("A main component must be defined");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.verbose) console.log("Classify Signals");
|
|
||||||
measures.classifySignals = -performance.now();
|
|
||||||
classifySignals(ctx);
|
|
||||||
measures.classifySignals += performance.now();
|
|
||||||
|
|
||||||
if (ctx.verbose) console.log("Reduce Constants");
|
if (ctx.verbose) console.log("Reduce Constants");
|
||||||
measures.reduceConstants = -performance.now();
|
measures.reduceConstants = -performance.now();
|
||||||
@@ -108,9 +104,13 @@ async function compile(srcFile, options) {
|
|||||||
measures.reduceConstraints += performance.now();
|
measures.reduceConstraints += performance.now();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.verbose) console.log("NConstraints After: "+ctx.constraints.length);
|
if (ctx.verbose) console.log("NConstraints After: "+ctx.constraints.length);
|
||||||
|
|
||||||
|
if (ctx.verbose) console.log("Classify Signals");
|
||||||
|
measures.classifySignals = -performance.now();
|
||||||
|
classifySignals(ctx);
|
||||||
|
measures.classifySignals += performance.now();
|
||||||
|
|
||||||
measures.generateWitnessNames = -performance.now();
|
measures.generateWitnessNames = -performance.now();
|
||||||
generateWitnessNames(ctx);
|
generateWitnessNames(ctx);
|
||||||
measures.generateWitnessNames += performance.now();
|
measures.generateWitnessNames += performance.now();
|
||||||
@@ -462,7 +462,6 @@ async function reduceConstrains(ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sig2constraint[s] = null;
|
sig2constraint[s] = null;
|
||||||
lSignal.c = ctx.stDISCARDED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -496,7 +495,12 @@ async function reduceConstrains(ctx) {
|
|||||||
for (let k in l.coefs) {
|
for (let k in l.coefs) {
|
||||||
k = Number(k);
|
k = Number(k);
|
||||||
const signal = ctx.signals[k];
|
const signal = ctx.signals[k];
|
||||||
if ((signal.c == ctx.stINTERNAL)&&(!ctx.F.isZero(l.coefs[k])) &&(!removedSignals[k])) return k;
|
if ( ( ((signal.o & ctx.MAIN) == 0)
|
||||||
|
||( ((signal.o & ctx.IN) == 0)
|
||||||
|
&&((signal.o & ctx.OUT) == 0)))
|
||||||
|
&&((signal.o & ctx.ONE) ==0)
|
||||||
|
&&(!ctx.F.isZero(l.coefs[k]))
|
||||||
|
&&(!removedSignals[k])) return k;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,10 +428,17 @@ function execAssignement(ctx, ast) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip if an out is assigned directly to an input.
|
// Skip if an out is assigned directly to an input.
|
||||||
if ((!isIn)||(!isOut)) {
|
if (!(isIn&&isOut)) {
|
||||||
sDest.e = sIdx;
|
if (isIn) {
|
||||||
} else {
|
sDest.e = sIdx;
|
||||||
if (utils.isDefined(sSrc.v)) sDest.v = sSrc.v;
|
} else if (isOut) {
|
||||||
|
sSrc.e = dIdx;
|
||||||
|
} else {
|
||||||
|
sDest.e = sIdx;
|
||||||
|
}
|
||||||
|
if (!isOut) {
|
||||||
|
if (utils.isDefined(sSrc.v)) sDest.v = sSrc.v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user