Skip to content

Commit 3c25084

Browse files
committed
Add environment variables to control loop unroll
e.g. ```bash export ALIVECC_SRC_UNROLL=10 export ALIVECC_TGT_UNROLL=10 ``` That allows alivecc to verify `-O2` for ```cpp int main() { for (int i = 0; i < 2; ++i) { if (i == 3) return 1; } return 2; } ```
1 parent d89fd17 commit 3c25084

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/alivecc.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ if (compiling()) {
108108
push @ARGV, ("-mllvm", "-tv-save-ir");
109109
}
110110

111+
if (my $unroll = getenv("ALIVECC_SRC_UNROLL")) {
112+
push @ARGV, ("-mllvm", "-tv-src-unroll=".$unroll);
113+
}
114+
115+
if (my $unroll = getenv("ALIVECC_TGT_UNROLL")) {
116+
push @ARGV, ("-mllvm", "-tv-tgt-unroll=".$unroll);
117+
}
118+
111119
# sanity check: make sure we intercepted all environment variables
112120
# of the form ALIVECC_*
113121
foreach my $e (keys %ENV) {

0 commit comments

Comments
 (0)