-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Hello,
I get the error below with the following synthesis commands and program below:
commands:
set-src ../myfunc.c
set-clock-period 23
compile --buffer-algorithm fpl22
write-hdl --hdl verilog
Dynamatic version used: 8074f73
error:
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data//workspace/dynamatic/bin/opt -S -passes=inline,mem2reg,consthoist,instcombine,function(loop-mssa(licm<no-allowspeculation>)),function(loop(loop-idiom,indvars,loop-deletion)),simplifycfg,loop-rotate,simplifycfg,sink,lowerswitch,simplifycfg,dce /home//myfunc/synth/../out/comp/clang.ll
Program (compiles with gcc for x86):
// var_0_secret
// Modified from WolfSSL
typedef unsigned char byte;
typedef unsigned short word16;
#define F25519_SIZE 32
// void fe_normalize(byte *x)
int myfunc (byte var_0_secret)
{
byte minusp[F25519_SIZE];
word16 c;
int i;
// The original argument, filling it with some random secret-dependent data
unsigned char x[32];
for (i = 0; i < 32; i++) {
x[i] = (unsigned char)(i + var_0_secret);
}
// The original function
/* Reduce using 2^255 = 19 mod p */
c = (x[31] >> 7) * 19;
x[31] &= 127;
for (i = 0; i < F25519_SIZE; i++) {
c += x[i];
x[i] = (byte)c;
c >>= 8;
}
/* The number is now less than 2^255 + 18, and therefore less than
* 2p. Try subtracting p, and conditionally load the subtracted
* value if underflow did not occur.
*/
c = 19;
for (i = 0; i + 1 < F25519_SIZE; i++) {
c += x[i];
minusp[i] = (byte)c;
c >>= 8;
}
c += ((word16)x[i]) - 128;
minusp[31] = (byte)c;
/* Load x-p if no underflow */
// fe_select(x, minusp, x, (c >> 15) & 1);
// inlining it:
const byte mask = -(c >> 15) & 1;
for (i = 0; i < F25519_SIZE; i++)
x[i] = minusp[i] ^ (mask & (x[i] ^ minusp[i]));
// Some dummy code to make sure the result is not optimized away
int result = 0;
for (i = 0; i < 32; i++)
result += x[i];
return result;
}
#include <stdlib.h>
#include "dynamatic/Integration.h"
int main(void) {
unsigned char fn_arg_0_secret = rand() % 8;
CALL_KERNEL(myfunc,fn_arg_0_secret);
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels