From 591e4896f5061335470fac5f4b75fcbc43c769b5 Mon Sep 17 00:00:00 2001 From: Byeongjee Kang Date: Mon, 24 Aug 2026 13:40:04 -0400 Subject: [PATCH 1/3] Re-measure chunk-only overhead at 10uF --- results/chunking_overhead/chunked.csv | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/results/chunking_overhead/chunked.csv b/results/chunking_overhead/chunked.csv index 431ebf6..4cf5028 100644 --- a/results/chunking_overhead/chunked.csv +++ b/results/chunking_overhead/chunked.csv @@ -1,14 +1,14 @@ -benchmark,capacitor,status,compilation_time_ms,execution_time_us,run_attempts -aes,10uF,ok,1242,104204.13,1 -crc,10uF,ok,781,29759.3,1 -rsa,10uF,ok,849,45171.49,1 -dijkstra,10uF,ok,737,217308.64,1 -qsort,10uF,ok,791,1044367.77,1 -activity_recognition,10uF,ok,964,33727.52,1 -bitcount,10uF,ok,1288,4414158.76,1 -chacha20,10uF,ok,1221,50808.98,1 -sensor_fusion,10uF,ok,859,25121.86,1 -poly1305,10uF,ok,923,475356.64,1 -cuckoo_filter,10uF,ok,761,41320.7,1 -sha256,10uF,ok,1388,90038.68,1 -stringsearch,10uF,ok,684,36199.73,1 +benchmark,capacitor,status,compilation_time_ms,execution_time_us,run_attempts +aes,10uF,ok,1505,104208.34,1 +crc,10uF,ok,754,29731.2,1 +rsa,10uF,ok,1235,44194.47,1 +dijkstra,10uF,ok,745,223243.68,1 +qsort,10uF,ok,753,1044364.16,1 +activity_recognition,10uF,ok,3247,33693.67,1 +bitcount,10uF,ok,1377,4428974.03,1 +chacha20,10uF,ok,1575,50808.39,1 +sensor_fusion,10uF,ok,970,25134.98,1 +poly1305,10uF,ok,1083,475324.33,1 +cuckoo_filter,10uF,ok,726,42792.49,1 +sha256,10uF,ok,1451,90023.65,1 +stringsearch,10uF,ok,699,36199.28,1 From cafde56be11cf358db00414acff635319ffa4361 Mon Sep 17 00:00:00 2001 From: Byeongjee Kang Date: Mon, 24 Aug 2026 13:40:04 -0400 Subject: [PATCH 2/3] Remove benchmarks outside the evaluated set --- .../intermittent/activity_recognition_na.c | 268 ----------- benchmarks/intermittent/aes_na.c | 398 ---------------- benchmarks/intermittent/basicmath.c | 160 ------- benchmarks/intermittent/bitcount_na.c | 176 ------- benchmarks/intermittent/crc_na.c | 129 ------ benchmarks/intermittent/dijkstra_na.c | 172 ------- benchmarks/intermittent/ecc.c | 438 ------------------ benchmarks/intermittent/fft.c | 196 -------- .../pathological_milp_vs_schematic.c | 54 --- benchmarks/intermittent/qsort_na.c | 75 --- benchmarks/intermittent/rsa_na.c | 319 ------------- benchmarks/intermittent/test.c | 28 -- scripts/plot_results.R | 3 +- 13 files changed, 1 insertion(+), 2415 deletions(-) delete mode 100644 benchmarks/intermittent/activity_recognition_na.c delete mode 100644 benchmarks/intermittent/aes_na.c delete mode 100644 benchmarks/intermittent/basicmath.c delete mode 100644 benchmarks/intermittent/bitcount_na.c delete mode 100644 benchmarks/intermittent/crc_na.c delete mode 100644 benchmarks/intermittent/dijkstra_na.c delete mode 100644 benchmarks/intermittent/ecc.c delete mode 100644 benchmarks/intermittent/fft.c delete mode 100644 benchmarks/intermittent/pathological_milp_vs_schematic.c delete mode 100644 benchmarks/intermittent/qsort_na.c delete mode 100644 benchmarks/intermittent/rsa_na.c delete mode 100644 benchmarks/intermittent/test.c diff --git a/benchmarks/intermittent/activity_recognition_na.c b/benchmarks/intermittent/activity_recognition_na.c deleted file mode 100644 index 763c166..0000000 --- a/benchmarks/intermittent/activity_recognition_na.c +++ /dev/null @@ -1,268 +0,0 @@ -#include "benchmark.h" -#include "loop_tripcount.h" -#include -#include -#include - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -// Algorithm Constants -#define NUM_WARMUP_SAMPLES 3 -#define ACCEL_WINDOW_SIZE 3 -#define MODEL_SIZE 16 -#define SAMPLE_NOISE_FLOOR 10 -#define SAMPLES_TO_COLLECT 64 // Reduced for faster demo loop - -static uint16_t lfsr_state __attribute__((section(".fram"))); - -FORCE_INLINE uint16_t simple_rand(void) { - // If the last bit is 1, shift and XOR. If 0, just shift. - // 0xB400 is the tap configuration for a 16-bit maximal-length LFSR - if (lfsr_state & 1) { - lfsr_state = (lfsr_state >> 1) ^ 0xB400u; - } else { - lfsr_state >>= 1; - } - return lfsr_state; -} - -// --- Data Types --- - -// struct from libadxl362 -typedef struct { - int8_t x; - int8_t y; - int8_t z; -} threeAxis_t_8; - -typedef threeAxis_t_8 accelReading; -typedef accelReading accelWindow[ACCEL_WINDOW_SIZE]; - -typedef struct { - unsigned meanmag; - unsigned stddevmag; -} features_t; - -typedef enum { - CLASS_STATIONARY, - CLASS_MOVING, -} class_t; - -typedef struct { - features_t stationary[MODEL_SIZE]; - features_t moving[MODEL_SIZE]; -} model_t; - -typedef struct { - unsigned totalCount; - unsigned movingCount; - unsigned stationaryCount; -} stats_t; - -// --- Helper Functions --- - -// Integer Square Root (Replaces libmspmath) -FORCE_INLINE unsigned sqrt16(unsigned long n) { - unsigned long c = 0x8000; - unsigned long g = 0x8000; - for (;;) { - if (g * g > n) - g ^= c; - c >>= 1; - if (c == 0) - return g; - g |= c; - } -} - -// --- Sensor Abstraction (Mock Data) --- - -static int mock_scenario __attribute__((section(".fram"))); - -FORCE_INLINE void ACCEL_init() { - // Real sensor init would go here -} - -FORCE_INLINE void accel_sample(accelReading *sample) { - // Generate synthetic data based on current scenario - if (mock_scenario == 0) { - // Stationary: Small noise near 0 - sample->x = (simple_rand() % 4) - 2; - sample->y = (simple_rand() % 4) - 2; - sample->z = (simple_rand() % 4) - 2; - } else { - // Moving: Large spikes - sample->x = (simple_rand() % 60) - 30; - sample->y = (simple_rand() % 60) - 30; - sample->z = (simple_rand() % 60) - 30; - } -} - -// --- Core Algorithm Logic --- - -FORCE_INLINE void acquire_window(accelWindow window) { - accelReading sample; - unsigned samplesInWindow = 0; - - while (samplesInWindow < ACCEL_WINDOW_SIZE) { - accel_sample(&sample); - window[samplesInWindow++] = sample; - } -} - -FORCE_INLINE void transform(accelWindow window) { - unsigned i = 0; - for (i = 0; i < ACCEL_WINDOW_SIZE; i++) { - accelReading *sample = &window[i]; - - // Simple High-pass / Noise gate filter - if (abs(sample->x) < SAMPLE_NOISE_FLOOR) - sample->x = 0; - if (abs(sample->y) < SAMPLE_NOISE_FLOOR) - sample->y = 0; - if (abs(sample->z) < SAMPLE_NOISE_FLOOR) - sample->z = 0; - } -} - -FORCE_INLINE void featurize(volatile features_t *features, accelWindow aWin) { - long mean_x = 0, mean_y = 0, mean_z = 0; - long std_x = 0, std_y = 0, std_z = 0; - int i; - - // Calculate Mean - for (i = 0; i < ACCEL_WINDOW_SIZE; i++) { - mean_x += aWin[i].x; - mean_y += aWin[i].y; - mean_z += aWin[i].z; - } - mean_x /= ACCEL_WINDOW_SIZE; - mean_y /= ACCEL_WINDOW_SIZE; - mean_z /= ACCEL_WINDOW_SIZE; - - // Calculate Deviation - for (i = 0; i < ACCEL_WINDOW_SIZE; i++) { - std_x += labs(aWin[i].x - mean_x); - std_y += labs(aWin[i].y - mean_y); - std_z += labs(aWin[i].z - mean_z); - } - std_x /= ACCEL_WINDOW_SIZE; - std_y /= ACCEL_WINDOW_SIZE; - std_z /= ACCEL_WINDOW_SIZE; - - unsigned meanmag = mean_x * mean_x + mean_y * mean_y + mean_z * mean_z; - unsigned stddevmag = std_x * std_x + std_y * std_y + std_z * std_z; - - features->meanmag = sqrt16(meanmag); - features->stddevmag = sqrt16(stddevmag); -} - -FORCE_INLINE class_t classify(features_t *features, volatile model_t *model) { - int move_less_error = 0; - int stat_less_error = 0; - volatile features_t *model_features; - int i; - - // Nearest Centroid-ish classification - for (i = 0; i < MODEL_SIZE; ++i) { - model_features = &model->stationary[i]; - long stat_mean_err = labs((long)model_features->meanmag - (long)features->meanmag); - long stat_sd_err = labs((long)model_features->stddevmag - (long)features->stddevmag); - - model_features = &model->moving[i]; - long move_mean_err = labs((long)model_features->meanmag - (long)features->meanmag); - long move_sd_err = labs((long)model_features->stddevmag - (long)features->stddevmag); - - if (move_mean_err < stat_mean_err) - move_less_error++; - else - stat_less_error++; - - if (move_sd_err < stat_sd_err) - move_less_error++; - else - stat_less_error++; - } - - return (move_less_error > stat_less_error) ? CLASS_MOVING : CLASS_STATIONARY; -} - -FORCE_INLINE void warmup_sensor() { - unsigned discarded = 0; - accelReading sample; - while (discarded++ < NUM_WARMUP_SAMPLES) { - accel_sample(&sample); - } -} - -FORCE_INLINE void train(volatile features_t *classModel) { - accelWindow sampleWindow; - features_t features; - unsigned i; - - warmup_sensor(); - - for (i = 0; i < MODEL_SIZE; ++i) { - acquire_window(sampleWindow); - transform(sampleWindow); - featurize(&features, sampleWindow); - classModel[i] = features; - } -} - -FORCE_INLINE unsigned recognize_loop(volatile model_t *model) { - volatile stats_t stats = {0}; - accelWindow sampleWindow; - features_t features; - class_t class; - unsigned i; - - for (i = 0; i < SAMPLES_TO_COLLECT; ++i) { - // Toggle Mock Scenario halfway through - if (i == SAMPLES_TO_COLLECT / 2) { - mock_scenario = !mock_scenario; - } - - acquire_window(sampleWindow); - transform(sampleWindow); - featurize(&features, sampleWindow); - class = classify(&features, model); - - stats.totalCount++; - if (class == CLASS_MOVING) { - stats.movingCount++; - } else { - stats.stationaryCount++; - } - } - - return stats.totalCount; -} - -// --- Main --- - -// Global model storage -volatile model_t global_model; - -__attribute__((noinline)) int main() { - BENCH_INIT(); - lfsr_state = 0xACE1u; - mock_scenario = 0; - - ACCEL_init(); - - // 1. Train "Stationary" - mock_scenario = 0; - train(global_model.stationary); - - // 2. Train "Moving" - mock_scenario = 1; - train(global_model.moving); - - // 3. Recognize - mock_scenario = 0; - unsigned total = recognize_loop(&global_model); - - BENCH_EXIT((int)total); - return (int)total; -} diff --git a/benchmarks/intermittent/aes_na.c b/benchmarks/intermittent/aes_na.c deleted file mode 100644 index 3c79a4a..0000000 --- a/benchmarks/intermittent/aes_na.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * AES-128 CBC - Preprocessed benchmark for intermittent computing. - * Based on tiny-AES-c (public domain). - * Simplified: AES128 CBC only, uint32_t instead of size_t for MSP430. - */ -#include "benchmark.h" -#include "loop_tripcount.h" -#include - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -/* --- AES Configuration (AES-128, CBC only) --- */ - -#define Nb 4 -#define Nk 4 -#define Nr 10 -#define AES_BLOCKLEN 16 -#define AES_KEYLEN 16 -#define AES_keyExpSize 176 -#define AES_BUFFER_BLOCKS 16 -#define AES_BUFFER_LEN (AES_BLOCKLEN * AES_BUFFER_BLOCKS) - -/* --- Types --- */ - -typedef uint8_t state_t[4][4]; - -struct AES_ctx { - uint8_t RoundKey[AES_keyExpSize]; - uint8_t Iv[AES_BLOCKLEN]; -}; - -/* --- Mutable globals --- */ - -struct AES_ctx g_ctx; - -static uint8_t g_key[16] __attribute__((used, section(".fram"))) = { - 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; - -static uint8_t g_iv[16] __attribute__((used, section(".fram"))) = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}; - -uint8_t g_buf[AES_BUFFER_LEN] __attribute__((section(".fram"))); - -/* --- Const data (no annotation) --- */ - -static const uint8_t sbox[256] = { - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; - -static const uint8_t rsbox[256] = { - 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d}; - -static const uint8_t Rcon[11] = {0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; - -/* Repeat the standard 4-block CBC test vector to lengthen the workload - * without changing the benchmark structure. */ -#define AES_TEST_VECTOR_64 \ - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, \ - 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, \ - 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, \ - 0x0a, 0x52, 0xef, 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, \ - 0xe6, 0x6c, 0x37, 0x10 - -static const uint8_t test_data[AES_BUFFER_LEN] = { - AES_TEST_VECTOR_64, - AES_TEST_VECTOR_64, - AES_TEST_VECTOR_64, - AES_TEST_VECTOR_64, -}; - -/* --- Macros --- */ - -#define getSBoxValue(num) (sbox[(num)]) -#define getSBoxInvert(num) (rsbox[(num)]) - -#define Multiply(x, y) \ - (((y & 1) * x) ^ ((y >> 1 & 1) * xtime(x)) ^ ((y >> 2 & 1) * xtime(xtime(x))) ^ \ - ((y >> 3 & 1) * xtime(xtime(xtime(x)))) ^ ((y >> 4 & 1) * xtime(xtime(xtime(xtime(x)))))) - -/* --- Helper Functions --- */ - -FORCE_INLINE uint8_t xtime(uint8_t x) { - return ((x << 1) ^ (((x >> 7) & 1) * 0x1b)); -} - -FORCE_INLINE void KeyExpansion(uint8_t *RoundKey, const uint8_t *Key) { - unsigned i, j, k; - uint8_t tempa[4]; - - /* The first round key is the key itself. */ - for (i = 0; i < Nk; ++i) { - RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; - RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; - RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; - RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; - } - - /* All other round keys are found from the previous round keys. */ - for (i = Nk; i < Nb * (Nr + 1); ++i) { - { - k = (i - 1) * 4; - tempa[0] = RoundKey[k + 0]; - tempa[1] = RoundKey[k + 1]; - tempa[2] = RoundKey[k + 2]; - tempa[3] = RoundKey[k + 3]; - } - - if (i % Nk == 0) { - /* RotWord() */ - { - const uint8_t u8tmp = tempa[0]; - tempa[0] = tempa[1]; - tempa[1] = tempa[2]; - tempa[2] = tempa[3]; - tempa[3] = u8tmp; - } - - /* SubWord() */ - { - tempa[0] = getSBoxValue(tempa[0]); - tempa[1] = getSBoxValue(tempa[1]); - tempa[2] = getSBoxValue(tempa[2]); - tempa[3] = getSBoxValue(tempa[3]); - } - - tempa[0] = tempa[0] ^ Rcon[i / Nk]; - } - - j = i * 4; - k = (i - Nk) * 4; - RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0]; - RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1]; - RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2]; - RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3]; - } -} - -FORCE_INLINE void AddRoundKey(uint8_t round, state_t *state, const uint8_t *RoundKey) { - uint8_t i, j; - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) { - (*state)[i][j] ^= RoundKey[(round * Nb * 4) + (i * Nb) + j]; - } - } -} - -FORCE_INLINE void SubBytes(state_t *state) { - uint8_t i, j; - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) { - (*state)[j][i] = getSBoxValue((*state)[j][i]); - } - } -} - -FORCE_INLINE void InvSubBytes(state_t *state) { - uint8_t i, j; - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) { - (*state)[j][i] = getSBoxInvert((*state)[j][i]); - } - } -} - -FORCE_INLINE void ShiftRows(state_t *state) { - uint8_t temp; - - /* Rotate first row 1 columns to left */ - temp = (*state)[0][1]; - (*state)[0][1] = (*state)[1][1]; - (*state)[1][1] = (*state)[2][1]; - (*state)[2][1] = (*state)[3][1]; - (*state)[3][1] = temp; - - /* Rotate second row 2 columns to left */ - temp = (*state)[0][2]; - (*state)[0][2] = (*state)[2][2]; - (*state)[2][2] = temp; - - temp = (*state)[1][2]; - (*state)[1][2] = (*state)[3][2]; - (*state)[3][2] = temp; - - /* Rotate third row 3 columns to left */ - temp = (*state)[0][3]; - (*state)[0][3] = (*state)[3][3]; - (*state)[3][3] = (*state)[2][3]; - (*state)[2][3] = (*state)[1][3]; - (*state)[1][3] = temp; -} - -FORCE_INLINE void InvShiftRows(state_t *state) { - uint8_t temp; - - /* Rotate first row 1 columns to right */ - temp = (*state)[3][1]; - (*state)[3][1] = (*state)[2][1]; - (*state)[2][1] = (*state)[1][1]; - (*state)[1][1] = (*state)[0][1]; - (*state)[0][1] = temp; - - /* Rotate second row 2 columns to right */ - temp = (*state)[0][2]; - (*state)[0][2] = (*state)[2][2]; - (*state)[2][2] = temp; - - temp = (*state)[1][2]; - (*state)[1][2] = (*state)[3][2]; - (*state)[3][2] = temp; - - /* Rotate third row 3 columns to right */ - temp = (*state)[0][3]; - (*state)[0][3] = (*state)[1][3]; - (*state)[1][3] = (*state)[2][3]; - (*state)[2][3] = (*state)[3][3]; - (*state)[3][3] = temp; -} - -FORCE_INLINE void MixColumns(state_t *state) { - uint8_t i; - uint8_t Tmp, Tm, t; - for (i = 0; i < 4; ++i) { - t = (*state)[i][0]; - Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3]; - Tm = (*state)[i][0] ^ (*state)[i][1]; - Tm = xtime(Tm); - (*state)[i][0] ^= Tm ^ Tmp; - Tm = (*state)[i][1] ^ (*state)[i][2]; - Tm = xtime(Tm); - (*state)[i][1] ^= Tm ^ Tmp; - Tm = (*state)[i][2] ^ (*state)[i][3]; - Tm = xtime(Tm); - (*state)[i][2] ^= Tm ^ Tmp; - Tm = (*state)[i][3] ^ t; - Tm = xtime(Tm); - (*state)[i][3] ^= Tm ^ Tmp; - } -} - -FORCE_INLINE void InvMixColumns(state_t *state) { - int i; - uint8_t a, b, c, d; - for (i = 0; i < 4; ++i) { - a = (*state)[i][0]; - b = (*state)[i][1]; - c = (*state)[i][2]; - d = (*state)[i][3]; - - (*state)[i][0] = - Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); - (*state)[i][1] = - Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); - (*state)[i][2] = - Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); - (*state)[i][3] = - Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); - } -} - -FORCE_INLINE void Cipher(state_t *state, const uint8_t *RoundKey) { - uint8_t round = 0; - - AddRoundKey(0, state, RoundKey); - - for (round = 1;; ++round) { - SubBytes(state); - ShiftRows(state); - if (round == Nr) { - break; - } - MixColumns(state); - AddRoundKey(round, state, RoundKey); - } - AddRoundKey(Nr, state, RoundKey); -} - -FORCE_INLINE void InvCipher(state_t *state, const uint8_t *RoundKey) { - uint8_t round = 0; - - AddRoundKey(Nr, state, RoundKey); - - for (round = (Nr - 1);; --round) { - InvShiftRows(state); - InvSubBytes(state); - AddRoundKey(round, state, RoundKey); - if (round == 0) { - break; - } - InvMixColumns(state); - } -} - -FORCE_INLINE void AES_init_ctx_iv(struct AES_ctx *ctx, const uint8_t *aes_key, const uint8_t *iv) { - KeyExpansion(ctx->RoundKey, aes_key); - __builtin_memcpy(ctx->Iv, iv, AES_BLOCKLEN); -} - -FORCE_INLINE void AES_ctx_set_iv(struct AES_ctx *ctx, const uint8_t *iv) { - __builtin_memcpy(ctx->Iv, iv, AES_BLOCKLEN); -} - -FORCE_INLINE void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint32_t length) { - uint32_t i; - uint8_t j; - - /* First block: XOR with IV from ctx */ - for (j = 0; j < AES_BLOCKLEN; ++j) { - g_buf[j] ^= ctx->Iv[j]; - } - Cipher((state_t *)&g_buf[0], ctx->RoundKey); - - /* Remaining blocks: XOR with previous ciphertext block */ - for (i = AES_BLOCKLEN; i < length; i += AES_BLOCKLEN) { - for (j = 0; j < AES_BLOCKLEN; ++j) { - g_buf[i + j] ^= g_buf[i - AES_BLOCKLEN + j]; - } - Cipher((state_t *)&g_buf[i], ctx->RoundKey); - } - - /* Store last block as IV for next call */ - for (j = 0; j < AES_BLOCKLEN; ++j) { - ctx->Iv[j] = g_buf[length - AES_BLOCKLEN + j]; - } -} - -FORCE_INLINE void AES_CBC_decrypt_buffer(struct AES_ctx *ctx, uint32_t length) { - uint32_t i; - uint8_t j; - uint8_t storeNextIv[AES_BLOCKLEN]; - - for (i = 0; i < length; i += AES_BLOCKLEN) { - /* Save ciphertext for next IV */ - for (j = 0; j < AES_BLOCKLEN; ++j) { - storeNextIv[j] = g_buf[i + j]; - } - InvCipher((state_t *)&g_buf[i], ctx->RoundKey); - /* XOR with current IV */ - for (j = 0; j < AES_BLOCKLEN; ++j) { - g_buf[i + j] ^= ctx->Iv[j]; - } - /* Update IV */ - for (j = 0; j < AES_BLOCKLEN; ++j) { - ctx->Iv[j] = storeNextIv[j]; - } - } -} - -/* --- Main --- */ - -__attribute__((noinline)) int main(void) { - BENCH_INIT(); - int i; - - /* Copy test data to working buffer */ - for (i = 0; i < AES_BUFFER_LEN; i++) { - g_buf[i] = test_data[i]; - } - - /* Encrypt */ - AES_init_ctx_iv(&g_ctx, g_key, g_iv); - AES_CBC_encrypt_buffer(&g_ctx, AES_BUFFER_LEN); - - /* Decrypt */ - AES_ctx_set_iv(&g_ctx, g_iv); - AES_CBC_decrypt_buffer(&g_ctx, AES_BUFFER_LEN); - - BENCH_EXIT((int)g_buf[0]); - return (int)g_buf[0]; -} diff --git a/benchmarks/intermittent/basicmath.c b/benchmarks/intermittent/basicmath.c deleted file mode 100644 index 5d53c6a..0000000 --- a/benchmarks/intermittent/basicmath.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Basic math benchmark adapted from ulswap-bench/src/basicmath. - * Single-file form for intermittent checkpoint insertion analysis. - */ - -#include -#include - -#include "benchmark.h" -#include "loop_tripcount.h" - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -#define PI_CONST 3.14159265358979323846 -#define BITSPERNUM (sizeof(uint32_t) * 8U) -#define TOP2BITS(x) (((x) & (3UL << (BITSPERNUM - 2U))) >> (BITSPERNUM - 2U)) - -typedef struct { - uint32_t sqrt; - uint32_t frac; -} int_sqrt_t; - -static double g_accum __attribute__((section(".fram"))) = 0.0; -static int_sqrt_t g_last_sqrt __attribute__((used)); - -FORCE_INLINE void solve_cubic(double a, double b, double c, double d, uint32_t *solutions, - double *x) { - double a1 = b / a; - double a2 = c / a; - double a3 = d / a; - double Q = (a1 * a1 - 3.0 * a2) / 9.0; - double R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0; - double R2_Q3 = R * R - Q * Q * Q; - - if (R2_Q3 <= 0.0) { - double theta = acos(R / sqrt(Q * Q * Q)); - *solutions = 3; - x[0] = -2.0 * sqrt(Q) * cos(theta / 3.0) - a1 / 3.0; - x[1] = -2.0 * sqrt(Q) * cos((theta + 2.0 * PI_CONST) / 3.0) - a1 / 3.0; - x[2] = -2.0 * sqrt(Q) * cos((theta + 4.0 * PI_CONST) / 3.0) - a1 / 3.0; - } else { - *solutions = 1; - x[0] = pow(sqrt(R2_Q3) + fabs(R), 1.0 / 3.0); - x[0] += Q / x[0]; - x[0] *= (R < 0.0) ? 1.0 : -1.0; - x[0] -= a1 / 3.0; - } -} - -FORCE_INLINE void usqrt(uint32_t x, int_sqrt_t *q) { - uint32_t a = 0; - uint32_t r = 0; - uint32_t e = 0; - uint32_t i; - - for (i = 0; i < BITSPERNUM; i++) { - __loop_tripcount(BITSPERNUM); - r = (r << 2U) + TOP2BITS(x); - x <<= 2U; - a <<= 1U; - e = (a << 1U) + 1U; - if (r >= e) { - r -= e; - a++; - } - } - - q->sqrt = a; - q->frac = r; -} - -FORCE_INLINE double rad2deg(double rad) { - return (180.0 * rad / PI_CONST); -} - -FORCE_INLINE double deg2rad(double deg) { - return (PI_CONST * deg / 180.0); -} - -int main(void) { - BENCH_INIT(); - double a1 = 1.0; - double b1 = -10.5; - double c1 = 32.0; - double d1 = -30.0; - - double a2 = 1.0; - double b2 = -4.5; - double c2 = 17.0; - double d2 = -30.0; - - double a3 = 1.0; - double b3 = -3.5; - double c3 = 22.0; - double d3 = -31.0; - - double a4 = 1.0; - double b4 = -13.7; - double c4 = 1.0; - double d4 = -35.0; - - double x[3] = {0.0, 0.0, 0.0}; - double X; - uint32_t solutions = 0; - uint32_t i; - int_sqrt_t q; - volatile double accum = 0.0; - - solve_cubic(a1, b1, c1, d1, &solutions, x); - accum += x[0]; - if (solutions > 1U) { - accum += x[1] + x[2]; - } - - solve_cubic(a2, b2, c2, d2, &solutions, x); - accum += x[0]; - - solve_cubic(a3, b3, c3, d3, &solutions, x); - accum += x[0]; - - solve_cubic(a4, b4, c4, d4, &solutions, x); - accum += x[0]; - - for (a1 = 1.0; a1 < 7.0; a1 += 1.0) { - __loop_tripcount(6); - for (b1 = 8.0; b1 > 0.0; b1 -= 1.0) { - __loop_tripcount(8); - for (c1 = 8.0; c1 < 12.0; c1 += 0.5) { - __loop_tripcount(8); - for (d1 = -1.0; d1 > -8.0; d1 -= 1.0) { - __loop_tripcount(7); - solve_cubic(a1, b1, c1, d1, &solutions, x); - accum += x[0]; - } - } - } - } - - for (i = 0; i < 1001U; ++i) { - __loop_tripcount(1001); - usqrt(i, &q); - accum += ((double)q.sqrt * 0.0001) + ((double)q.frac * 0.000001); - } - - for (X = 0.0; X <= 360.0; X += 1.0) { - __loop_tripcount(361); - accum += deg2rad(X); - } - - for (X = 0.0; X <= (2.0 * PI_CONST + 1e-6); X += (PI_CONST / 180.0)) { - __loop_tripcount(361); - accum += rad2deg(X); - } - - g_accum = accum; - g_last_sqrt = q; - - BENCH_EXIT((int)(((uint64_t)(accum * 1000.0)) & 0x7FFFFFFF)); - return (int)(((uint64_t)(accum * 1000.0)) & 0x7FFFFFFF); -} diff --git a/benchmarks/intermittent/bitcount_na.c b/benchmarks/intermittent/bitcount_na.c deleted file mode 100644 index ad8940d..0000000 --- a/benchmarks/intermittent/bitcount_na.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Bit counting benchmark adapted from ulswap-bench/src/bitcount. - * Single-file form for intermittent checkpoint insertion analysis. - */ - -#include -#include - -#include "benchmark.h" -#include "loop_tripcount.h" - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -#define NUM_FUNCS 8U -#define RNG_SEED 0x0C728394u -#define ITERATIONS 20000U - -static uint32_t g_seed __attribute__((section(".fram"))) = RNG_SEED; -static uint32_t g_totals[NUM_FUNCS] __attribute__((used, section(".fram"))); - -static const uint8_t g_bits[256] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, -}; - -FORCE_INLINE void my_srand(uint32_t new_seed) { - g_seed = new_seed; -} - -FORCE_INLINE uint32_t my_rand(void) { - g_seed = (uint32_t)(1103515245u * g_seed + 12345u); - return g_seed; -} - -FORCE_INLINE uint32_t bit_count(uint32_t x) { - uint32_t n = 0; - - if (x != 0U) { - do { - n++; - x = x & (x - 1U); - } while (x != 0U); - } - - return n; -} - -FORCE_INLINE uint32_t bitcount(uint32_t i) { - i = ((i & 0xAAAAAAAAL) >> 1) + (i & 0x55555555L); - i = ((i & 0xCCCCCCCCL) >> 2) + (i & 0x33333333L); - i = ((i & 0xF0F0F0F0L) >> 4) + (i & 0x0F0F0F0FL); - i = ((i & 0xFF00FF00L) >> 8) + (i & 0x00FF00FFL); - i = ((i & 0xFFFF0000L) >> 16) + (i & 0x0000FFFFL); - - return i; -} - -FORCE_INLINE uint32_t ntbl_bitcount(uint32_t x) { - return g_bits[(uint8_t)(x & 0x0000000FUL)] + g_bits[(uint8_t)((x & 0x000000F0UL) >> 4)] + - g_bits[(uint8_t)((x & 0x00000F00UL) >> 8)] + - g_bits[(uint8_t)((x & 0x0000F000UL) >> 12)] + - g_bits[(uint8_t)((x & 0x000F0000UL) >> 16)] + - g_bits[(uint8_t)((x & 0x00F00000UL) >> 20)] + - g_bits[(uint8_t)((x & 0x0F000000UL) >> 24)] + - g_bits[(uint8_t)((x & 0xF0000000UL) >> 28)]; -} - -FORCE_INLINE uint32_t ntbl_bitcnt(uint32_t x) { - uint32_t cnt = 0; - while (x != 0U) { - cnt += g_bits[(uint8_t)(x & 0x0000000FUL)]; - x >>= 4; - } - return cnt; -} - -FORCE_INLINE uint32_t btbl_bitcnt(uint32_t x) { - uint32_t cnt = 0; - while (x != 0U) { - cnt += g_bits[(uint8_t)x]; - x >>= 8; - } - return cnt; -} - -FORCE_INLINE uint32_t BW_btbl_bitcount(uint32_t x) { - union { - uint8_t ch[4]; - uint32_t y; - } u; - - u.y = x; - - return g_bits[u.ch[0]] + g_bits[u.ch[1]] + g_bits[u.ch[3]] + g_bits[u.ch[2]]; -} - -FORCE_INLINE uint32_t AR_btbl_bitcount(uint32_t x) { - uint8_t *ptr = (uint8_t *)&x; - uint32_t accu = g_bits[*ptr++]; - - accu += g_bits[*ptr++]; - accu += g_bits[*ptr++]; - accu += g_bits[*ptr]; - - return accu; -} - -FORCE_INLINE uint32_t bit_shifter(uint32_t x) { - uint32_t i; - uint32_t n; - - for (i = n = 0; x && (i < (sizeof(uint32_t) * CHAR_BIT)); ++i, x >>= 1) { - n += (x & 1U); - } - - return n; -} - -int main(void) { - BENCH_INIT(); - uint32_t i; - uint32_t j; - uint32_t num; - uint32_t set_bits; - volatile uint32_t checksum = 0; - - my_srand(RNG_SEED); - - for (i = 0; i < NUM_FUNCS; i++) { - - set_bits = 0; - num = my_rand(); - - for (j = 0; j < ITERATIONS; j++) { - switch (i) { - case 0: - set_bits += bit_count(num); - break; - case 1: - set_bits += bitcount(num); - break; - case 2: - set_bits += ntbl_bitcnt(num); - break; - case 3: - set_bits += ntbl_bitcount(num); - break; - case 4: - set_bits += btbl_bitcnt(num); - break; - case 5: - set_bits += BW_btbl_bitcount(num); - break; - case 6: - set_bits += AR_btbl_bitcount(num); - break; - default: - set_bits += bit_shifter(num); - break; - } - num += 13U; - } - - g_totals[i] = set_bits; - checksum ^= (set_bits + (i * 0x9E3779B9u)); - } - - BENCH_EXIT((int)checksum); - return (int)checksum; -} diff --git a/benchmarks/intermittent/crc_na.c b/benchmarks/intermittent/crc_na.c deleted file mode 100644 index 1af6821..0000000 --- a/benchmarks/intermittent/crc_na.c +++ /dev/null @@ -1,129 +0,0 @@ -/********************************************************************** - * CRC-32 benchmark (preprocessed, self-contained) - * - * Based on Michael Barr's public-domain CRC implementation. - * Adapted for intermittent-computing checkpoint-insertion analysis. - **********************************************************************/ - -#include "benchmark.h" -#include "loop_tripcount.h" -#include - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -/* CRC-32 parameters */ -typedef uint32_t crc; - -#define POLYNOMIAL 0x04C11DB7 -#define INITIAL_REMAINDER 0xFFFFFFFF -#define FINAL_XOR_VALUE 0xFFFFFFFF -#define WIDTH (8 * sizeof(crc)) -#define TOPBIT ((crc)1 << (WIDTH - 1)) - -/* Repeat the original 256-byte input to lengthen the timed workload - * without changing the benchmark structure. */ -#define CRC_TEST_DATA_REPEATS 4 -#define TEST_DATA_LEN (256 * CRC_TEST_DATA_REPEATS) - -#define CRC_TEST_DATA_256 \ - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, \ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, \ - 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, \ - 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, \ - 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, \ - 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, \ - 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, \ - 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, \ - 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, \ - 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, \ - 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, \ - 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, \ - 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, \ - 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, \ - 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, \ - 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, \ - 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, \ - 0x00 - -static const uint8_t test_data[TEST_DATA_LEN] = { - CRC_TEST_DATA_256, - CRC_TEST_DATA_256, - CRC_TEST_DATA_256, - CRC_TEST_DATA_256, -}; - -/* Mutable global: CRC lookup table */ -static crc crcTable[256] __attribute__((used)); - -/********************************************************************* - * reflect() - Reorder the bits of a binary sequence by reflecting - * them about the middle position. - *********************************************************************/ -FORCE_INLINE uint32_t reflect(uint32_t data, uint8_t nBits) { - uint32_t reflection = 0x00000000; - uint8_t bit; - - for (bit = 0; bit < nBits; ++bit) { - - if (data & 0x01) { - reflection |= (1 << ((nBits - 1) - bit)); - } - - data = (data >> 1); - } - - return reflection; -} - -/********************************************************************* - * crcInit() - Populate the partial CRC lookup table. - *********************************************************************/ -FORCE_INLINE void crcInit(void) { - crc remainder; - uint32_t dividend; - uint8_t bit; - - for (dividend = 0; dividend < 256; ++dividend) { - - remainder = dividend << (WIDTH - 8); - - for (bit = 8; bit > 0; --bit) { - - if (remainder & TOPBIT) { - remainder = (remainder << 1) ^ POLYNOMIAL; - } else { - remainder = (remainder << 1); - } - } - - crcTable[dividend] = remainder; - } -} - -/********************************************************************* - * crcFast() - Compute the CRC of a given message using the lookup - * table. crcInit() must be called first. - *********************************************************************/ -FORCE_INLINE crc crcFast(const uint8_t message[], uint32_t nBytes) { - crc remainder = INITIAL_REMAINDER; - uint8_t data; - uint32_t byte; - - for (byte = 0; byte < nBytes; ++byte) { - - data = (uint8_t)reflect(message[byte], 8) ^ (remainder >> (WIDTH - 8)); - remainder = crcTable[data] ^ (remainder << 8); - } - - return (uint32_t)reflect(remainder, WIDTH) ^ FINAL_XOR_VALUE; -} - -/* --- Main --- */ - -__attribute__((noinline)) int main(void) { - BENCH_INIT(); - crcInit(); - volatile crc result = crcFast((const uint8_t *)test_data, TEST_DATA_LEN); - BENCH_EXIT((int)result); - return (int)result; -} diff --git a/benchmarks/intermittent/dijkstra_na.c b/benchmarks/intermittent/dijkstra_na.c deleted file mode 100644 index 4627783..0000000 --- a/benchmarks/intermittent/dijkstra_na.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Dijkstra shortest-path benchmark adapted from ulswap-bench/src/dijkstra. - * Single-file form for intermittent checkpoint insertion analysis. - */ - -#include - -#include "benchmark.h" -#include "loop_tripcount.h" - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -#define NUM_NODES 32U -#define NONE 255U -/* Queue capacity: empirically the max queue usage is 148 for this adjacency - matrix. 192 provides headroom while keeping total stack (900 B) within the - MILP VM capacity constraint (2048 B). */ -#define ARRAY_SIZE 192U - -typedef struct { - uint16_t iDist; - uint16_t iPrev; -} NODE; - -static const uint8_t AdjMatrix[NUM_NODES][NUM_NODES] = { - {0, 8, 255, 255, 3, 45, 255, 255, 16, 255, 255, 255, 42, 31, 30, 255, - 255, 255, 8, 255, 32, 255, 255, 35, 5, 44, 255, 38, 255, 36, 255, 20}, - {23, 0, 16, 13, 34, 2, 5, 255, 10, 31, 25, 255, 255, 255, 32, 255, - 255, 14, 255, 255, 50, 255, 10, 20, 3, 18, 3, 255, 10, 10, 3, 25}, - {32, 38, 0, 31, 255, 39, 255, 47, 29, 18, 255, 255, 28, 255, 7, 25, - 17, 13, 7, 45, 255, 18, 255, 21, 47, 255, 255, 14, 255, 3, 255, 6}, - {21, 30, 255, 0, 17, 255, 28, 255, 255, 13, 30, 16, 14, 45, 12, 14, - 4, 35, 255, 50, 31, 9, 255, 255, 11, 255, 5, 21, 255, 255, 44, 255}, - {6, 255, 255, 255, 0, 26, 21, 255, 25, 35, 20, 21, 37, 255, 6, 18, - 26, 18, 8, 25, 14, 46, 26, 255, 29, 255, 11, 20, 255, 255, 26, 28}, - {31, 255, 41, 11, 38, 0, 42, 23, 255, 255, 37, 43, 43, 255, 30, 7, - 255, 31, 255, 255, 22, 49, 20, 44, 22, 19, 13, 48, 5, 45, 14, 33}, - {21, 18, 255, 38, 36, 255, 0, 255, 24, 255, 255, 3, 3, 255, 10, 34, - 28, 5, 17, 32, 15, 33, 255, 2, 38, 37, 255, 255, 32, 44, 255, 40}, - {5, 255, 16, 11, 49, 45, 21, 0, 255, 36, 35, 39, 3, 5, 49, 27, - 255, 40, 255, 15, 13, 34, 50, 38, 4, 255, 6, 28, 10, 44, 16, 2}, - {23, 24, 12, 255, 2, 255, 255, 40, 0, 47, 255, 9, 17, 48, 255, 30, - 39, 24, 26, 50, 15, 1, 38, 8, 39, 255, 255, 37, 24, 12, 19, 18}, - {45, 12, 11, 255, 45, 16, 255, 18, 12, 0, 48, 27, 32, 38, 31, 29, - 47, 24, 7, 44, 26, 9, 255, 32, 255, 36, 255, 16, 5, 26, 46, 23}, - {36, 255, 31, 44, 21, 34, 255, 30, 255, 255, 0, 255, 255, 22, 255, 18, - 13, 2, 255, 21, 7, 255, 255, 17, 21, 20, 28, 37, 11, 26, 255, 39}, - {19, 21, 16, 255, 255, 29, 29, 33, 34, 28, 17, 0, 37, 21, 255, 11, - 255, 11, 255, 255, 35, 41, 14, 29, 255, 26, 255, 46, 255, 255, 255, 25}, - {32, 50, 255, 20, 21, 34, 43, 5, 50, 255, 12, 255, 0, 255, 28, 255, - 9, 7, 35, 39, 255, 50, 48, 18, 11, 255, 15, 16, 255, 10, 36, 10}, - {14, 255, 34, 255, 255, 47, 40, 44, 255, 23, 255, 15, 2, 0, 255, 29, - 255, 49, 255, 28, 27, 42, 34, 255, 50, 50, 37, 20, 38, 255, 255, 45}, - {8, 37, 255, 27, 255, 255, 26, 255, 12, 255, 5, 24, 255, 49, 0, 255, - 255, 25, 255, 255, 44, 2, 33, 255, 47, 2, 255, 31, 255, 49, 12, 255}, - {32, 4, 16, 30, 255, 11, 42, 20, 1, 42, 41, 14, 255, 3, 20, 0, - 48, 32, 255, 11, 42, 40, 7, 255, 47, 37, 34, 39, 255, 27, 34, 255}, - {7, 34, 42, 34, 13, 34, 255, 6, 45, 9, 5, 42, 47, 31, 50, 255, - 0, 255, 29, 1, 3, 40, 255, 255, 29, 36, 255, 3, 33, 49, 26, 38}, - {3, 37, 22, 22, 14, 255, 50, 255, 255, 2, 255, 255, 255, 36, 23, 44, - 28, 0, 50, 255, 30, 255, 255, 255, 42, 23, 23, 7, 255, 255, 255, 23}, - {48, 255, 255, 255, 37, 255, 255, 22, 40, 39, 255, 49, 44, 2, 21, 255, - 11, 37, 0, 255, 28, 255, 28, 32, 9, 33, 31, 37, 20, 18, 10, 9}, - {43, 40, 16, 11, 255, 41, 48, 4, 27, 4, 41, 1, 3, 255, 20, 255, - 44, 42, 44, 0, 21, 25, 18, 42, 4, 41, 22, 13, 7, 40, 24, 19}, - {27, 19, 46, 11, 37, 13, 45, 255, 255, 37, 38, 50, 255, 255, 20, 27, - 17, 255, 36, 21, 0, 8, 48, 255, 36, 12, 29, 49, 29, 255, 255, 30}, - {43, 4, 255, 20, 255, 9, 40, 5, 255, 255, 24, 12, 35, 50, 4, 255, - 38, 26, 255, 255, 4, 0, 255, 255, 255, 255, 255, 24, 255, 2, 255, 255}, - {255, 25, 40, 28, 19, 24, 15, 255, 4, 255, 20, 48, 34, 43, 32, 20, - 44, 255, 255, 39, 255, 255, 0, 50, 22, 24, 49, 255, 6, 19, 27, 7}, - {21, 255, 18, 3, 1, 2, 15, 42, 37, 5, 5, 24, 46, 3, 4, 255, - 2, 35, 15, 49, 255, 18, 36, 0, 255, 20, 41, 255, 255, 40, 22, 22}, - {31, 3, 27, 21, 14, 255, 13, 1, 27, 42, 255, 1, 28, 1, 4, 39, - 28, 255, 255, 16, 3, 255, 7, 1, 0, 255, 39, 25, 2, 255, 10, 7}, - {7, 6, 255, 255, 3, 255, 42, 49, 255, 22, 38, 4, 255, 35, 29, 15, - 38, 29, 47, 33, 37, 21, 37, 32, 255, 0, 18, 24, 21, 255, 255, 255}, - {255, 27, 30, 38, 18, 6, 38, 3, 48, 29, 50, 255, 4, 255, 255, 255, - 255, 255, 26, 46, 7, 46, 13, 35, 255, 23, 0, 18, 42, 3, 30, 255}, - {2, 255, 255, 20, 255, 34, 28, 11, 32, 255, 5, 255, 30, 255, 38, 255, - 43, 26, 19, 5, 15, 255, 34, 20, 10, 17, 45, 0, 21, 255, 255, 34}, - {7, 8, 255, 13, 255, 38, 25, 16, 50, 255, 13, 255, 255, 255, 255, 1, - 18, 14, 255, 255, 40, 25, 47, 41, 255, 255, 255, 28, 0, 9, 21, 255}, - {255, 29, 23, 255, 255, 255, 255, 34, 44, 41, 14, 35, 6, 26, 26, 15, - 255, 17, 255, 255, 9, 17, 30, 28, 255, 26, 255, 255, 20, 0, 39, 4}, - {255, 255, 2, 255, 46, 15, 12, 255, 40, 255, 255, 38, 255, 20, 255, 29, - 7, 29, 255, 11, 48, 45, 255, 34, 2, 255, 33, 255, 2, 255, 0, 23}, - {255, 255, 255, 255, 255, 45, 255, 255, 22, 41, 24, 255, 18, 41, 25, 255, - 255, 255, 255, 255, 3, 10, 255, 50, 30, 46, 38, 37, 38, 255, 20, 0}, -}; - -static uint32_t g_checksum_sink __attribute__((used, section(".fram"))) = 0; - -FORCE_INLINE uint16_t dijkstra(uint16_t start, uint16_t end) { - uint16_t ch; - uint16_t i; - uint16_t iNode; - uint16_t iDist; - uint16_t iCost; - NODE nodes[NUM_NODES]; - uint16_t queue_node[ARRAY_SIZE]; - uint16_t queue_dist[ARRAY_SIZE]; - uint16_t q_head = 0; - uint16_t q_tail = 0; - uint16_t q_count = 0; - - for (ch = 0; ch < NUM_NODES; ch++) { - nodes[ch].iDist = NONE; - nodes[ch].iPrev = NONE; - } - - if (start == end) { - return 0; - } - - nodes[start].iDist = 0; - nodes[start].iPrev = NONE; - queue_node[q_tail] = start; - queue_dist[q_tail] = 0; - q_tail++; - q_count++; - - while (q_count > 0) { - - iNode = queue_node[q_head]; - iDist = queue_dist[q_head]; - q_head++; - q_count--; - - for (i = 0; i < NUM_NODES; i++) { - iCost = AdjMatrix[iNode][i]; - - if (iCost != NONE) { - uint16_t next_dist = (uint16_t)(iDist + iCost); - - if ((nodes[i].iDist == NONE) || (nodes[i].iDist > next_dist)) { - nodes[i].iDist = next_dist; - nodes[i].iPrev = iNode; - - if (q_tail >= ARRAY_SIZE) { - return NONE; - } - - queue_node[q_tail] = i; - queue_dist[q_tail] = next_dist; - q_tail++; - q_count++; - } - } - } - } - - return nodes[end].iDist; -} - -int main(void) { - BENCH_INIT(); - uint16_t i; - uint16_t j; - uint16_t dist; - volatile uint32_t checksum = 0; - - for (i = 0, j = (NUM_NODES / 2U); i < NUM_NODES; i++, j++) { - j = (uint16_t)(j % NUM_NODES); - dist = dijkstra(i, j); - checksum = (checksum * 131U) + dist; - } - - g_checksum_sink = checksum; - BENCH_EXIT((int)checksum); - return (int)checksum; -} diff --git a/benchmarks/intermittent/ecc.c b/benchmarks/intermittent/ecc.c deleted file mode 100644 index bb3460e..0000000 --- a/benchmarks/intermittent/ecc.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Elliptic Curve Diffie-Hellman (ECDH) benchmark for intermittent computing. - * - * Uses NIST B-233 binary field curve (Koblitz curve). - * Preprocessed single-file version for MILP checkpoint insertion analysis. - * - * Source: ulswap-bench/src/ecc/ - */ - -#include "benchmark.h" -#include "loop_tripcount.h" -#include - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -/* --- Curve parameters for NIST B-233 --- */ - -#define CURVE_DEGREE 233 -#define ECC_PRV_KEY_SIZE 32 -#define ECC_PUB_KEY_SIZE 64 - -#define BITVEC_MARGIN 3 -#define BITVEC_NBITS (CURVE_DEGREE + BITVEC_MARGIN) -#define BITVEC_NWORDS ((BITVEC_NBITS + 31) / 32) /* 8 */ -#define BITVEC_NBYTES (sizeof(uint32_t) * BITVEC_NWORDS) /* 32 */ - -#define CONST_TIME 0 -#define ECDH_COFACTOR_VARIANT 0 - -#define coeff_a 1 -#define cofactor 2 - -/* --- Types --- */ - -typedef uint32_t bitvec_t[BITVEC_NWORDS]; -typedef bitvec_t gf2elem_t; -typedef bitvec_t scalar_t; - -/* --- Curve constants (NIST B-233, no annotation) --- */ - -static const gf2elem_t polynomial = {0x00000001, 0x00000000, 0x00000400, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000200}; -static const gf2elem_t coeff_b = {0x7d8f90ad, 0x81fe115f, 0x20e9ce42, 0x213b333b, - 0x0923bb58, 0x332c7f8c, 0x647ede6c, 0x00000066}; -/* --- Key data for NIST B-233 (const, no annotation) --- */ - -static const uint8_t prv_a[ECC_PRV_KEY_SIZE] = { - 0x2F, 0x46, 0x53, 0xB8, 0x26, 0x67, 0x5E, 0x49, 0x72, 0x6B, 0x53, 0xE4, 0x99, 0x55, 0x09, 0x99, - 0xBE, 0x39, 0x47, 0x60, 0xF2, 0x91, 0x87, 0x1F, 0x8F, 0x69, 0x8F, 0x5A, 0x1D, 0x00, 0x00, 0x00}; -static const uint8_t prv_b[ECC_PRV_KEY_SIZE] = { - 0x3E, 0xC0, 0x0C, 0xAF, 0x89, 0x04, 0x52, 0x39, 0x97, 0x7D, 0x51, 0x4F, 0xDA, 0x58, 0xAE, 0x16, - 0xA9, 0x63, 0x74, 0x67, 0x94, 0x93, 0xB1, 0xF7, 0x66, 0x7B, 0x29, 0x1C, 0xCE, 0x00, 0x00, 0x00}; -static const uint8_t pub_a[ECC_PUB_KEY_SIZE] = { - 0xAF, 0x08, 0xF4, 0x95, 0x0A, 0x27, 0x5F, 0x50, 0x96, 0x38, 0x69, 0x45, 0x9D, 0x40, 0xDF, 0x2B, - 0x25, 0xA9, 0x63, 0x35, 0xD4, 0xAC, 0x61, 0x69, 0x2D, 0x3D, 0x1F, 0xE2, 0x38, 0x00, 0x00, 0x00, - 0x31, 0xAE, 0x94, 0xD6, 0x9C, 0x7D, 0xA4, 0x44, 0x67, 0xC7, 0x1E, 0x66, 0xD6, 0x36, 0x92, 0x6F, - 0x8F, 0x42, 0xB9, 0xBF, 0x71, 0xB4, 0x4F, 0x5B, 0x41, 0xAD, 0xAA, 0x86, 0x82, 0x01, 0x00, 0x00}; -static const uint8_t pub_b[ECC_PUB_KEY_SIZE] = { - 0x70, 0xF7, 0x8E, 0xB9, 0x4E, 0x59, 0x98, 0xF8, 0xB3, 0x3A, 0x48, 0xE2, 0x3C, 0x12, 0x8A, 0x9C, - 0x06, 0xE9, 0x34, 0xD6, 0xBC, 0x32, 0xAD, 0xDC, 0xFD, 0x2D, 0x03, 0xA3, 0xC7, 0x00, 0x00, 0x00, - 0x77, 0xAF, 0xA1, 0xA4, 0x31, 0x68, 0xBA, 0xF6, 0x78, 0x29, 0xCB, 0xA6, 0xDC, 0xA3, 0x52, 0x63, - 0xC0, 0xAB, 0x59, 0x53, 0x0C, 0x74, 0xEC, 0x46, 0x3E, 0x20, 0xDF, 0x38, 0x62, 0x00, 0x00, 0x00}; - -/* --- Mutable globals --- */ - -__attribute__((used)) static uint8_t sec_a[ECC_PUB_KEY_SIZE]; - -__attribute__((used)) static uint8_t sec_b[ECC_PUB_KEY_SIZE]; - -/* ========================================================================= */ -/* Bit-vector operations */ -/* ========================================================================= */ - -FORCE_INLINE int bitvec_get_bit(const bitvec_t x, const uint32_t idx) { - return ((x[idx / 32U] >> (idx & 31U)) & 1U); -} - -FORCE_INLINE void bitvec_copy(bitvec_t x, const bitvec_t y) { - int i; - for (i = 0; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - x[i] = y[i]; - } -} - -FORCE_INLINE void bitvec_swap(bitvec_t x, bitvec_t y) { - bitvec_t tmp; - bitvec_copy(tmp, x); - bitvec_copy(x, y); - bitvec_copy(y, tmp); -} - -/* fast version (CONST_TIME=0) */ -FORCE_INLINE int bitvec_equal(const bitvec_t x, const bitvec_t y) { - int i; - for (i = 0; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - if (x[i] != y[i]) { - return 0; - } - } - return 1; -} - -FORCE_INLINE void bitvec_set_zero(bitvec_t x) { - int i; - for (i = 0; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - x[i] = 0; - } -} - -/* fast version (CONST_TIME=0) */ -FORCE_INLINE int bitvec_is_zero(const bitvec_t x) { - uint32_t i = 0; - while (i < BITVEC_NWORDS) { - __loop_tripcount(8); - if (x[i] != 0) { - break; - } - i += 1; - } - return (i == BITVEC_NWORDS); -} - -/* return the number of the highest one-bit + 1 */ -FORCE_INLINE int bitvec_degree(const bitvec_t x) { - int i = BITVEC_NWORDS * 32; - - /* Start at the back of the vector (MSB) */ - const uint32_t *p = x + BITVEC_NWORDS; - - /* Skip empty / zero words */ - while ((i > 0) && (*(--p)) == 0) { - __loop_tripcount(8); - i -= 32; - } - /* Run through rest if count is not multiple of bitsize of DTYPE */ - if (i != 0) { - uint32_t u32mask = ((uint32_t)1 << 31); - while (((*p) & u32mask) == 0) { - __loop_tripcount(32); - u32mask >>= 1; - i -= 1; - } - } - return i; -} - -/* left-shift by 'nbits' digits */ -FORCE_INLINE void bitvec_lshift(bitvec_t x, const bitvec_t y, int nbits) { - int nwords = (nbits / 32); - - int i, j; - for (i = 0; i < nwords; ++i) { - __loop_tripcount(8); - x[i] = 0; - } - j = 0; - while (i < BITVEC_NWORDS) { - __loop_tripcount(8); - x[i] = y[j]; - i += 1; - j += 1; - } - - /* Shift the rest if count was not multiple of bitsize of DTYPE */ - nbits &= 31; - if (nbits != 0) { - int k; - for (k = (BITVEC_NWORDS - 1); k > 0; --k) { - __loop_tripcount(8); - x[k] = (x[k] << nbits) | (x[k - 1] >> (32 - nbits)); - } - x[0] <<= nbits; - } -} - -/* ========================================================================= */ -/* GF(2^m) arithmetic */ -/* ========================================================================= */ - -FORCE_INLINE void gf2field_set_one(gf2elem_t x) { - x[0] = 1; - int i; - for (i = 1; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - x[i] = 0; - } -} - -/* fast version (CONST_TIME=0) */ -FORCE_INLINE int gf2field_is_one(const gf2elem_t x) { - if (x[0] != 1) { - return 0; - } - int i; - for (i = 1; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - if (x[i] != 0) { - break; - } - } - return (i == BITVEC_NWORDS); -} - -/* galois field(2^m) addition is modulo 2, so XOR is used - 'z := a + b' */ -FORCE_INLINE void gf2field_add(gf2elem_t z, const gf2elem_t x, const gf2elem_t y) { - int i; - for (i = 0; i < BITVEC_NWORDS; ++i) { - __loop_tripcount(8); - z[i] = (x[i] ^ y[i]); - } -} - -/* increment element */ -FORCE_INLINE void gf2field_inc(gf2elem_t x) { - x[0] ^= 1; -} - -/* field multiplication 'z := (x * y)' */ -FORCE_INLINE void gf2field_mul(gf2elem_t z, const gf2elem_t x, const gf2elem_t y) { - int i; - gf2elem_t tmp; - - bitvec_copy(tmp, x); - - /* LSB set? Then start with x */ - if (bitvec_get_bit(y, 0) != 0) { - bitvec_copy(z, x); - } else { - bitvec_set_zero(z); - } - - /* Then add 2^i * x for the rest */ - for (i = 1; i < CURVE_DEGREE; ++i) { - __loop_tripcount(233); - - /* lshift 1 - doubling the value of tmp */ - bitvec_lshift(tmp, tmp, 1); - - /* Modulo reduction polynomial if degree(tmp) > CURVE_DEGREE */ - if (bitvec_get_bit(tmp, CURVE_DEGREE)) { - gf2field_add(tmp, tmp, polynomial); - } - - /* Add 2^i * tmp if this factor in y is non-zero */ - if (bitvec_get_bit(y, i)) { - gf2field_add(z, z, tmp); - } - } -} - -/* field inversion 'z := 1/x' */ -FORCE_INLINE void gf2field_inv(gf2elem_t z, const gf2elem_t x) { - gf2elem_t u, v, g, h; - int i; - - bitvec_copy(u, x); - bitvec_copy(v, polynomial); - bitvec_set_zero(g); - gf2field_set_one(z); - - while (!gf2field_is_one(u)) { - __loop_tripcount(466); - - i = (bitvec_degree(u) - bitvec_degree(v)); - - if (i < 0) { - bitvec_swap(u, v); - bitvec_swap(g, z); - i = -i; - } - bitvec_lshift(h, v, i); - gf2field_add(u, u, h); - bitvec_lshift(h, g, i); - gf2field_add(z, z, h); - } -} - -/* ========================================================================= */ -/* Elliptic curve point operations */ -/* ========================================================================= */ - -FORCE_INLINE void gf2point_copy(gf2elem_t x1, gf2elem_t y1, const gf2elem_t x2, - const gf2elem_t y2) { - bitvec_copy(x1, x2); - bitvec_copy(y1, y2); -} - -FORCE_INLINE void gf2point_set_zero(gf2elem_t x, gf2elem_t y) { - bitvec_set_zero(x); - bitvec_set_zero(y); -} - -FORCE_INLINE int gf2point_is_zero(const gf2elem_t x, const gf2elem_t y) { - return (bitvec_is_zero(x) && bitvec_is_zero(y)); -} - -/* double the point (x,y) */ -FORCE_INLINE void gf2point_double(gf2elem_t x, gf2elem_t y) { - /* iff P = O (zero or infinity): 2 * P = P */ - if (bitvec_is_zero(x)) { - bitvec_set_zero(y); - } else { - gf2elem_t l; - - gf2field_inv(l, x); - gf2field_mul(l, l, y); - gf2field_add(l, l, x); - gf2field_mul(y, x, x); - gf2field_mul(x, l, l); - /* coeff_a == 1 */ - gf2field_inc(l); - gf2field_add(x, x, l); - gf2field_mul(l, l, x); - gf2field_add(y, y, l); - } -} - -/* add two points together (x1, y1) := (x1, y1) + (x2, y2) */ -FORCE_INLINE void gf2point_add(gf2elem_t x1, gf2elem_t y1, const gf2elem_t x2, const gf2elem_t y2) { - if (!gf2point_is_zero(x2, y2)) { - if (gf2point_is_zero(x1, y1)) { - gf2point_copy(x1, y1, x2, y2); - } else { - if (bitvec_equal(x1, x2)) { - if (bitvec_equal(y1, y2)) { - gf2point_double(x1, y1); - } else { - gf2point_set_zero(x1, y1); - } - } else { - gf2elem_t a, b, c, d; - - gf2field_add(a, y1, y2); - gf2field_add(b, x1, x2); - gf2field_inv(c, b); - gf2field_mul(c, c, a); - gf2field_mul(d, c, c); - gf2field_add(d, d, c); - gf2field_add(d, d, b); - /* coeff_a == 1 */ - gf2field_inc(d); - gf2field_add(x1, x1, d); - gf2field_mul(a, x1, c); - gf2field_add(a, a, d); - gf2field_add(y1, y1, a); - bitvec_copy(x1, d); - } - } - } -} - -/* point multiplication via double-and-add algorithm (CONST_TIME=0) */ -FORCE_INLINE void gf2point_mul(gf2elem_t x, gf2elem_t y, const scalar_t exp) { - gf2elem_t tmpx, tmpy; - int i; - int nbits = bitvec_degree(exp); - - gf2point_set_zero(tmpx, tmpy); - - for (i = (nbits - 1); i >= 0; --i) { - __loop_tripcount(233); - gf2point_double(tmpx, tmpy); - if (bitvec_get_bit(exp, i)) { - gf2point_add(tmpx, tmpy, x, y); - } - } - gf2point_copy(x, y, tmpx, tmpy); -} - -/* check if y^2 + x*y = x^3 + a*x^2 + coeff_b holds */ -FORCE_INLINE int gf2point_on_curve(const gf2elem_t x, const gf2elem_t y) { - gf2elem_t a, b; - - if (gf2point_is_zero(x, y)) { - return 1; - } else { - gf2field_mul(a, x, x); - /* coeff_a == 1 */ - gf2field_mul(b, a, x); - gf2field_add(a, a, b); - gf2field_add(a, a, coeff_b); - gf2field_mul(b, y, y); - gf2field_add(a, a, b); - gf2field_mul(b, x, y); - - return bitvec_equal(a, b); - } -} - -/* ========================================================================= */ -/* ECDH shared secret */ -/* ========================================================================= */ - -FORCE_INLINE int ecdh_shared_secret(const uint8_t *private_key, const uint8_t *others_pub, - uint8_t *output) { - /* Basic validation of other party's public key */ - if (!gf2point_is_zero((uint32_t *)others_pub, (uint32_t *)(others_pub + BITVEC_NBYTES)) && - gf2point_on_curve((uint32_t *)others_pub, (uint32_t *)(others_pub + BITVEC_NBYTES))) { - /* Copy other side's public key to output */ - unsigned int i; - for (i = 0; i < (BITVEC_NBYTES * 2); ++i) { - __loop_tripcount(64); - output[i] = others_pub[i]; - } - - /* Multiply other side's public key with own private key */ - gf2point_mul((uint32_t *)output, (uint32_t *)(output + BITVEC_NBYTES), - (const uint32_t *)private_key); - - return 1; - } else { - return 0; - } -} - -/* ========================================================================= */ -/* Main */ -/* ========================================================================= */ - -__attribute__((noinline)) int main(void) { - BENCH_INIT(); - ecdh_shared_secret(prv_a, pub_b, sec_a); - ecdh_shared_secret(prv_b, pub_a, sec_b); - - /* Simple comparison */ - int match = 1; - int i; - for (i = 0; i < ECC_PUB_KEY_SIZE; i++) { - __loop_tripcount(64); - if (sec_a[i] != sec_b[i]) - match = 0; - } - BENCH_EXIT(match); - return match; -} diff --git a/benchmarks/intermittent/fft.c b/benchmarks/intermittent/fft.c deleted file mode 100644 index de32a0e..0000000 --- a/benchmarks/intermittent/fft.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * FFT - Preprocessed benchmark for intermittent computing. - * Based on Don Cross FFT implementation (public domain) from MiBench/ulswap-bench. - * Merged into single file: fftmisc.c + fourierf.c + main.c + common RNG. - */ -#include "benchmark.h" -#include "loop_tripcount.h" -#include -#include -#include - -#define DDC_PI (3.14159265358979323846) -#define TRUE 1 -#define FALSE 0 -#define BITS_PER_WORD (sizeof(uint32_t) * 8) - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -#define MAXSIZE 32 -#define MAXWAVES 4 - -/* --- Mutable globals --- */ - -static float realin[MAXSIZE] __attribute__((section(".fram"))); -static float imagin[MAXSIZE] __attribute__((section(".fram"))); -static float realout[MAXSIZE] __attribute__((section(".fram"))); -static float imagout[MAXSIZE] __attribute__((section(".fram"))); -static float Coeff[MAXWAVES] __attribute__((section(".fram"))); -static float Amp[MAXWAVES] __attribute__((section(".fram"))); - -static uint32_t g_checksum_sink __attribute__((used, section(".fram"))) = 0; - -/* --- Simple LCG RNG (from ulswap-bench common.c) --- */ - -static uint32_t _myrand_seed __attribute__((section(".fram"))) = 1234; - -FORCE_INLINE void my_srand(uint32_t new_seed) { - _myrand_seed = new_seed; -} - -FORCE_INLINE uint32_t my_rand(void) { - _myrand_seed = (uint32_t)(1103515245 * _myrand_seed + 12345); - return _myrand_seed; -} - -/* --- FFT helper routines (from fftmisc.c) --- */ - -FORCE_INLINE uint32_t NumberOfBitsNeeded(uint32_t PowerOfTwo) { - uint32_t i; - - for (i = 0;; i++) { - __loop_tripcount(32); /* at most 32 bits */ - if (PowerOfTwo & (1 << i)) - return i; - } -} - -FORCE_INLINE uint32_t ReverseBits(uint32_t index, uint32_t NumBits) { - uint32_t i, rev; - - for (i = rev = 0; i < NumBits; i++) { - __loop_tripcount(5); /* log2(MAXSIZE) = 5 */ - rev = (rev << 1) | (index & 1); - index >>= 1; - } - - return rev; -} - -/* --- FFT core (from fourierf.c) --- */ - -FORCE_INLINE void fft_float(uint32_t NumSamples, int32_t InverseTransform, float *RealIn, - float *ImagIn, float *RealOut, float *ImagOut) { - uint32_t NumBits; - uint32_t i, j, k, n; - uint32_t BlockSize, BlockEnd; - - double angle_numerator = 2.0 * DDC_PI; - double tr, ti; - - if (InverseTransform) - angle_numerator = -angle_numerator; - - NumBits = NumberOfBitsNeeded(NumSamples); - - /* Simultaneous data copy and bit-reversal ordering into outputs */ - for (i = 0; i < NumSamples; i++) { - __loop_tripcount(MAXSIZE); /* 32 */ - j = ReverseBits(i, NumBits); - RealOut[j] = RealIn[i]; - ImagOut[j] = (ImagIn == NULL) ? 0.0f : ImagIn[i]; - } - - /* FFT butterfly */ - BlockEnd = 1; - for (BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) { - __loop_tripcount(5); /* log2(MAXSIZE) = 5 */ - double delta_angle = angle_numerator / (double)BlockSize; - double sm2 = sin(-2 * delta_angle); - double sm1 = sin(-delta_angle); - double cm2 = cos(-2 * delta_angle); - double cm1 = cos(-delta_angle); - double w = 2 * cm1; - double ar[3], ai[3]; - - for (i = 0; i < NumSamples; i += BlockSize) { - __loop_tripcount(MAXSIZE); /* at most 32 */ - ar[2] = cm2; - ar[1] = cm1; - - ai[2] = sm2; - ai[1] = sm1; - - for (j = i, n = 0; n < BlockEnd; j++, n++) { - __loop_tripcount(MAXSIZE / 2); /* at most 16 */ - ar[0] = w * ar[1] - ar[2]; - ar[2] = ar[1]; - ar[1] = ar[0]; - - ai[0] = w * ai[1] - ai[2]; - ai[2] = ai[1]; - ai[1] = ai[0]; - - k = j + BlockEnd; - tr = ar[0] * RealOut[k] - ai[0] * ImagOut[k]; - ti = ar[0] * ImagOut[k] + ai[0] * RealOut[k]; - - RealOut[k] = RealOut[j] - tr; - ImagOut[k] = ImagOut[j] - ti; - - RealOut[j] += tr; - ImagOut[j] += ti; - } - } - - BlockEnd = BlockSize; - } - - /* Normalize if inverse transform */ - if (InverseTransform) { - double denom = (double)NumSamples; - - for (i = 0; i < NumSamples; i++) { - __loop_tripcount(MAXSIZE); /* 32 */ - RealOut[i] /= denom; - ImagOut[i] /= denom; - } - } -} - -/* --- Main benchmark entry point --- */ - -int main(void) { - BENCH_INIT(); - uint32_t i, j; - - my_srand(1); - - /* Makes MAXWAVES waves of random amplitude and period */ - for (i = 0; i < MAXWAVES; i++) { - __loop_tripcount(MAXWAVES); /* 4 */ - Coeff[i] = my_rand() % 1000; - Amp[i] = my_rand() % 1000; - } - for (i = 0; i < MAXSIZE; i++) { - __loop_tripcount(MAXSIZE); /* 32 */ - realin[i] = 0; - for (j = 0; j < MAXWAVES; j++) { - __loop_tripcount(MAXWAVES); /* 4 */ - if (my_rand() % 2) { - realin[i] += Coeff[j] * cos(Amp[j] * i); - } else { - realin[i] += Coeff[j] * sin(Amp[j] * i); - } - imagin[i] = 0; - } - } - - /* Forward FFT */ - fft_float(MAXSIZE, FALSE, realin, imagin, realout, imagout); - - /* Inverse FFT */ - fft_float(MAXSIZE, TRUE, realin, imagin, realout, imagout); - - volatile uint32_t checksum = 0; - for (i = 0; i < MAXSIZE; i++) { - __loop_tripcount(MAXSIZE); /* 32 */ - checksum = (checksum * 131U) + (uint32_t)(int32_t)realout[i]; - checksum = (checksum * 131U) + (uint32_t)(int32_t)imagout[i]; - } - - g_checksum_sink = checksum; - - BENCH_EXIT((int)(checksum & 0x7FFFFFFFu)); - return (int)(checksum & 0x7FFFFFFFu); -} diff --git a/benchmarks/intermittent/pathological_milp_vs_schematic.c b/benchmarks/intermittent/pathological_milp_vs_schematic.c deleted file mode 100644 index 785fde2..0000000 --- a/benchmarks/intermittent/pathological_milp_vs_schematic.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Pathological benchmark for MILP vs SCHEMATIC checkpoint placement. - * - * The main loop body is intentionally tuned so that tight-energy settings - * can execute only a couple of iterations per charge. SCHEMATIC then falls - * into its "checkpoint every iteration" heuristic, while MILP can use loop - * strip-mining to amortize checkpoint overhead. - */ - -#include - -#include "benchmark.h" -#include "loop_tripcount.h" - -#define OUTER_ITERS 4096U - -#define MIX_STEP(x, mul, add, sh) \ - do { \ - (x) = (x) * (mul) + (add); \ - (x) ^= ((x) >> (sh)); \ - } while (0) - -static uint32_t g_state __attribute__((used, section(".fram"))) = 0x12345678u; -static uint32_t g_ring[8] __attribute__((used, section(".fram"))); - -int main(void) { - BENCH_INIT(); - uint32_t x = g_state ^ 0x9e3779b9u; - - for (uint32_t i = 0; i < OUTER_ITERS; ++i) { - __loop_tripcount(OUTER_ITERS); - - x ^= (i * 2654435761u) + 0x7f4a7c15u; - MIX_STEP(x, 1664525u, 1013904223u + i, 7); - MIX_STEP(x, 22695477u, 1u + (i << 1), 9); - MIX_STEP(x, 1103515245u, 12345u + (i << 2), 11); - MIX_STEP(x, 214013u, 2531011u + (i << 3), 13); - MIX_STEP(x, 134775813u, 1u + (i << 4), 5); - MIX_STEP(x, 747796405u, 2891336453u + (i << 5), 10); - MIX_STEP(x, 277803737u, 206666391u + (i << 6), 12); - MIX_STEP(x, 1597334677u, 3812015801u + (i << 7), 8); - MIX_STEP(x, 73856093u, 19349663u + (i << 8), 6); - MIX_STEP(x, 83492791u, 0x9e3779b9u + (i << 1), 14); - MIX_STEP(x, 2654435761u, 2246822519u + (i << 2), 7); - MIX_STEP(x, 3266489917u, 668265263u + (i << 3), 11); - - g_ring[i & 7u] = x; - } - - g_state = x ^ g_ring[0] ^ g_ring[1] ^ g_ring[2] ^ g_ring[3] ^ g_ring[4] ^ g_ring[5] ^ - g_ring[6] ^ g_ring[7]; - BENCH_EXIT((int)(g_state & 0x7fffffffU)); - return (int)(g_state & 0x7fffffffU); -} diff --git a/benchmarks/intermittent/qsort_na.c b/benchmarks/intermittent/qsort_na.c deleted file mode 100644 index 49b09c4..0000000 --- a/benchmarks/intermittent/qsort_na.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Sorting benchmark adapted from ulswap-bench/src/qsort. - * Single-file intermittent variant with local always-inline sort helpers. - */ - -#include - -#include "benchmark.h" -#include "loop_tripcount.h" -#include "qsort_input.h" - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -static uint32_t g_checksum_sink __attribute__((used, section(".fram"))) = 0; - -FORCE_INLINE uint32_t squared_distance(const Vertex *vertex) { - uint32_t x = (uint32_t)((int32_t)vertex->x * (int32_t)vertex->x); - uint32_t y = (uint32_t)((int32_t)vertex->y * (int32_t)vertex->y); - uint32_t z = (uint32_t)((int32_t)vertex->z * (int32_t)vertex->z); - - return x + y + z; -} - -FORCE_INLINE void populate_distances(void) { - uint32_t i; - - for (i = 0; i < ARRAY_SIZE; ++i) { - vertices[i].distance = squared_distance(&vertices[i]); - } -} - -FORCE_INLINE void sort_vertices(void) { - uint32_t i; - - for (i = 1; i < ARRAY_SIZE; ++i) { - Vertex key = vertices[i]; - int32_t j = (int32_t)i - 1; - - while ((j >= 0) && (vertices[j].distance > key.distance)) { - vertices[j + 1] = vertices[j]; - j--; - } - - vertices[j + 1] = key; - } -} - -FORCE_INLINE uint32_t checksum_vertices(void) { - uint32_t i; - uint32_t checksum = 2166136261u; - - for (i = 0; i < ARRAY_SIZE; ++i) { - checksum = (checksum * 16777619u) ^ (uint16_t)vertices[i].x; - checksum = (checksum * 16777619u) ^ (uint16_t)vertices[i].y; - checksum = (checksum * 16777619u) ^ (uint16_t)vertices[i].z; - checksum = (checksum * 16777619u) ^ vertices[i].distance; - } - - return checksum; -} - -int main(void) { - uint32_t checksum; - - BENCH_INIT(); - - populate_distances(); - sort_vertices(); - checksum = checksum_vertices(); - - g_checksum_sink = checksum; - - BENCH_EXIT((int)(checksum & 0x7FFFFFFFu)); - return (int)(checksum & 0x7FFFFFFFu); -} diff --git a/benchmarks/intermittent/rsa_na.c b/benchmarks/intermittent/rsa_na.c deleted file mode 100644 index f480405..0000000 --- a/benchmarks/intermittent/rsa_na.c +++ /dev/null @@ -1,319 +0,0 @@ -#include "benchmark.h" -#include "loop_tripcount.h" -#include -#include - -#define FORCE_INLINE static inline __attribute__((always_inline)) - -// --- Configuration & Constants --- - -#define DIGIT_BITS 8 -#define DIGIT_MASK 0x00ff -#include "./data/keysize.h" - -#define NUM_DIGITS (KEY_SIZE_BITS / DIGIT_BITS) -#define PRINT_HEX_ASCII_COLS 8 - -/** @brief Type large enough to store a product of two digits */ -typedef uint16_t digit_t; - -typedef struct { - uint8_t n[NUM_DIGITS]; // modulus - digit_t e; // exponent -} pubkey_t; - -static const uint8_t PAD_DIGITS[] = {0x01}; -#define NUM_PAD_DIGITS (sizeof(PAD_DIGITS) / sizeof(PAD_DIGITS[0])) - -// modulus: byte order: LSB to MSB, constraint MSB>=0x80 -static const pubkey_t pubkey = { -#include "./data/key.txt" -}; - -static const unsigned char PLAINTEXT[] = -#include "./data/plaintext.txt" - ; - -#define NUM_PLAINTEXT_BLOCKS (sizeof(PLAINTEXT) / (NUM_DIGITS - NUM_PAD_DIGITS) + 1) -#define CYPHERTEXT_SIZE (NUM_PLAINTEXT_BLOCKS * NUM_DIGITS) - -// --- Global Buffers --- -digit_t g_A[NUM_DIGITS]; -digit_t g_B[NUM_DIGITS]; -digit_t g_product[NUM_DIGITS * 2]; -digit_t g_base[NUM_DIGITS * 2]; -digit_t g_block[NUM_DIGITS * 2]; -digit_t g_cyphertext[CYPHERTEXT_SIZE]; -unsigned g_cyphertext_len = 0; - -// --- Helper Functions --- - -// Helper for 16-bit multiplication used in reduction -FORCE_INLINE uint32_t mult16(digit_t a, digit_t b) { - return (uint32_t)a * b; -} - -// --- Logic Functions --- - -// Forward declaration -FORCE_INLINE void mult_mod_operation(digit_t *A, digit_t *B, digit_t *result_buffer); - -/* * Performs: result = (A * B) mod N - * This consolidates task_mult_mod, task_mult, and all task_reduce_* - */ -FORCE_INLINE void mult_mod_operation(digit_t *A, digit_t *B, digit_t *result_buffer) { - int i, j; - - // Standard schoolbook multiplication: A * B -> product - digit_t c = 0; - digit_t p = 0; - - // Clear product buffer first - for (i = 0; i < NUM_DIGITS * 2; i++) { - g_product[i] = 0; - } - - for (int digit = 0; digit < NUM_DIGITS * 2; ++digit) { - p = c; // carry from previous - c = 0; // new carry - - for (i = 0; i < NUM_DIGITS; ++i) { - if (digit - i >= 0 && digit - i < NUM_DIGITS) { - digit_t a_val = A[digit - i]; - digit_t b_val = B[i]; - uint32_t dp = (uint32_t)a_val * b_val; - - // Add to current accumulator - p += (dp & DIGIT_MASK); - // Calculate carry - c += (dp >> DIGIT_BITS); - } - } - - // Handle local accumulator overflow - c += (p >> DIGIT_BITS); - p &= DIGIT_MASK; - - g_product[digit] = p; - } - - // Find Most Significant Digit (MSD) - int d = 2 * NUM_DIGITS; - digit_t m; - do { - d--; - m = g_product[d]; - } while (m == 0 && d > 0); - - // If result is 0, we are done - if (m == 0) { - for (i = 0; i < NUM_DIGITS; i++) { - result_buffer[i] = 0; - } - return; - } - - // Reduction Loop - while (1) { - - bool normalizable = true; - unsigned offset = d + 1 - NUM_DIGITS; - - for (i = d; i >= 0; --i) { - digit_t m_val = g_product[i]; - digit_t n_val = (i - offset >= 0 && i - offset < NUM_DIGITS) ? pubkey.n[i - offset] : 0; - - if (m_val > n_val) { - break; - } else if (m_val < n_val) { - normalizable = false; - break; - } - } - - if (!normalizable && d == NUM_DIGITS - 1) { - // Reduction done: message < modulus - break; - } - - if (normalizable) { - // Simple subtraction: product = product - (N << offset) - unsigned borrow = 0; - for (i = 0; i < NUM_DIGITS; ++i) { - digit_t m_val = g_product[i + offset]; - digit_t n_val = pubkey.n[i]; - digit_t s = n_val + borrow; - - if (m_val < s) { - m_val += (1 << DIGIT_BITS); - borrow = 1; - } else { - borrow = 0; - } - g_product[i + offset] = m_val - s; - } - - if (offset == 0) { - break; - } - } else { - digit_t n1 = pubkey.n[NUM_DIGITS - 1]; - digit_t n0 = pubkey.n[NUM_DIGITS - 2]; - digit_t n_div = ((n1 << DIGIT_BITS) + n0); - - digit_t m2 = g_product[d]; - digit_t m1 = g_product[d - 1]; - digit_t m0 = g_product[d - 2]; - digit_t m_n = pubkey.n[NUM_DIGITS - 1]; - - digit_t q; - if (m2 == m_n) { - q = (1 << DIGIT_BITS) - 1; - } else { - q = ((m2 << DIGIT_BITS) + m1) / m_n; - } - - uint32_t n_q = ((uint32_t)m2 << (2 * DIGIT_BITS)) + (m1 << DIGIT_BITS) + m0; - digit_t q_final = q + 1; - uint32_t qn; - - do { - q_final--; - qn = mult16(n_div, q_final); - } while (qn > n_q); - - unsigned current_d = d; - d--; - - digit_t qn_arr[NUM_DIGITS * 2]; - for (int k = 0; k < NUM_DIGITS * 2; k++) { - qn_arr[k] = 0; - } - - unsigned mul_offset = current_d - NUM_DIGITS; - digit_t mul_c = 0; - - for (i = mul_offset; i < 2 * NUM_DIGITS; ++i) { - digit_t m_curr = mul_c; - if (i < mul_offset + NUM_DIGITS) { - m_curr += q_final * pubkey.n[i - mul_offset]; - } - mul_c = m_curr >> DIGIT_BITS; - qn_arr[i] = m_curr & DIGIT_MASK; - } - - char relation = '='; - for (i = NUM_DIGITS * 2 - 1; i >= 0; --i) { - if (g_product[i] > qn_arr[i]) { - relation = '>'; - break; - } else if (g_product[i] < qn_arr[i]) { - relation = '<'; - break; - } - } - - if (relation == '<') { - unsigned add_offset = current_d - NUM_DIGITS; - digit_t add_c = 0; - for (i = add_offset; i < 2 * NUM_DIGITS; ++i) { - digit_t add_n = (i < add_offset + NUM_DIGITS) ? pubkey.n[i - add_offset] : 0; - digit_t add_r = add_c + g_product[i] + add_n; - add_c = add_r >> DIGIT_BITS; - g_product[i] = add_r & DIGIT_MASK; - } - } - - unsigned sub_offset = current_d - NUM_DIGITS; - unsigned sub_borrow = 0; - - for (i = 0; i < 2 * NUM_DIGITS; ++i) { - if (i >= sub_offset) { - digit_t sub_qn = qn_arr[i]; - digit_t sub_s = sub_qn + sub_borrow; - - if (g_product[i] < sub_s) { - g_product[i] += (1 << DIGIT_BITS); - sub_borrow = 1; - } else { - sub_borrow = 0; - } - g_product[i] = g_product[i] - sub_s; - } - } - } - } - - // Copy result to output buffer - for (i = 0; i < NUM_DIGITS; i++) { - result_buffer[i] = g_product[i]; - } -} - -__attribute__((noinline)) int main(void) { - BENCH_INIT(); - unsigned message_length = sizeof(PLAINTEXT) - 1; - unsigned block_offset = 0; - - // Main Loop handling blocks - while (block_offset < message_length) { - - // Construct the base for this block - int i; - for (i = 0; i < NUM_DIGITS - NUM_PAD_DIGITS; ++i) { - g_base[i] = (block_offset + i < message_length) ? PLAINTEXT[block_offset + i] : 0xFF; - } - for (int j = 0; i < NUM_DIGITS; ++i, ++j) { - g_base[i] = PAD_DIGITS[j]; - } - - // Initialize block (which accumulates result) to 1 - g_block[0] = 1; - for (i = 1; i < NUM_DIGITS; ++i) { - g_block[i] = 0; - } - - digit_t e = pubkey.e; - block_offset += NUM_DIGITS - NUM_PAD_DIGITS; - - // Modular Exponentiation - while (e > 0) { - bool multiply = e & 0x1; - e >>= 1; - - if (multiply) { - // block = (block * base) % N - for (int k = 0; k < NUM_DIGITS; k++) { - g_A[k] = g_base[k]; - } - for (int k = 0; k < NUM_DIGITS; k++) { - g_B[k] = g_block[k]; - } - - mult_mod_operation(g_A, g_B, g_block); - } - - if (e > 0) { - // base = (base * base) % N - for (int k = 0; k < NUM_DIGITS; k++) { - g_A[k] = g_base[k]; - } - for (int k = 0; k < NUM_DIGITS; k++) { - g_B[k] = g_base[k]; - } - - mult_mod_operation(g_A, g_B, g_base); - } - } - - // Save block to cyphertext - if (g_cyphertext_len + NUM_DIGITS <= CYPHERTEXT_SIZE) { - for (i = 0; i < NUM_DIGITS; ++i) { - g_cyphertext[g_cyphertext_len++] = g_block[i]; - } - } - } - - BENCH_EXIT((int)g_cyphertext_len); - return (int)g_cyphertext_len; -} diff --git a/benchmarks/intermittent/test.c b/benchmarks/intermittent/test.c deleted file mode 100644 index 67fb2bd..0000000 --- a/benchmarks/intermittent/test.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Minimal test benchmark: single loop summing array elements. - * - * Expected result: 1024 * 42 = 43008. - * Uses a 1024-element array so the compiler cannot unroll the loop. - * Useful for verifying checkpoint insertion with minimal noise. - */ - -#include "benchmark.h" -#include "loop_tripcount.h" -#include - -#define N 1024 - -static int data[N] __attribute__((used)) = {[0 ... 1023] = 42}; - -__attribute__((noinline)) int main(void) { - BENCH_INIT(); - - int sum = 0; - for (int i = 0; i < N; ++i) { - __loop_tripcount(N); - sum += data[i]; - } - - BENCH_EXIT(sum); - return sum; -} diff --git a/scripts/plot_results.R b/scripts/plot_results.R index d05a20e..6ab8902 100644 --- a/scripts/plot_results.R +++ b/scripts/plot_results.R @@ -738,8 +738,7 @@ main <- function() { if (!is.null(filter_benchmarks)) { benchmarks <- filter_benchmarks[filter_benchmarks %in% all_benchmarks] } else { - real <- setdiff(all_benchmarks, "test") - benchmarks <- sort(if (length(real) > 0) real else all_benchmarks) + benchmarks <- sort(all_benchmarks) } if (length(benchmarks) == 0) stop("No benchmarks found.") From 7cca66436379e1f4f7febc7032c582a849d13bc9 Mon Sep 17 00:00:00 2001 From: Byeongjee Kang Date: Mon, 24 Aug 2026 13:40:04 -0400 Subject: [PATCH 3/3] Remove leftover debugging IR files from benchmarks/intermittent --- .../activity_recognition-271faceb.ll.tmp | 0 benchmarks/intermittent/cuckoo_filter_O1.ll | 314 -------- .../intermittent/cuckoo_filter_O1_unrolled.ll | 328 -------- .../cuckoo_filter_checkpointed.ll | 328 -------- .../cuckoo_filter_clang_unrolled.ll | 714 ----------------- .../cuckoo_filter_instrumented.ll | 296 ------- .../intermittent/cuckoo_filter_no_unroll.ll | 308 ------- .../intermittent/cuckoo_filter_simplified.ll | 757 ------------------ .../cuckoo_filter_unrolled_checkpointed.ll | 744 ----------------- .../cuckoo_filter_unrolled_out.ll | 744 ----------------- benchmarks/intermittent/rsa_checkpointed.ll | 621 -------------- 11 files changed, 5154 deletions(-) delete mode 100644 benchmarks/intermittent/activity_recognition-271faceb.ll.tmp delete mode 100644 benchmarks/intermittent/cuckoo_filter_O1.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_O1_unrolled.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_checkpointed.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_clang_unrolled.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_instrumented.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_no_unroll.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_simplified.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_unrolled_checkpointed.ll delete mode 100644 benchmarks/intermittent/cuckoo_filter_unrolled_out.ll delete mode 100644 benchmarks/intermittent/rsa_checkpointed.ll diff --git a/benchmarks/intermittent/activity_recognition-271faceb.ll.tmp b/benchmarks/intermittent/activity_recognition-271faceb.ll.tmp deleted file mode 100644 index e69de29..0000000 diff --git a/benchmarks/intermittent/cuckoo_filter_O1.ll b/benchmarks/intermittent/cuckoo_filter_O1.ll deleted file mode 100644 index e4a599d..0000000 --- a/benchmarks/intermittent/cuckoo_filter_O1.ll +++ /dev/null @@ -1,314 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter.c' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #2 { - %1 = alloca i16, align 2 - %2 = alloca i16, align 2 - %3 = alloca i16, align 2 - %4 = alloca i16, align 2 - %5 = alloca i16, align 2 - %6 = alloca i16, align 2 - %7 = alloca i16, align 2 - %8 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %10 - -9: ; preds = %108 - call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) - store volatile i32 0, ptr %8, align 4, !tbaa !10 - br label %113 - -10: ; preds = %0, %108 - %11 = phi i16 [ 1, %0 ], [ %15, %108 ] - %12 = phi i32 [ 0, %0 ], [ %110, %108 ] - %13 = phi i16 [ -21279, %0 ], [ %109, %108 ] - %14 = mul i16 %11, 17 - %15 = add i16 %14, 17 - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) - store i16 %15, ptr %7, align 2, !tbaa !6 - br label %16 - -16: ; preds = %16, %10 - %17 = phi i32 [ 0, %10 ], [ %25, %16 ] - %18 = phi i32 [ 5381, %10 ], [ %23, %16 ] - %19 = phi ptr [ %7, %10 ], [ %24, %16 ] - %20 = mul i32 %18, 33 - %21 = load i8, ptr %19, align 1, !tbaa !12 - %22 = zext i8 %21 to i32 - %23 = add i32 %20, %22 - %24 = getelementptr inbounds nuw i8, ptr %19, i64 1 - %25 = add nuw nsw i32 %17, 1 - %26 = icmp eq i32 %17, 0 - br i1 %26, label %16, label %27, !llvm.loop !13 - -27: ; preds = %16 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) - store i16 %15, ptr %6, align 2, !tbaa !6 - br label %28 - -28: ; preds = %28, %27 - %29 = phi i32 [ 0, %27 ], [ %37, %28 ] - %30 = phi i32 [ 5381, %27 ], [ %35, %28 ] - %31 = phi ptr [ %6, %27 ], [ %36, %28 ] - %32 = mul i32 %30, 33 - %33 = load i8, ptr %31, align 1, !tbaa !12 - %34 = zext i8 %33 to i32 - %35 = add i32 %32, %34 - %36 = getelementptr inbounds nuw i8, ptr %31, i64 1 - %37 = add nuw nsw i32 %29, 1 - %38 = icmp eq i32 %29, 0 - br i1 %38, label %28, label %39, !llvm.loop !13 - -39: ; preds = %28 - %40 = trunc i32 %23 to i16 - %41 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %40, i16 1) - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) - store i16 %41, ptr %5, align 2, !tbaa !6 - br label %42 - -42: ; preds = %42, %39 - %43 = phi i32 [ 0, %39 ], [ %51, %42 ] - %44 = phi i32 [ 5381, %39 ], [ %49, %42 ] - %45 = phi ptr [ %5, %39 ], [ %50, %42 ] - %46 = mul i32 %44, 33 - %47 = load i8, ptr %45, align 1, !tbaa !12 - %48 = zext i8 %47 to i32 - %49 = add i32 %46, %48 - %50 = getelementptr inbounds nuw i8, ptr %45, i64 1 - %51 = add nuw nsw i32 %43, 1 - %52 = icmp eq i32 %43, 0 - br i1 %52, label %42, label %53, !llvm.loop !13 - -53: ; preds = %42 - %54 = trunc i32 %35 to i16 - %55 = and i16 %54, 255 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) - %56 = xor i32 %49, %35 - %57 = trunc i32 %56 to i16 - %58 = and i16 %57, 255 - %59 = zext nneg i16 %55 to i64 - %60 = getelementptr inbounds nuw i16, ptr @filter, i64 %59 - %61 = load i16, ptr %60, align 2, !tbaa !6 - %62 = icmp eq i16 %61, 0 - br i1 %62, label %63, label %64 - -63: ; preds = %53 - store i16 %41, ptr %60, align 2, !tbaa !6 - br label %108 - -64: ; preds = %53 - %65 = zext nneg i16 %58 to i64 - %66 = getelementptr inbounds nuw i16, ptr @filter, i64 %65 - %67 = load i16, ptr %66, align 2, !tbaa !6 - %68 = icmp eq i16 %67, 0 - br i1 %68, label %69, label %70 - -69: ; preds = %64 - store i16 %41, ptr %66, align 2, !tbaa !6 - br label %108 - -70: ; preds = %64 - %71 = and i16 %13, 1 - %72 = icmp eq i16 %71, 0 - %73 = lshr i16 %13, 1 - %74 = xor i16 %73, -19456 - %75 = select i1 %72, i16 %73, i16 %74 - %76 = and i16 %75, 128 - %77 = icmp eq i16 %76, 0 - %78 = select i1 %77, i16 %58, i16 %55 - %79 = zext nneg i16 %78 to i64 - %80 = getelementptr inbounds nuw i16, ptr @filter, i64 %79 - %81 = load i16, ptr %80, align 2, !tbaa !6 - store i16 %41, ptr %80, align 2, !tbaa !6 - br label %82 - -82: ; preds = %97, %70 - %83 = phi i32 [ 0, %70 ], [ %104, %97 ] - %84 = phi i16 [ %78, %70 ], [ %100, %97 ] - %85 = phi i16 [ %81, %70 ], [ %103, %97 ] - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) - store i16 %85, ptr %4, align 2, !tbaa !6 - br label %86 - -86: ; preds = %86, %82 - %87 = phi i32 [ 0, %82 ], [ %95, %86 ] - %88 = phi i32 [ 5381, %82 ], [ %93, %86 ] - %89 = phi ptr [ %4, %82 ], [ %94, %86 ] - %90 = mul i32 %88, 33 - %91 = load i8, ptr %89, align 1, !tbaa !12 - %92 = zext i8 %91 to i32 - %93 = add i32 %90, %92 - %94 = getelementptr inbounds nuw i8, ptr %89, i64 1 - %95 = add nuw nsw i32 %87, 1 - %96 = icmp eq i32 %87, 0 - br i1 %96, label %86, label %97, !llvm.loop !13 - -97: ; preds = %86 - %98 = trunc i32 %93 to i16 - %99 = and i16 %98, 255 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) - %100 = xor i16 %99, %84 - %101 = zext nneg i16 %100 to i64 - %102 = getelementptr inbounds nuw i16, ptr @filter, i64 %101 - %103 = load i16, ptr %102, align 2, !tbaa !6 - store i16 %85, ptr %102, align 2, !tbaa !6 - %104 = add nuw nsw i32 %83, 1 - %105 = icmp ne i16 %103, 0 - %106 = icmp samesign ult i32 %83, 7 - %107 = select i1 %105, i1 %106, i1 false - br i1 %107, label %82, label %108, !llvm.loop !16 - -108: ; preds = %97, %63, %69 - %109 = phi i16 [ %13, %63 ], [ %13, %69 ], [ %75, %97 ] - %110 = add nuw nsw i32 %12, 1 - %111 = icmp eq i32 %110, 128 - br i1 %111, label %9, label %10, !llvm.loop !17 - -112: ; preds = %171 - call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) - ret i32 0 - -113: ; preds = %9, %171 - %114 = phi i32 [ 0, %9 ], [ %172, %171 ] - %115 = phi i16 [ 1, %9 ], [ %117, %171 ] - %116 = mul i16 %115, 17 - %117 = add i16 %116, 17 - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) - store i16 %117, ptr %3, align 2, !tbaa !6 - br label %118 - -118: ; preds = %118, %113 - %119 = phi i32 [ 0, %113 ], [ %127, %118 ] - %120 = phi i32 [ 5381, %113 ], [ %125, %118 ] - %121 = phi ptr [ %3, %113 ], [ %126, %118 ] - %122 = mul i32 %120, 33 - %123 = load i8, ptr %121, align 1, !tbaa !12 - %124 = zext i8 %123 to i32 - %125 = add i32 %122, %124 - %126 = getelementptr inbounds nuw i8, ptr %121, i64 1 - %127 = add nuw nsw i32 %119, 1 - %128 = icmp eq i32 %119, 0 - br i1 %128, label %118, label %129, !llvm.loop !13 - -129: ; preds = %118 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) - store i16 %117, ptr %2, align 2, !tbaa !6 - br label %130 - -130: ; preds = %130, %129 - %131 = phi i32 [ 0, %129 ], [ %139, %130 ] - %132 = phi i32 [ 5381, %129 ], [ %137, %130 ] - %133 = phi ptr [ %2, %129 ], [ %138, %130 ] - %134 = mul i32 %132, 33 - %135 = load i8, ptr %133, align 1, !tbaa !12 - %136 = zext i8 %135 to i32 - %137 = add i32 %134, %136 - %138 = getelementptr inbounds nuw i8, ptr %133, i64 1 - %139 = add nuw nsw i32 %131, 1 - %140 = icmp eq i32 %131, 0 - br i1 %140, label %130, label %141, !llvm.loop !13 - -141: ; preds = %130 - %142 = trunc i32 %125 to i16 - %143 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %142, i16 1) - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %1) - store i16 %143, ptr %1, align 2, !tbaa !6 - br label %144 - -144: ; preds = %144, %141 - %145 = phi i32 [ 0, %141 ], [ %153, %144 ] - %146 = phi i32 [ 5381, %141 ], [ %151, %144 ] - %147 = phi ptr [ %1, %141 ], [ %152, %144 ] - %148 = mul i32 %146, 33 - %149 = load i8, ptr %147, align 1, !tbaa !12 - %150 = zext i8 %149 to i32 - %151 = add i32 %148, %150 - %152 = getelementptr inbounds nuw i8, ptr %147, i64 1 - %153 = add nuw nsw i32 %145, 1 - %154 = icmp eq i32 %145, 0 - br i1 %154, label %144, label %155, !llvm.loop !13 - -155: ; preds = %144 - %156 = and i32 %137, 255 - %157 = zext nneg i32 %156 to i64 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %1) - %158 = getelementptr inbounds nuw i16, ptr @filter, i64 %157 - %159 = load i16, ptr %158, align 2, !tbaa !6 - %160 = icmp eq i16 %159, %143 - br i1 %160, label %168, label %161 - -161: ; preds = %155 - %162 = xor i32 %151, %137 - %163 = and i32 %162, 255 - %164 = zext nneg i32 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = icmp eq i16 %166, %143 - br i1 %167, label %168, label %171 - -168: ; preds = %155, %161 - %169 = load volatile i32, ptr %8, align 4, !tbaa !10 - %170 = add i32 %169, 1 - store volatile i32 %170, ptr %8, align 4, !tbaa !10 - br label %171 - -171: ; preds = %161, %168 - %172 = add nuw nsw i32 %114, 1 - %173 = icmp eq i32 %172, 128 - br i1 %173, label %112, label %113, !llvm.loop !18 -} - -; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) -declare i16 @llvm.umax.i16(i16, i16) #3 - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #4 - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -attributes #2 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } -attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = !{!8, !8, i64 0} -!13 = distinct !{!13, !14, !15} -!14 = !{!"llvm.loop.mustprogress"} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !14, !15} -!17 = distinct !{!17, !14, !15} -!18 = distinct !{!18, !14, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_O1_unrolled.ll b/benchmarks/intermittent/cuckoo_filter_O1_unrolled.ll deleted file mode 100644 index 0732a6d..0000000 --- a/benchmarks/intermittent/cuckoo_filter_O1_unrolled.ll +++ /dev/null @@ -1,328 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter_O1.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i16, align 2 - %2 = alloca i16, align 2 - %3 = alloca i16, align 2 - %4 = alloca i16, align 2 - %5 = alloca i16, align 2 - %6 = alloca i16, align 2 - %7 = alloca i16, align 2 - %8 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %10 - -9: ; preds = %108 - call void @llvm.lifetime.start.p0(ptr %8) - store volatile i32 0, ptr %8, align 4, !tbaa !10 - br label %113 - -10: ; preds = %108, %0 - %11 = phi i16 [ 1, %0 ], [ %15, %108 ] - %12 = phi i32 [ 0, %0 ], [ %110, %108 ] - %13 = phi i16 [ -21279, %0 ], [ %109, %108 ] - %14 = mul i16 %11, 17 - %15 = add i16 %14, 17 - call void @llvm.lifetime.start.p0(ptr %7) - store i16 %15, ptr %7, align 2, !tbaa !6 - br label %16 - -16: ; preds = %16, %10 - %17 = phi i32 [ 0, %10 ], [ %25, %16 ] - %18 = phi i32 [ 5381, %10 ], [ %23, %16 ] - %19 = phi ptr [ %7, %10 ], [ %24, %16 ] - %20 = mul i32 %18, 33 - %21 = load i8, ptr %19, align 1, !tbaa !12 - %22 = zext i8 %21 to i32 - %23 = add i32 %20, %22 - %24 = getelementptr inbounds nuw i8, ptr %19, i64 1 - %25 = add nuw nsw i32 %17, 1 - %26 = icmp eq i32 %17, 0 - br i1 %26, label %16, label %27, !llvm.loop !13 - -27: ; preds = %16 - %.lcssa3 = phi i32 [ %23, %16 ] - call void @llvm.lifetime.end.p0(ptr %7) - call void @llvm.lifetime.start.p0(ptr %6) - store i16 %15, ptr %6, align 2, !tbaa !6 - br label %28 - -28: ; preds = %28, %27 - %29 = phi i32 [ 0, %27 ], [ %37, %28 ] - %30 = phi i32 [ 5381, %27 ], [ %35, %28 ] - %31 = phi ptr [ %6, %27 ], [ %36, %28 ] - %32 = mul i32 %30, 33 - %33 = load i8, ptr %31, align 1, !tbaa !12 - %34 = zext i8 %33 to i32 - %35 = add i32 %32, %34 - %36 = getelementptr inbounds nuw i8, ptr %31, i64 1 - %37 = add nuw nsw i32 %29, 1 - %38 = icmp eq i32 %29, 0 - br i1 %38, label %28, label %39, !llvm.loop !13 - -39: ; preds = %28 - %.lcssa4 = phi i32 [ %35, %28 ] - %40 = trunc i32 %.lcssa3 to i16 - %41 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %40, i16 1) - call void @llvm.lifetime.end.p0(ptr %6) - call void @llvm.lifetime.start.p0(ptr %5) - store i16 %41, ptr %5, align 2, !tbaa !6 - br label %42 - -42: ; preds = %42, %39 - %43 = phi i32 [ 0, %39 ], [ %51, %42 ] - %44 = phi i32 [ 5381, %39 ], [ %49, %42 ] - %45 = phi ptr [ %5, %39 ], [ %50, %42 ] - %46 = mul i32 %44, 33 - %47 = load i8, ptr %45, align 1, !tbaa !12 - %48 = zext i8 %47 to i32 - %49 = add i32 %46, %48 - %50 = getelementptr inbounds nuw i8, ptr %45, i64 1 - %51 = add nuw nsw i32 %43, 1 - %52 = icmp eq i32 %43, 0 - br i1 %52, label %42, label %53, !llvm.loop !13 - -53: ; preds = %42 - %.lcssa5 = phi i32 [ %49, %42 ] - %54 = trunc i32 %.lcssa4 to i16 - %55 = and i16 %54, 255 - call void @llvm.lifetime.end.p0(ptr %5) - %56 = xor i32 %.lcssa5, %.lcssa4 - %57 = trunc i32 %56 to i16 - %58 = and i16 %57, 255 - %59 = zext nneg i16 %55 to i64 - %60 = getelementptr inbounds nuw i16, ptr @filter, i64 %59 - %61 = load i16, ptr %60, align 2, !tbaa !6 - %62 = icmp eq i16 %61, 0 - br i1 %62, label %63, label %64 - -63: ; preds = %53 - store i16 %41, ptr %60, align 2, !tbaa !6 - br label %108 - -64: ; preds = %53 - %65 = zext nneg i16 %58 to i64 - %66 = getelementptr inbounds nuw i16, ptr @filter, i64 %65 - %67 = load i16, ptr %66, align 2, !tbaa !6 - %68 = icmp eq i16 %67, 0 - br i1 %68, label %69, label %70 - -69: ; preds = %64 - store i16 %41, ptr %66, align 2, !tbaa !6 - br label %108 - -70: ; preds = %64 - %71 = and i16 %13, 1 - %72 = icmp eq i16 %71, 0 - %73 = lshr i16 %13, 1 - %74 = xor i16 %73, -19456 - %75 = select i1 %72, i16 %73, i16 %74 - %76 = and i16 %75, 128 - %77 = icmp eq i16 %76, 0 - %78 = select i1 %77, i16 %58, i16 %55 - %79 = zext nneg i16 %78 to i64 - %80 = getelementptr inbounds nuw i16, ptr @filter, i64 %79 - %81 = load i16, ptr %80, align 2, !tbaa !6 - store i16 %41, ptr %80, align 2, !tbaa !6 - br label %82 - -82: ; preds = %97, %70 - %83 = phi i32 [ 0, %70 ], [ %104, %97 ] - %84 = phi i16 [ %78, %70 ], [ %100, %97 ] - %85 = phi i16 [ %81, %70 ], [ %103, %97 ] - call void @llvm.lifetime.start.p0(ptr %4) - store i16 %85, ptr %4, align 2, !tbaa !6 - br label %86 - -86: ; preds = %86, %82 - %87 = phi i32 [ 0, %82 ], [ %95, %86 ] - %88 = phi i32 [ 5381, %82 ], [ %93, %86 ] - %89 = phi ptr [ %4, %82 ], [ %94, %86 ] - %90 = mul i32 %88, 33 - %91 = load i8, ptr %89, align 1, !tbaa !12 - %92 = zext i8 %91 to i32 - %93 = add i32 %90, %92 - %94 = getelementptr inbounds nuw i8, ptr %89, i64 1 - %95 = add nuw nsw i32 %87, 1 - %96 = icmp eq i32 %87, 0 - br i1 %96, label %86, label %97, !llvm.loop !13 - -97: ; preds = %86 - %.lcssa6 = phi i32 [ %93, %86 ] - %98 = trunc i32 %.lcssa6 to i16 - %99 = and i16 %98, 255 - call void @llvm.lifetime.end.p0(ptr %4) - %100 = xor i16 %99, %84 - %101 = zext nneg i16 %100 to i64 - %102 = getelementptr inbounds nuw i16, ptr @filter, i64 %101 - %103 = load i16, ptr %102, align 2, !tbaa !6 - store i16 %85, ptr %102, align 2, !tbaa !6 - %104 = add nuw nsw i32 %83, 1 - %105 = icmp ne i16 %103, 0 - %106 = icmp samesign ult i32 %83, 7 - %107 = select i1 %105, i1 %106, i1 false - br i1 %107, label %82, label %.loopexit, !llvm.loop !16 - -.loopexit: ; preds = %97 - br label %108 - -108: ; preds = %.loopexit, %69, %63 - %109 = phi i16 [ %13, %63 ], [ %13, %69 ], [ %75, %.loopexit ] - %110 = add nuw nsw i32 %12, 1 - %111 = icmp eq i32 %110, 128 - br i1 %111, label %9, label %10, !llvm.loop !17 - -112: ; preds = %171 - call void @llvm.lifetime.end.p0(ptr %8) - ret i32 0 - -113: ; preds = %171, %9 - %114 = phi i32 [ 0, %9 ], [ %172, %171 ] - %115 = phi i16 [ 1, %9 ], [ %117, %171 ] - %116 = mul i16 %115, 17 - %117 = add i16 %116, 17 - call void @llvm.lifetime.start.p0(ptr %3) - store i16 %117, ptr %3, align 2, !tbaa !6 - br label %118 - -118: ; preds = %118, %113 - %119 = phi i32 [ 0, %113 ], [ %127, %118 ] - %120 = phi i32 [ 5381, %113 ], [ %125, %118 ] - %121 = phi ptr [ %3, %113 ], [ %126, %118 ] - %122 = mul i32 %120, 33 - %123 = load i8, ptr %121, align 1, !tbaa !12 - %124 = zext i8 %123 to i32 - %125 = add i32 %122, %124 - %126 = getelementptr inbounds nuw i8, ptr %121, i64 1 - %127 = add nuw nsw i32 %119, 1 - %128 = icmp eq i32 %119, 0 - br i1 %128, label %118, label %129, !llvm.loop !13 - -129: ; preds = %118 - %.lcssa = phi i32 [ %125, %118 ] - call void @llvm.lifetime.end.p0(ptr %3) - call void @llvm.lifetime.start.p0(ptr %2) - store i16 %117, ptr %2, align 2, !tbaa !6 - br label %130 - -130: ; preds = %130, %129 - %131 = phi i32 [ 0, %129 ], [ %139, %130 ] - %132 = phi i32 [ 5381, %129 ], [ %137, %130 ] - %133 = phi ptr [ %2, %129 ], [ %138, %130 ] - %134 = mul i32 %132, 33 - %135 = load i8, ptr %133, align 1, !tbaa !12 - %136 = zext i8 %135 to i32 - %137 = add i32 %134, %136 - %138 = getelementptr inbounds nuw i8, ptr %133, i64 1 - %139 = add nuw nsw i32 %131, 1 - %140 = icmp eq i32 %131, 0 - br i1 %140, label %130, label %141, !llvm.loop !13 - -141: ; preds = %130 - %.lcssa1 = phi i32 [ %137, %130 ] - %142 = trunc i32 %.lcssa to i16 - %143 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %142, i16 1) - call void @llvm.lifetime.end.p0(ptr %2) - call void @llvm.lifetime.start.p0(ptr %1) - store i16 %143, ptr %1, align 2, !tbaa !6 - br label %144 - -144: ; preds = %144, %141 - %145 = phi i32 [ 0, %141 ], [ %153, %144 ] - %146 = phi i32 [ 5381, %141 ], [ %151, %144 ] - %147 = phi ptr [ %1, %141 ], [ %152, %144 ] - %148 = mul i32 %146, 33 - %149 = load i8, ptr %147, align 1, !tbaa !12 - %150 = zext i8 %149 to i32 - %151 = add i32 %148, %150 - %152 = getelementptr inbounds nuw i8, ptr %147, i64 1 - %153 = add nuw nsw i32 %145, 1 - %154 = icmp eq i32 %145, 0 - br i1 %154, label %144, label %155, !llvm.loop !13 - -155: ; preds = %144 - %.lcssa2 = phi i32 [ %151, %144 ] - %156 = and i32 %.lcssa1, 255 - %157 = zext nneg i32 %156 to i64 - call void @llvm.lifetime.end.p0(ptr %1) - %158 = getelementptr inbounds nuw i16, ptr @filter, i64 %157 - %159 = load i16, ptr %158, align 2, !tbaa !6 - %160 = icmp eq i16 %159, %143 - br i1 %160, label %168, label %161 - -161: ; preds = %155 - %162 = xor i32 %.lcssa2, %.lcssa1 - %163 = and i32 %162, 255 - %164 = zext nneg i32 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = icmp eq i16 %166, %143 - br i1 %167, label %168, label %171 - -168: ; preds = %161, %155 - %169 = load volatile i32, ptr %8, align 4, !tbaa !10 - %170 = add i32 %169, 1 - store volatile i32 %170, ptr %8, align 4, !tbaa !10 - br label %171 - -171: ; preds = %168, %161 - %172 = add nuw nsw i32 %114, 1 - %173 = icmp eq i32 %172, 128 - br i1 %173, label %112, label %113, !llvm.loop !18 -} - -; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) -declare i16 @llvm.umax.i16(i16, i16) #2 - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #3 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #4 - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) } -attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = !{!8, !8, i64 0} -!13 = distinct !{!13, !14, !15} -!14 = !{!"llvm.loop.mustprogress"} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !14, !15} -!17 = distinct !{!17, !14, !15} -!18 = distinct !{!18, !14, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_checkpointed.ll b/benchmarks/intermittent/cuckoo_filter_checkpointed.ll deleted file mode 100644 index ecb8b5e..0000000 --- a/benchmarks/intermittent/cuckoo_filter_checkpointed.ll +++ /dev/null @@ -1,328 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb3\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [4 x i8] c"bb5\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [4 x i8] c"bb7\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.4 = private unnamed_addr constant [5 x i8] c"bb19\00", align 1 -@checkpoint_name.5 = private unnamed_addr constant [5 x i8] c"bb21\00", align 1 -@checkpoint_name.6 = private unnamed_addr constant [5 x i8] c"bb23\00", align 1 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i16, align 2 - %2 = alloca i16, align 2 - %3 = alloca i16, align 2 - %4 = alloca i16, align 2 - %5 = alloca i16, align 2 - %6 = alloca i16, align 2 - %7 = alloca i16, align 2 - %8 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %10 - -9: ; preds = %105 - call void @llvm.lifetime.start.p0(ptr %8) - store volatile i32 0, ptr %8, align 4, !tbaa !10 - br label %110 - -10: ; preds = %105, %0 - %11 = phi i16 [ 1, %0 ], [ %15, %105 ] - %12 = phi i32 [ 0, %0 ], [ %107, %105 ] - %13 = phi i16 [ -21279, %0 ], [ %106, %105 ] - %14 = mul i16 %11, 17 - %15 = add i16 %14, 17 - call void @llvm.lifetime.start.p0(ptr %7) - store i16 %15, ptr %7, align 2, !tbaa !6 - br label %16 - -16: ; preds = %16, %10 - %17 = phi i32 [ 5381, %10 ], [ %23, %16 ] - %18 = phi i64 [ 0, %10 ], [ %24, %16 ] - call void @__checkpoint(ptr @checkpoint_name) - %19 = getelementptr inbounds nuw i8, ptr %7, i64 %18 - %20 = mul i32 %17, 33 - %21 = load i8, ptr %19, align 1, !tbaa !12 - %22 = zext i8 %21 to i32 - %23 = add i32 %20, %22 - %24 = add nuw nsw i64 %18, 1 - %25 = icmp eq i64 %18, 1 - br i1 %25, label %26, label %16, !llvm.loop !13 - -26: ; preds = %16 - call void @llvm.lifetime.end.p0(ptr %7) - call void @llvm.lifetime.start.p0(ptr %6) - store i16 %15, ptr %6, align 2, !tbaa !6 - br label %27 - -27: ; preds = %27, %26 - %28 = phi i32 [ 5381, %26 ], [ %34, %27 ] - %29 = phi i64 [ 0, %26 ], [ %35, %27 ] - call void @__checkpoint(ptr @checkpoint_name.1) - %30 = getelementptr inbounds nuw i8, ptr %6, i64 %29 - %31 = mul i32 %28, 33 - %32 = load i8, ptr %30, align 1, !tbaa !12 - %33 = zext i8 %32 to i32 - %34 = add i32 %31, %33 - %35 = add nuw nsw i64 %29, 1 - %36 = icmp eq i64 %29, 1 - br i1 %36, label %37, label %27, !llvm.loop !13 - -37: ; preds = %27 - %38 = trunc i32 %23 to i16 - %39 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %38, i16 1) - call void @llvm.lifetime.end.p0(ptr %6) - call void @llvm.lifetime.start.p0(ptr %5) - store i16 %39, ptr %5, align 2, !tbaa !6 - br label %40 - -40: ; preds = %40, %37 - %41 = phi i32 [ 5381, %37 ], [ %47, %40 ] - %42 = phi i64 [ 0, %37 ], [ %48, %40 ] - call void @__checkpoint(ptr @checkpoint_name.2) - %43 = getelementptr inbounds nuw i8, ptr %5, i64 %42 - %44 = mul i32 %41, 33 - %45 = load i8, ptr %43, align 1, !tbaa !12 - %46 = zext i8 %45 to i32 - %47 = add i32 %44, %46 - %48 = add nuw nsw i64 %42, 1 - %49 = icmp eq i64 %42, 1 - br i1 %49, label %50, label %40, !llvm.loop !13 - -50: ; preds = %40 - %51 = trunc i32 %34 to i16 - %52 = and i16 %51, 255 - call void @llvm.lifetime.end.p0(ptr %5) - %53 = xor i32 %47, %34 - %54 = trunc i32 %53 to i16 - %55 = and i16 %54, 255 - %56 = zext nneg i16 %52 to i64 - %57 = getelementptr inbounds nuw i16, ptr @filter, i64 %56 - %58 = load i16, ptr %57, align 2, !tbaa !6 - %59 = icmp eq i16 %58, 0 - br i1 %59, label %60, label %61 - -60: ; preds = %50 - store i16 %39, ptr %57, align 2, !tbaa !6 - br label %105 - -61: ; preds = %50 - %62 = zext nneg i16 %55 to i64 - %63 = getelementptr inbounds nuw i16, ptr @filter, i64 %62 - %64 = load i16, ptr %63, align 2, !tbaa !6 - %65 = icmp eq i16 %64, 0 - br i1 %65, label %66, label %67 - -66: ; preds = %61 - store i16 %39, ptr %63, align 2, !tbaa !6 - br label %105 - -67: ; preds = %61 - %68 = and i16 %13, 1 - %69 = icmp eq i16 %68, 0 - %70 = lshr i16 %13, 1 - %71 = xor i16 %70, -19456 - %72 = select i1 %69, i16 %70, i16 %71 - %73 = and i16 %72, 128 - %74 = icmp eq i16 %73, 0 - %75 = select i1 %74, i16 %55, i16 %52 - %76 = zext nneg i16 %75 to i64 - %77 = getelementptr inbounds nuw i16, ptr @filter, i64 %76 - %78 = load i16, ptr %77, align 2, !tbaa !6 - store i16 %39, ptr %77, align 2, !tbaa !6 - br label %79 - -79: ; preds = %93, %67 - %80 = phi i32 [ 0, %67 ], [ %101, %93 ] - %81 = phi i16 [ %75, %67 ], [ %96, %93 ] - %82 = phi i16 [ %78, %67 ], [ %100, %93 ] - call void @llvm.lifetime.start.p0(ptr %4) - store i16 %82, ptr %4, align 2, !tbaa !6 - br label %83 - -83: ; preds = %83, %79 - %84 = phi i32 [ 5381, %79 ], [ %90, %83 ] - %85 = phi i64 [ 0, %79 ], [ %91, %83 ] - call void @__checkpoint(ptr @checkpoint_name.3) - %86 = getelementptr inbounds nuw i8, ptr %4, i64 %85 - %87 = mul i32 %84, 33 - %88 = load i8, ptr %86, align 1, !tbaa !12 - %89 = zext i8 %88 to i32 - %90 = add i32 %87, %89 - %91 = add nuw nsw i64 %85, 1 - %92 = icmp eq i64 %85, 1 - br i1 %92, label %93, label %83, !llvm.loop !13 - -93: ; preds = %83 - %94 = trunc i32 %90 to i16 - %95 = and i16 %94, 255 - call void @llvm.lifetime.end.p0(ptr %4) - %96 = xor i16 %95, %81 - %97 = zext nneg i16 %96 to i64 - %98 = getelementptr inbounds nuw i16, ptr @filter, i64 %97 - %99 = load i16, ptr %98, align 2, !tbaa !6 - %100 = freeze i16 %99 - store i16 %82, ptr %98, align 2, !tbaa !6 - %101 = add nuw nsw i32 %80, 1 - %102 = icmp ne i16 %100, 0 - %103 = icmp samesign ult i32 %80, 7 - %104 = select i1 %102, i1 %103, i1 false - br i1 %104, label %79, label %105, !llvm.loop !16 - -105: ; preds = %93, %66, %60 - %106 = phi i16 [ %13, %60 ], [ %13, %66 ], [ %72, %93 ] - %107 = add nuw nsw i32 %12, 1 - %108 = icmp eq i32 %107, 128 - br i1 %108, label %9, label %10, !llvm.loop !17 - -109: ; preds = %165 - call void @llvm.lifetime.end.p0(ptr %8) - ret i32 0 - -110: ; preds = %165, %9 - %111 = phi i32 [ 0, %9 ], [ %166, %165 ] - %112 = phi i16 [ 1, %9 ], [ %114, %165 ] - %113 = mul i16 %112, 17 - %114 = add i16 %113, 17 - call void @llvm.lifetime.start.p0(ptr %3) - store i16 %114, ptr %3, align 2, !tbaa !6 - br label %115 - -115: ; preds = %115, %110 - %116 = phi i32 [ 5381, %110 ], [ %122, %115 ] - %117 = phi i64 [ 0, %110 ], [ %123, %115 ] - call void @__checkpoint(ptr @checkpoint_name.4) - %118 = getelementptr inbounds nuw i8, ptr %3, i64 %117 - %119 = mul i32 %116, 33 - %120 = load i8, ptr %118, align 1, !tbaa !12 - %121 = zext i8 %120 to i32 - %122 = add i32 %119, %121 - %123 = add nuw nsw i64 %117, 1 - %124 = icmp eq i64 %117, 1 - br i1 %124, label %125, label %115, !llvm.loop !13 - -125: ; preds = %115 - call void @llvm.lifetime.end.p0(ptr %3) - call void @llvm.lifetime.start.p0(ptr %2) - store i16 %114, ptr %2, align 2, !tbaa !6 - br label %126 - -126: ; preds = %126, %125 - %127 = phi i32 [ 5381, %125 ], [ %133, %126 ] - %128 = phi i64 [ 0, %125 ], [ %134, %126 ] - call void @__checkpoint(ptr @checkpoint_name.5) - %129 = getelementptr inbounds nuw i8, ptr %2, i64 %128 - %130 = mul i32 %127, 33 - %131 = load i8, ptr %129, align 1, !tbaa !12 - %132 = zext i8 %131 to i32 - %133 = add i32 %130, %132 - %134 = add nuw nsw i64 %128, 1 - %135 = icmp eq i64 %128, 1 - br i1 %135, label %136, label %126, !llvm.loop !13 - -136: ; preds = %126 - %137 = trunc i32 %122 to i16 - %138 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %137, i16 1) - call void @llvm.lifetime.end.p0(ptr %2) - call void @llvm.lifetime.start.p0(ptr %1) - store i16 %138, ptr %1, align 2, !tbaa !6 - br label %139 - -139: ; preds = %139, %136 - %140 = phi i32 [ 5381, %136 ], [ %146, %139 ] - %141 = phi i64 [ 0, %136 ], [ %147, %139 ] - call void @__checkpoint(ptr @checkpoint_name.6) - %142 = getelementptr inbounds nuw i8, ptr %1, i64 %141 - %143 = mul i32 %140, 33 - %144 = load i8, ptr %142, align 1, !tbaa !12 - %145 = zext i8 %144 to i32 - %146 = add i32 %143, %145 - %147 = add nuw nsw i64 %141, 1 - %148 = icmp eq i64 %141, 1 - br i1 %148, label %149, label %139, !llvm.loop !13 - -149: ; preds = %139 - %150 = and i32 %133, 255 - %151 = zext nneg i32 %150 to i64 - call void @llvm.lifetime.end.p0(ptr %1) - %152 = getelementptr inbounds nuw i16, ptr @filter, i64 %151 - %153 = load i16, ptr %152, align 2, !tbaa !6 - %154 = icmp eq i16 %153, %138 - br i1 %154, label %162, label %155 - -155: ; preds = %149 - %156 = xor i32 %146, %133 - %157 = and i32 %156, 255 - %158 = zext nneg i32 %157 to i64 - %159 = getelementptr inbounds nuw i16, ptr @filter, i64 %158 - %160 = load i16, ptr %159, align 2, !tbaa !6 - %161 = icmp eq i16 %160, %138 - br i1 %161, label %162, label %165 - -162: ; preds = %155, %149 - %163 = load volatile i32, ptr %8, align 4, !tbaa !10 - %164 = add i32 %163, 1 - store volatile i32 %164, ptr %8, align 4, !tbaa !10 - br label %165 - -165: ; preds = %162, %155 - %166 = add nuw nsw i32 %111, 1 - %167 = icmp eq i32 %166, 128 - br i1 %167, label %109, label %110, !llvm.loop !18 -} - -; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) -declare i16 @llvm.umax.i16(i16, i16) #2 - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #3 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #4 - -declare void @__checkpoint(ptr) - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) } -attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = !{!8, !8, i64 0} -!13 = distinct !{!13, !14, !15} -!14 = !{!"llvm.loop.mustprogress"} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !14, !15} -!17 = distinct !{!17, !14, !15} -!18 = distinct !{!18, !14, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_clang_unrolled.ll b/benchmarks/intermittent/cuckoo_filter_clang_unrolled.ll deleted file mode 100644 index c9fcada..0000000 --- a/benchmarks/intermittent/cuckoo_filter_clang_unrolled.ll +++ /dev/null @@ -1,714 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter.c' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #2 { - %1 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %3 - -2: ; preds = %393 - call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) - store volatile i32 0, ptr %1, align 4, !tbaa !10 - br label %398 - -3: ; preds = %393, %0 - %4 = phi i16 [ 1, %0 ], [ %299, %393 ] - %5 = phi i32 [ 0, %0 ], [ %395, %393 ] - %6 = phi i16 [ -21279, %0 ], [ %394, %393 ] - %7 = mul i16 %4, 17 - %8 = add i16 %7, 17 - %9 = lshr i16 %8, 8 - %10 = and i16 %8, 255 - %11 = mul nuw nsw i16 %10, 33 - %12 = add nuw nsw i16 %9, 27205 - %13 = add nuw i16 %12, %11 - %14 = mul i16 %8, 33 - %15 = add i16 %14, 69 - %16 = add i16 %15, %9 - %17 = and i16 %16, 255 - %18 = lshr i16 %13, 8 - %19 = mul i16 %13, 33 - %20 = add i16 %19, 69 - %21 = add i16 %20, %18 - %22 = xor i16 %21, %16 - %23 = and i16 %22, 255 - %24 = zext nneg i16 %17 to i64 - %25 = getelementptr inbounds nuw i16, ptr @filter, i64 %24 - %26 = load i16, ptr %25, align 2, !tbaa !6 - %27 = icmp eq i16 %26, 0 - br i1 %27, label %28, label %29 - -28: ; preds = %3 - store i16 %13, ptr %25, align 2, !tbaa !6 - br label %102 - -29: ; preds = %3 - %30 = zext nneg i16 %23 to i64 - %31 = getelementptr inbounds nuw i16, ptr @filter, i64 %30 - %32 = load i16, ptr %31, align 2, !tbaa !6 - %33 = icmp eq i16 %32, 0 - br i1 %33, label %34, label %35 - -34: ; preds = %29 - store i16 %13, ptr %31, align 2, !tbaa !6 - br label %102 - -35: ; preds = %29 - %36 = and i16 %6, 1 - %37 = icmp eq i16 %36, 0 - %38 = lshr i16 %6, 1 - %39 = xor i16 %38, -19456 - %40 = select i1 %37, i16 %38, i16 %39 - %41 = and i16 %40, 128 - %42 = icmp eq i16 %41, 0 - %43 = select i1 %42, i16 %23, i16 %17 - %44 = zext nneg i16 %43 to i64 - %45 = getelementptr inbounds nuw i16, ptr @filter, i64 %44 - %46 = load i16, ptr %45, align 2, !tbaa !6 - store i16 %13, ptr %45, align 2, !tbaa !6 - br label %47 - -47: ; preds = %86, %35 - %48 = phi i32 [ 0, %35 ], [ %98, %86 ] - %49 = phi i16 [ %43, %35 ], [ %93, %86 ] - %50 = phi i16 [ %46, %35 ], [ %97, %86 ] - %51 = lshr i16 %50, 8 - %52 = mul i16 %50, 33 - %53 = add i16 %52, 69 - %54 = add i16 %53, %51 - %55 = and i16 %54, 255 - %56 = xor i16 %55, %49 - %57 = zext nneg i16 %56 to i64 - %58 = getelementptr inbounds nuw i16, ptr @filter, i64 %57 - %59 = load i16, ptr %58, align 2, !tbaa !6 - %60 = freeze i16 %59 - store i16 %50, ptr %58, align 2, !tbaa !6 - %61 = icmp eq i16 %60, 0 - br i1 %61, label %102, label %62, !llvm.loop !12 - -62: ; preds = %47 - %63 = lshr i16 %60, 8 - %64 = mul i16 %60, 33 - %65 = add i16 %64, 69 - %66 = add i16 %65, %63 - %67 = and i16 %66, 255 - %68 = xor i16 %67, %56 - %69 = zext nneg i16 %68 to i64 - %70 = getelementptr inbounds nuw i16, ptr @filter, i64 %69 - %71 = load i16, ptr %70, align 2, !tbaa !6 - %72 = freeze i16 %71 - store i16 %60, ptr %70, align 2, !tbaa !6 - %73 = icmp eq i16 %72, 0 - br i1 %73, label %102, label %74, !llvm.loop !12 - -74: ; preds = %62 - %75 = lshr i16 %72, 8 - %76 = mul i16 %72, 33 - %77 = add i16 %76, 69 - %78 = add i16 %77, %75 - %79 = and i16 %78, 255 - %80 = xor i16 %79, %68 - %81 = zext nneg i16 %80 to i64 - %82 = getelementptr inbounds nuw i16, ptr @filter, i64 %81 - %83 = load i16, ptr %82, align 2, !tbaa !6 - %84 = freeze i16 %83 - store i16 %72, ptr %82, align 2, !tbaa !6 - %85 = icmp eq i16 %84, 0 - br i1 %85, label %102, label %86, !llvm.loop !12 - -86: ; preds = %74 - %87 = or disjoint i32 %48, 3 - %88 = lshr i16 %84, 8 - %89 = mul i16 %84, 33 - %90 = add i16 %89, 69 - %91 = add i16 %90, %88 - %92 = and i16 %91, 255 - %93 = xor i16 %92, %80 - %94 = zext nneg i16 %93 to i64 - %95 = getelementptr inbounds nuw i16, ptr @filter, i64 %94 - %96 = load i16, ptr %95, align 2, !tbaa !6 - %97 = freeze i16 %96 - store i16 %84, ptr %95, align 2, !tbaa !6 - %98 = add nuw nsw i32 %48, 4 - %99 = icmp ne i16 %97, 0 - %100 = icmp samesign ult i32 %87, 7 - %101 = select i1 %99, i1 %100, i1 false - br i1 %101, label %47, label %102, !llvm.loop !14 - -102: ; preds = %47, %62, %74, %86, %34, %28 - %103 = phi i16 [ %6, %28 ], [ %6, %34 ], [ %40, %86 ], [ %40, %74 ], [ %40, %62 ], [ %40, %47 ] - %104 = mul i16 %8, 17 - %105 = add i16 %104, 17 - %106 = lshr i16 %105, 8 - %107 = and i16 %105, 255 - %108 = mul nuw nsw i16 %107, 33 - %109 = add nuw nsw i16 %106, 27205 - %110 = add nuw i16 %109, %108 - %111 = mul i16 %105, 33 - %112 = add i16 %111, 69 - %113 = add i16 %112, %106 - %114 = and i16 %113, 255 - %115 = lshr i16 %110, 8 - %116 = mul i16 %110, 33 - %117 = add i16 %116, 69 - %118 = add i16 %117, %115 - %119 = xor i16 %118, %113 - %120 = and i16 %119, 255 - %121 = zext nneg i16 %114 to i64 - %122 = getelementptr inbounds nuw i16, ptr @filter, i64 %121 - %123 = load i16, ptr %122, align 2, !tbaa !6 - %124 = icmp eq i16 %123, 0 - br i1 %124, label %198, label %125 - -125: ; preds = %102 - %126 = zext nneg i16 %120 to i64 - %127 = getelementptr inbounds nuw i16, ptr @filter, i64 %126 - %128 = load i16, ptr %127, align 2, !tbaa !6 - %129 = icmp eq i16 %128, 0 - br i1 %129, label %197, label %130 - -130: ; preds = %125 - %131 = and i16 %103, 1 - %132 = icmp eq i16 %131, 0 - %133 = lshr i16 %103, 1 - %134 = xor i16 %133, -19456 - %135 = select i1 %132, i16 %133, i16 %134 - %136 = and i16 %135, 128 - %137 = icmp eq i16 %136, 0 - %138 = select i1 %137, i16 %120, i16 %114 - %139 = zext nneg i16 %138 to i64 - %140 = getelementptr inbounds nuw i16, ptr @filter, i64 %139 - %141 = load i16, ptr %140, align 2, !tbaa !6 - store i16 %110, ptr %140, align 2, !tbaa !6 - br label %142 - -142: ; preds = %181, %130 - %143 = phi i32 [ 0, %130 ], [ %193, %181 ] - %144 = phi i16 [ %138, %130 ], [ %188, %181 ] - %145 = phi i16 [ %141, %130 ], [ %192, %181 ] - %146 = lshr i16 %145, 8 - %147 = mul i16 %145, 33 - %148 = add i16 %147, 69 - %149 = add i16 %148, %146 - %150 = and i16 %149, 255 - %151 = xor i16 %150, %144 - %152 = zext nneg i16 %151 to i64 - %153 = getelementptr inbounds nuw i16, ptr @filter, i64 %152 - %154 = load i16, ptr %153, align 2, !tbaa !6 - %155 = freeze i16 %154 - store i16 %145, ptr %153, align 2, !tbaa !6 - %156 = icmp eq i16 %155, 0 - br i1 %156, label %199, label %157, !llvm.loop !12 - -157: ; preds = %142 - %158 = lshr i16 %155, 8 - %159 = mul i16 %155, 33 - %160 = add i16 %159, 69 - %161 = add i16 %160, %158 - %162 = and i16 %161, 255 - %163 = xor i16 %162, %151 - %164 = zext nneg i16 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = freeze i16 %166 - store i16 %155, ptr %165, align 2, !tbaa !6 - %168 = icmp eq i16 %167, 0 - br i1 %168, label %199, label %169, !llvm.loop !12 - -169: ; preds = %157 - %170 = lshr i16 %167, 8 - %171 = mul i16 %167, 33 - %172 = add i16 %171, 69 - %173 = add i16 %172, %170 - %174 = and i16 %173, 255 - %175 = xor i16 %174, %163 - %176 = zext nneg i16 %175 to i64 - %177 = getelementptr inbounds nuw i16, ptr @filter, i64 %176 - %178 = load i16, ptr %177, align 2, !tbaa !6 - %179 = freeze i16 %178 - store i16 %167, ptr %177, align 2, !tbaa !6 - %180 = icmp eq i16 %179, 0 - br i1 %180, label %199, label %181, !llvm.loop !12 - -181: ; preds = %169 - %182 = or disjoint i32 %143, 3 - %183 = lshr i16 %179, 8 - %184 = mul i16 %179, 33 - %185 = add i16 %184, 69 - %186 = add i16 %185, %183 - %187 = and i16 %186, 255 - %188 = xor i16 %187, %175 - %189 = zext nneg i16 %188 to i64 - %190 = getelementptr inbounds nuw i16, ptr @filter, i64 %189 - %191 = load i16, ptr %190, align 2, !tbaa !6 - %192 = freeze i16 %191 - store i16 %179, ptr %190, align 2, !tbaa !6 - %193 = add nuw nsw i32 %143, 4 - %194 = icmp ne i16 %192, 0 - %195 = icmp samesign ult i32 %182, 7 - %196 = select i1 %194, i1 %195, i1 false - br i1 %196, label %142, label %199, !llvm.loop !14 - -197: ; preds = %125 - store i16 %110, ptr %127, align 2, !tbaa !6 - br label %199 - -198: ; preds = %102 - store i16 %110, ptr %122, align 2, !tbaa !6 - br label %199 - -199: ; preds = %142, %157, %169, %181, %198, %197 - %200 = phi i16 [ %103, %198 ], [ %103, %197 ], [ %135, %181 ], [ %135, %169 ], [ %135, %157 ], [ %135, %142 ] - %201 = mul i16 %105, 17 - %202 = add i16 %201, 17 - %203 = lshr i16 %202, 8 - %204 = and i16 %202, 255 - %205 = mul nuw nsw i16 %204, 33 - %206 = add nuw nsw i16 %203, 27205 - %207 = add nuw i16 %206, %205 - %208 = mul i16 %202, 33 - %209 = add i16 %208, 69 - %210 = add i16 %209, %203 - %211 = and i16 %210, 255 - %212 = lshr i16 %207, 8 - %213 = mul i16 %207, 33 - %214 = add i16 %213, 69 - %215 = add i16 %214, %212 - %216 = xor i16 %215, %210 - %217 = and i16 %216, 255 - %218 = zext nneg i16 %211 to i64 - %219 = getelementptr inbounds nuw i16, ptr @filter, i64 %218 - %220 = load i16, ptr %219, align 2, !tbaa !6 - %221 = icmp eq i16 %220, 0 - br i1 %221, label %295, label %222 - -222: ; preds = %199 - %223 = zext nneg i16 %217 to i64 - %224 = getelementptr inbounds nuw i16, ptr @filter, i64 %223 - %225 = load i16, ptr %224, align 2, !tbaa !6 - %226 = icmp eq i16 %225, 0 - br i1 %226, label %294, label %227 - -227: ; preds = %222 - %228 = and i16 %200, 1 - %229 = icmp eq i16 %228, 0 - %230 = lshr i16 %200, 1 - %231 = xor i16 %230, -19456 - %232 = select i1 %229, i16 %230, i16 %231 - %233 = and i16 %232, 128 - %234 = icmp eq i16 %233, 0 - %235 = select i1 %234, i16 %217, i16 %211 - %236 = zext nneg i16 %235 to i64 - %237 = getelementptr inbounds nuw i16, ptr @filter, i64 %236 - %238 = load i16, ptr %237, align 2, !tbaa !6 - store i16 %207, ptr %237, align 2, !tbaa !6 - br label %239 - -239: ; preds = %278, %227 - %240 = phi i32 [ 0, %227 ], [ %290, %278 ] - %241 = phi i16 [ %235, %227 ], [ %285, %278 ] - %242 = phi i16 [ %238, %227 ], [ %289, %278 ] - %243 = lshr i16 %242, 8 - %244 = mul i16 %242, 33 - %245 = add i16 %244, 69 - %246 = add i16 %245, %243 - %247 = and i16 %246, 255 - %248 = xor i16 %247, %241 - %249 = zext nneg i16 %248 to i64 - %250 = getelementptr inbounds nuw i16, ptr @filter, i64 %249 - %251 = load i16, ptr %250, align 2, !tbaa !6 - %252 = freeze i16 %251 - store i16 %242, ptr %250, align 2, !tbaa !6 - %253 = icmp eq i16 %252, 0 - br i1 %253, label %296, label %254, !llvm.loop !12 - -254: ; preds = %239 - %255 = lshr i16 %252, 8 - %256 = mul i16 %252, 33 - %257 = add i16 %256, 69 - %258 = add i16 %257, %255 - %259 = and i16 %258, 255 - %260 = xor i16 %259, %248 - %261 = zext nneg i16 %260 to i64 - %262 = getelementptr inbounds nuw i16, ptr @filter, i64 %261 - %263 = load i16, ptr %262, align 2, !tbaa !6 - %264 = freeze i16 %263 - store i16 %252, ptr %262, align 2, !tbaa !6 - %265 = icmp eq i16 %264, 0 - br i1 %265, label %296, label %266, !llvm.loop !12 - -266: ; preds = %254 - %267 = lshr i16 %264, 8 - %268 = mul i16 %264, 33 - %269 = add i16 %268, 69 - %270 = add i16 %269, %267 - %271 = and i16 %270, 255 - %272 = xor i16 %271, %260 - %273 = zext nneg i16 %272 to i64 - %274 = getelementptr inbounds nuw i16, ptr @filter, i64 %273 - %275 = load i16, ptr %274, align 2, !tbaa !6 - %276 = freeze i16 %275 - store i16 %264, ptr %274, align 2, !tbaa !6 - %277 = icmp eq i16 %276, 0 - br i1 %277, label %296, label %278, !llvm.loop !12 - -278: ; preds = %266 - %279 = or disjoint i32 %240, 3 - %280 = lshr i16 %276, 8 - %281 = mul i16 %276, 33 - %282 = add i16 %281, 69 - %283 = add i16 %282, %280 - %284 = and i16 %283, 255 - %285 = xor i16 %284, %272 - %286 = zext nneg i16 %285 to i64 - %287 = getelementptr inbounds nuw i16, ptr @filter, i64 %286 - %288 = load i16, ptr %287, align 2, !tbaa !6 - %289 = freeze i16 %288 - store i16 %276, ptr %287, align 2, !tbaa !6 - %290 = add nuw nsw i32 %240, 4 - %291 = icmp ne i16 %289, 0 - %292 = icmp samesign ult i32 %279, 7 - %293 = select i1 %291, i1 %292, i1 false - br i1 %293, label %239, label %296, !llvm.loop !14 - -294: ; preds = %222 - store i16 %207, ptr %224, align 2, !tbaa !6 - br label %296 - -295: ; preds = %199 - store i16 %207, ptr %219, align 2, !tbaa !6 - br label %296 - -296: ; preds = %239, %254, %266, %278, %295, %294 - %297 = phi i16 [ %200, %295 ], [ %200, %294 ], [ %232, %278 ], [ %232, %266 ], [ %232, %254 ], [ %232, %239 ] - %298 = mul i16 %202, 17 - %299 = add i16 %298, 17 - %300 = lshr i16 %299, 8 - %301 = and i16 %299, 255 - %302 = mul nuw nsw i16 %301, 33 - %303 = add nuw nsw i16 %300, 27205 - %304 = add nuw i16 %303, %302 - %305 = mul i16 %299, 33 - %306 = add i16 %305, 69 - %307 = add i16 %306, %300 - %308 = and i16 %307, 255 - %309 = lshr i16 %304, 8 - %310 = mul i16 %304, 33 - %311 = add i16 %310, 69 - %312 = add i16 %311, %309 - %313 = xor i16 %312, %307 - %314 = and i16 %313, 255 - %315 = zext nneg i16 %308 to i64 - %316 = getelementptr inbounds nuw i16, ptr @filter, i64 %315 - %317 = load i16, ptr %316, align 2, !tbaa !6 - %318 = icmp eq i16 %317, 0 - br i1 %318, label %392, label %319 - -319: ; preds = %296 - %320 = zext nneg i16 %314 to i64 - %321 = getelementptr inbounds nuw i16, ptr @filter, i64 %320 - %322 = load i16, ptr %321, align 2, !tbaa !6 - %323 = icmp eq i16 %322, 0 - br i1 %323, label %391, label %324 - -324: ; preds = %319 - %325 = and i16 %297, 1 - %326 = icmp eq i16 %325, 0 - %327 = lshr i16 %297, 1 - %328 = xor i16 %327, -19456 - %329 = select i1 %326, i16 %327, i16 %328 - %330 = and i16 %329, 128 - %331 = icmp eq i16 %330, 0 - %332 = select i1 %331, i16 %314, i16 %308 - %333 = zext nneg i16 %332 to i64 - %334 = getelementptr inbounds nuw i16, ptr @filter, i64 %333 - %335 = load i16, ptr %334, align 2, !tbaa !6 - store i16 %304, ptr %334, align 2, !tbaa !6 - br label %336 - -336: ; preds = %375, %324 - %337 = phi i32 [ 0, %324 ], [ %387, %375 ] - %338 = phi i16 [ %332, %324 ], [ %382, %375 ] - %339 = phi i16 [ %335, %324 ], [ %386, %375 ] - %340 = lshr i16 %339, 8 - %341 = mul i16 %339, 33 - %342 = add i16 %341, 69 - %343 = add i16 %342, %340 - %344 = and i16 %343, 255 - %345 = xor i16 %344, %338 - %346 = zext nneg i16 %345 to i64 - %347 = getelementptr inbounds nuw i16, ptr @filter, i64 %346 - %348 = load i16, ptr %347, align 2, !tbaa !6 - %349 = freeze i16 %348 - store i16 %339, ptr %347, align 2, !tbaa !6 - %350 = icmp eq i16 %349, 0 - br i1 %350, label %393, label %351, !llvm.loop !12 - -351: ; preds = %336 - %352 = lshr i16 %349, 8 - %353 = mul i16 %349, 33 - %354 = add i16 %353, 69 - %355 = add i16 %354, %352 - %356 = and i16 %355, 255 - %357 = xor i16 %356, %345 - %358 = zext nneg i16 %357 to i64 - %359 = getelementptr inbounds nuw i16, ptr @filter, i64 %358 - %360 = load i16, ptr %359, align 2, !tbaa !6 - %361 = freeze i16 %360 - store i16 %349, ptr %359, align 2, !tbaa !6 - %362 = icmp eq i16 %361, 0 - br i1 %362, label %393, label %363, !llvm.loop !12 - -363: ; preds = %351 - %364 = lshr i16 %361, 8 - %365 = mul i16 %361, 33 - %366 = add i16 %365, 69 - %367 = add i16 %366, %364 - %368 = and i16 %367, 255 - %369 = xor i16 %368, %357 - %370 = zext nneg i16 %369 to i64 - %371 = getelementptr inbounds nuw i16, ptr @filter, i64 %370 - %372 = load i16, ptr %371, align 2, !tbaa !6 - %373 = freeze i16 %372 - store i16 %361, ptr %371, align 2, !tbaa !6 - %374 = icmp eq i16 %373, 0 - br i1 %374, label %393, label %375, !llvm.loop !12 - -375: ; preds = %363 - %376 = or disjoint i32 %337, 3 - %377 = lshr i16 %373, 8 - %378 = mul i16 %373, 33 - %379 = add i16 %378, 69 - %380 = add i16 %379, %377 - %381 = and i16 %380, 255 - %382 = xor i16 %381, %369 - %383 = zext nneg i16 %382 to i64 - %384 = getelementptr inbounds nuw i16, ptr @filter, i64 %383 - %385 = load i16, ptr %384, align 2, !tbaa !6 - %386 = freeze i16 %385 - store i16 %373, ptr %384, align 2, !tbaa !6 - %387 = add nuw nsw i32 %337, 4 - %388 = icmp ne i16 %386, 0 - %389 = icmp samesign ult i32 %376, 7 - %390 = select i1 %388, i1 %389, i1 false - br i1 %390, label %336, label %393, !llvm.loop !14 - -391: ; preds = %319 - store i16 %304, ptr %321, align 2, !tbaa !6 - br label %393 - -392: ; preds = %296 - store i16 %304, ptr %316, align 2, !tbaa !6 - br label %393 - -393: ; preds = %336, %351, %363, %375, %392, %391 - %394 = phi i16 [ %297, %392 ], [ %297, %391 ], [ %329, %375 ], [ %329, %363 ], [ %329, %351 ], [ %329, %336 ] - %395 = add nuw nsw i32 %5, 4 - %396 = icmp eq i32 %395, 128 - br i1 %396, label %2, label %3, !llvm.loop !16 - -397: ; preds = %520 - call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) - ret i32 0 - -398: ; preds = %520, %2 - %399 = phi i32 [ 0, %2 ], [ %521, %520 ] - %400 = phi i16 [ 1, %2 ], [ %492, %520 ] - %401 = mul i16 %400, 17 - %402 = add i16 %401, 17 - %403 = lshr i16 %402, 8 - %404 = and i16 %402, 255 - %405 = mul nuw nsw i16 %404, 33 - %406 = add nuw nsw i16 %403, 27205 - %407 = add nuw i16 %406, %405 - %408 = mul i16 %402, 33 - %409 = add i16 %408, 69 - %410 = add i16 %409, %403 - %411 = and i16 %410, 255 - %412 = zext nneg i16 %411 to i64 - %413 = getelementptr inbounds nuw i16, ptr @filter, i64 %412 - %414 = load i16, ptr %413, align 2, !tbaa !6 - %415 = icmp eq i16 %414, %407 - br i1 %415, label %427, label %416 - -416: ; preds = %398 - %417 = mul i16 %407, 33 - %418 = add i16 %417, 69 - %419 = lshr i16 %407, 8 - %420 = add i16 %418, %419 - %421 = xor i16 %420, %410 - %422 = and i16 %421, 255 - %423 = zext nneg i16 %422 to i64 - %424 = getelementptr inbounds nuw i16, ptr @filter, i64 %423 - %425 = load i16, ptr %424, align 2, !tbaa !6 - %426 = icmp eq i16 %425, %407 - br i1 %426, label %427, label %430 - -427: ; preds = %398, %416 - %428 = load volatile i32, ptr %1, align 4, !tbaa !10 - %429 = add i32 %428, 1 - store volatile i32 %429, ptr %1, align 4, !tbaa !10 - br label %430 - -430: ; preds = %416, %427 - %431 = mul i16 %402, 17 - %432 = add i16 %431, 17 - %433 = lshr i16 %432, 8 - %434 = and i16 %432, 255 - %435 = mul nuw nsw i16 %434, 33 - %436 = add nuw nsw i16 %433, 27205 - %437 = add nuw i16 %436, %435 - %438 = mul i16 %432, 33 - %439 = add i16 %438, 69 - %440 = add i16 %439, %433 - %441 = and i16 %440, 255 - %442 = zext nneg i16 %441 to i64 - %443 = getelementptr inbounds nuw i16, ptr @filter, i64 %442 - %444 = load i16, ptr %443, align 2, !tbaa !6 - %445 = icmp eq i16 %444, %437 - br i1 %445, label %457, label %446 - -446: ; preds = %430 - %447 = mul i16 %437, 33 - %448 = add i16 %447, 69 - %449 = lshr i16 %437, 8 - %450 = add i16 %448, %449 - %451 = xor i16 %450, %440 - %452 = and i16 %451, 255 - %453 = zext nneg i16 %452 to i64 - %454 = getelementptr inbounds nuw i16, ptr @filter, i64 %453 - %455 = load i16, ptr %454, align 2, !tbaa !6 - %456 = icmp eq i16 %455, %437 - br i1 %456, label %457, label %460 - -457: ; preds = %446, %430 - %458 = load volatile i32, ptr %1, align 4, !tbaa !10 - %459 = add i32 %458, 1 - store volatile i32 %459, ptr %1, align 4, !tbaa !10 - br label %460 - -460: ; preds = %457, %446 - %461 = mul i16 %432, 17 - %462 = add i16 %461, 17 - %463 = lshr i16 %462, 8 - %464 = and i16 %462, 255 - %465 = mul nuw nsw i16 %464, 33 - %466 = add nuw nsw i16 %463, 27205 - %467 = add nuw i16 %466, %465 - %468 = mul i16 %462, 33 - %469 = add i16 %468, 69 - %470 = add i16 %469, %463 - %471 = and i16 %470, 255 - %472 = zext nneg i16 %471 to i64 - %473 = getelementptr inbounds nuw i16, ptr @filter, i64 %472 - %474 = load i16, ptr %473, align 2, !tbaa !6 - %475 = icmp eq i16 %474, %467 - br i1 %475, label %487, label %476 - -476: ; preds = %460 - %477 = mul i16 %467, 33 - %478 = add i16 %477, 69 - %479 = lshr i16 %467, 8 - %480 = add i16 %478, %479 - %481 = xor i16 %480, %470 - %482 = and i16 %481, 255 - %483 = zext nneg i16 %482 to i64 - %484 = getelementptr inbounds nuw i16, ptr @filter, i64 %483 - %485 = load i16, ptr %484, align 2, !tbaa !6 - %486 = icmp eq i16 %485, %467 - br i1 %486, label %487, label %490 - -487: ; preds = %476, %460 - %488 = load volatile i32, ptr %1, align 4, !tbaa !10 - %489 = add i32 %488, 1 - store volatile i32 %489, ptr %1, align 4, !tbaa !10 - br label %490 - -490: ; preds = %487, %476 - %491 = mul i16 %462, 17 - %492 = add i16 %491, 17 - %493 = lshr i16 %492, 8 - %494 = and i16 %492, 255 - %495 = mul nuw nsw i16 %494, 33 - %496 = add nuw nsw i16 %493, 27205 - %497 = add nuw i16 %496, %495 - %498 = mul i16 %492, 33 - %499 = add i16 %498, 69 - %500 = add i16 %499, %493 - %501 = and i16 %500, 255 - %502 = zext nneg i16 %501 to i64 - %503 = getelementptr inbounds nuw i16, ptr @filter, i64 %502 - %504 = load i16, ptr %503, align 2, !tbaa !6 - %505 = icmp eq i16 %504, %497 - br i1 %505, label %517, label %506 - -506: ; preds = %490 - %507 = mul i16 %497, 33 - %508 = add i16 %507, 69 - %509 = lshr i16 %497, 8 - %510 = add i16 %508, %509 - %511 = xor i16 %510, %500 - %512 = and i16 %511, 255 - %513 = zext nneg i16 %512 to i64 - %514 = getelementptr inbounds nuw i16, ptr @filter, i64 %513 - %515 = load i16, ptr %514, align 2, !tbaa !6 - %516 = icmp eq i16 %515, %497 - br i1 %516, label %517, label %520 - -517: ; preds = %506, %490 - %518 = load volatile i32, ptr %1, align 4, !tbaa !10 - %519 = add i32 %518, 1 - store volatile i32 %519, ptr %1, align 4, !tbaa !10 - br label %520 - -520: ; preds = %517, %506 - %521 = add nuw nsw i32 %399, 4 - %522 = icmp eq i32 %521, 128 - br i1 %522, label %397, label %398, !llvm.loop !17 -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #3 - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -attributes #2 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = distinct !{!12, !13} -!13 = !{!"llvm.loop.mustprogress"} -!14 = distinct !{!14, !13, !15} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !13, !15} -!17 = distinct !{!17, !13, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_instrumented.ll b/benchmarks/intermittent/cuckoo_filter_instrumented.ll deleted file mode 100644 index 7fb05af..0000000 --- a/benchmarks/intermittent/cuckoo_filter_instrumented.ll +++ /dev/null @@ -1,296 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb7\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [5 x i8] c"bb10\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb19\00", align 1 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %3 - -2: ; preds = %139 - call void @llvm.lifetime.start.p0(ptr %1) - store volatile i32 0, ptr %1, align 4, !tbaa !10 - br label %144 - -3: ; preds = %139, %0 - %4 = phi i16 [ 1, %0 ], [ %8, %139 ] - %5 = phi i32 [ 0, %0 ], [ %141, %139 ] - %6 = phi i16 [ -21279, %0 ], [ %140, %139 ] - %7 = mul i16 %4, 17 - %8 = add i16 %7, 17 - %9 = lshr i16 %8, 8 - %10 = and i16 %8, 255 - %11 = mul nuw nsw i16 %10, 33 - %12 = add nuw nsw i16 %9, 27205 - %13 = add nuw i16 %12, %11 - %14 = mul i16 %8, 33 - %15 = add i16 %14, 69 - %16 = add i16 %15, %9 - %17 = and i16 %16, 255 - %18 = lshr i16 %13, 8 - %19 = mul i16 %13, 33 - %20 = add i16 %19, 69 - %21 = add i16 %20, %18 - %22 = xor i16 %21, %16 - %23 = and i16 %22, 255 - %24 = zext nneg i16 %17 to i64 - %25 = getelementptr inbounds nuw i16, ptr @filter, i64 %24 - %26 = load i16, ptr %25, align 2, !tbaa !6 - %27 = icmp eq i16 %26, 0 - br i1 %27, label %28, label %29 - -28: ; preds = %3 - store i16 %13, ptr %25, align 2, !tbaa !6 - br label %139 - -29: ; preds = %3 - %30 = zext nneg i16 %23 to i64 - %31 = getelementptr inbounds nuw i16, ptr @filter, i64 %30 - %32 = load i16, ptr %31, align 2, !tbaa !6 - %33 = icmp eq i16 %32, 0 - br i1 %33, label %34, label %35 - -34: ; preds = %29 - store i16 %13, ptr %31, align 2, !tbaa !6 - br label %139 - -35: ; preds = %29 - %36 = and i16 %6, 1 - %37 = icmp eq i16 %36, 0 - %38 = lshr i16 %6, 1 - %39 = xor i16 %38, -19456 - %40 = select i1 %37, i16 %38, i16 %39 - %41 = and i16 %40, 128 - %42 = icmp eq i16 %41, 0 - %43 = select i1 %42, i16 %23, i16 %17 - %44 = zext nneg i16 %43 to i64 - %45 = getelementptr inbounds nuw i16, ptr @filter, i64 %44 - %46 = load i16, ptr %45, align 2, !tbaa !6 - store i16 %13, ptr %45, align 2, !tbaa !6 - %47 = lshr i16 %46, 8 - %48 = mul i16 %46, 33 - %49 = add i16 %48, 69 - %50 = add i16 %49, %47 - %51 = and i16 %50, 255 - %52 = xor i16 %51, %43 - %53 = zext nneg i16 %52 to i64 - %54 = getelementptr inbounds nuw i16, ptr @filter, i64 %53 - %55 = load i16, ptr %54, align 2, !tbaa !6 - %56 = freeze i16 %55 - store i16 %46, ptr %54, align 2, !tbaa !6 - %57 = icmp eq i16 %56, 0 - br i1 %57, label %139, label %58, !llvm.loop !12 - -58: ; preds = %35 - call void @__checkpoint(ptr @checkpoint_name) - %59 = lshr i16 %56, 8 - %60 = mul i16 %56, 33 - %61 = add i16 %60, 69 - %62 = add i16 %61, %59 - %63 = and i16 %62, 255 - %64 = xor i16 %63, %52 - %65 = zext nneg i16 %64 to i64 - %66 = getelementptr inbounds nuw i16, ptr @filter, i64 %65 - %67 = load i16, ptr %66, align 2, !tbaa !6 - %68 = freeze i16 %67 - store i16 %56, ptr %66, align 2, !tbaa !6 - %69 = icmp eq i16 %68, 0 - br i1 %69, label %139, label %70, !llvm.loop !12 - -70: ; preds = %58 - %71 = lshr i16 %68, 8 - %72 = mul i16 %68, 33 - %73 = add i16 %72, 69 - %74 = add i16 %73, %71 - %75 = and i16 %74, 255 - %76 = xor i16 %75, %64 - %77 = zext nneg i16 %76 to i64 - %78 = getelementptr inbounds nuw i16, ptr @filter, i64 %77 - %79 = load i16, ptr %78, align 2, !tbaa !6 - %80 = freeze i16 %79 - store i16 %68, ptr %78, align 2, !tbaa !6 - %81 = icmp eq i16 %80, 0 - br i1 %81, label %139, label %82, !llvm.loop !12 - -82: ; preds = %70 - %83 = lshr i16 %80, 8 - %84 = mul i16 %80, 33 - %85 = add i16 %84, 69 - %86 = add i16 %85, %83 - %87 = and i16 %86, 255 - %88 = xor i16 %87, %76 - %89 = zext nneg i16 %88 to i64 - %90 = getelementptr inbounds nuw i16, ptr @filter, i64 %89 - %91 = load i16, ptr %90, align 2, !tbaa !6 - %92 = freeze i16 %91 - store i16 %80, ptr %90, align 2, !tbaa !6 - %93 = icmp eq i16 %92, 0 - br i1 %93, label %139, label %94, !llvm.loop !12 - -94: ; preds = %82 - call void @__checkpoint(ptr @checkpoint_name.1) - %95 = lshr i16 %92, 8 - %96 = mul i16 %92, 33 - %97 = add i16 %96, 69 - %98 = add i16 %97, %95 - %99 = and i16 %98, 255 - %100 = xor i16 %99, %88 - %101 = zext nneg i16 %100 to i64 - %102 = getelementptr inbounds nuw i16, ptr @filter, i64 %101 - %103 = load i16, ptr %102, align 2, !tbaa !6 - %104 = freeze i16 %103 - store i16 %92, ptr %102, align 2, !tbaa !6 - %105 = icmp eq i16 %104, 0 - br i1 %105, label %139, label %106, !llvm.loop !12 - -106: ; preds = %94 - %107 = lshr i16 %104, 8 - %108 = mul i16 %104, 33 - %109 = add i16 %108, 69 - %110 = add i16 %109, %107 - %111 = and i16 %110, 255 - %112 = xor i16 %111, %100 - %113 = zext nneg i16 %112 to i64 - %114 = getelementptr inbounds nuw i16, ptr @filter, i64 %113 - %115 = load i16, ptr %114, align 2, !tbaa !6 - %116 = freeze i16 %115 - store i16 %104, ptr %114, align 2, !tbaa !6 - %117 = icmp eq i16 %116, 0 - br i1 %117, label %139, label %118, !llvm.loop !12 - -118: ; preds = %106 - %119 = lshr i16 %116, 8 - %120 = mul i16 %116, 33 - %121 = add i16 %120, 69 - %122 = add i16 %121, %119 - %123 = and i16 %122, 255 - %124 = xor i16 %123, %112 - %125 = zext nneg i16 %124 to i64 - %126 = getelementptr inbounds nuw i16, ptr @filter, i64 %125 - %127 = load i16, ptr %126, align 2, !tbaa !6 - %128 = freeze i16 %127 - store i16 %116, ptr %126, align 2, !tbaa !6 - %129 = icmp eq i16 %128, 0 - br i1 %129, label %139, label %130, !llvm.loop !12 - -130: ; preds = %118 - %131 = lshr i16 %128, 8 - %132 = mul i16 %128, 33 - %133 = add i16 %132, 69 - %134 = add i16 %133, %131 - %135 = and i16 %134, 255 - %136 = xor i16 %135, %124 - %137 = zext nneg i16 %136 to i64 - %138 = getelementptr inbounds nuw i16, ptr @filter, i64 %137 - store i16 %128, ptr %138, align 2, !tbaa !6 - br label %139 - -139: ; preds = %130, %118, %106, %94, %82, %70, %58, %35, %34, %28 - %140 = phi i16 [ %6, %28 ], [ %6, %34 ], [ %40, %130 ], [ %40, %118 ], [ %40, %106 ], [ %40, %94 ], [ %40, %82 ], [ %40, %70 ], [ %40, %58 ], [ %40, %35 ] - call void @__checkpoint(ptr @checkpoint_name.2) - %141 = add nuw nsw i32 %5, 1 - %142 = icmp eq i32 %141, 128 - br i1 %142, label %2, label %3, !llvm.loop !14 - -143: ; preds = %176 - call void @llvm.lifetime.end.p0(ptr %1) - ret i32 0 - -144: ; preds = %176, %2 - %145 = phi i32 [ 0, %2 ], [ %177, %176 ] - %146 = phi i16 [ 1, %2 ], [ %148, %176 ] - %147 = mul i16 %146, 17 - %148 = add i16 %147, 17 - %149 = lshr i16 %148, 8 - %150 = and i16 %148, 255 - %151 = mul nuw nsw i16 %150, 33 - %152 = add nuw nsw i16 %149, 27205 - %153 = add nuw i16 %152, %151 - %154 = mul i16 %148, 33 - %155 = add i16 %154, 69 - %156 = add i16 %155, %149 - %157 = and i16 %156, 255 - %158 = zext nneg i16 %157 to i64 - %159 = getelementptr inbounds nuw i16, ptr @filter, i64 %158 - %160 = load i16, ptr %159, align 2, !tbaa !6 - %161 = icmp eq i16 %160, %153 - br i1 %161, label %173, label %162 - -162: ; preds = %144 - %163 = mul i16 %153, 33 - %164 = add i16 %163, 69 - %165 = lshr i16 %153, 8 - %166 = add i16 %164, %165 - %167 = xor i16 %166, %156 - %168 = and i16 %167, 255 - %169 = zext nneg i16 %168 to i64 - %170 = getelementptr inbounds nuw i16, ptr @filter, i64 %169 - %171 = load i16, ptr %170, align 2, !tbaa !6 - %172 = icmp eq i16 %171, %153 - br i1 %172, label %173, label %176 - -173: ; preds = %162, %144 - %174 = load volatile i32, ptr %1, align 4, !tbaa !10 - %175 = add i32 %174, 1 - store volatile i32 %175, ptr %1, align 4, !tbaa !10 - br label %176 - -176: ; preds = %173, %162 - call void @__checkpoint(ptr @checkpoint_name.3) - %177 = add nuw nsw i32 %145, 1 - %178 = icmp eq i32 %177, 128 - br i1 %178, label %143, label %144, !llvm.loop !15 -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #2 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #3 - -declare void @__checkpoint(ptr) - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = distinct !{!12, !13} -!13 = !{!"llvm.loop.mustprogress"} -!14 = distinct !{!14, !13} -!15 = distinct !{!15, !13} diff --git a/benchmarks/intermittent/cuckoo_filter_no_unroll.ll b/benchmarks/intermittent/cuckoo_filter_no_unroll.ll deleted file mode 100644 index 0f9c7d8..0000000 --- a/benchmarks/intermittent/cuckoo_filter_no_unroll.ll +++ /dev/null @@ -1,308 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter.c' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #1 - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #2 { - %1 = alloca i16, align 2 - %2 = alloca i16, align 2 - %3 = alloca i16, align 2 - %4 = alloca i16, align 2 - %5 = alloca i16, align 2 - %6 = alloca i16, align 2 - %7 = alloca i16, align 2 - %8 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %10 - -9: ; preds = %105 - call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) - store volatile i32 0, ptr %8, align 4, !tbaa !10 - br label %110 - -10: ; preds = %0, %105 - %11 = phi i16 [ 1, %0 ], [ %15, %105 ] - %12 = phi i32 [ 0, %0 ], [ %107, %105 ] - %13 = phi i16 [ -21279, %0 ], [ %106, %105 ] - %14 = mul i16 %11, 17 - %15 = add i16 %14, 17 - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) - store i16 %15, ptr %7, align 2, !tbaa !6 - br label %16 - -16: ; preds = %16, %10 - %17 = phi i32 [ 5381, %10 ], [ %23, %16 ] - %18 = phi i64 [ 0, %10 ], [ %24, %16 ] - %19 = getelementptr inbounds nuw i8, ptr %7, i64 %18 - %20 = mul i32 %17, 33 - %21 = load i8, ptr %19, align 1, !tbaa !12 - %22 = zext i8 %21 to i32 - %23 = add i32 %20, %22 - %24 = add nuw nsw i64 %18, 1 - %25 = icmp eq i64 %18, 1 - br i1 %25, label %26, label %16, !llvm.loop !13 - -26: ; preds = %16 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) - store i16 %15, ptr %6, align 2, !tbaa !6 - br label %27 - -27: ; preds = %27, %26 - %28 = phi i32 [ 5381, %26 ], [ %34, %27 ] - %29 = phi i64 [ 0, %26 ], [ %35, %27 ] - %30 = getelementptr inbounds nuw i8, ptr %6, i64 %29 - %31 = mul i32 %28, 33 - %32 = load i8, ptr %30, align 1, !tbaa !12 - %33 = zext i8 %32 to i32 - %34 = add i32 %31, %33 - %35 = add nuw nsw i64 %29, 1 - %36 = icmp eq i64 %29, 1 - br i1 %36, label %37, label %27, !llvm.loop !13 - -37: ; preds = %27 - %38 = trunc i32 %23 to i16 - %39 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %38, i16 1) - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) - store i16 %39, ptr %5, align 2, !tbaa !6 - br label %40 - -40: ; preds = %40, %37 - %41 = phi i32 [ 5381, %37 ], [ %47, %40 ] - %42 = phi i64 [ 0, %37 ], [ %48, %40 ] - %43 = getelementptr inbounds nuw i8, ptr %5, i64 %42 - %44 = mul i32 %41, 33 - %45 = load i8, ptr %43, align 1, !tbaa !12 - %46 = zext i8 %45 to i32 - %47 = add i32 %44, %46 - %48 = add nuw nsw i64 %42, 1 - %49 = icmp eq i64 %42, 1 - br i1 %49, label %50, label %40, !llvm.loop !13 - -50: ; preds = %40 - %51 = trunc i32 %34 to i16 - %52 = and i16 %51, 255 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) - %53 = xor i32 %47, %34 - %54 = trunc i32 %53 to i16 - %55 = and i16 %54, 255 - %56 = zext nneg i16 %52 to i64 - %57 = getelementptr inbounds nuw i16, ptr @filter, i64 %56 - %58 = load i16, ptr %57, align 2, !tbaa !6 - %59 = icmp eq i16 %58, 0 - br i1 %59, label %60, label %61 - -60: ; preds = %50 - store i16 %39, ptr %57, align 2, !tbaa !6 - br label %105 - -61: ; preds = %50 - %62 = zext nneg i16 %55 to i64 - %63 = getelementptr inbounds nuw i16, ptr @filter, i64 %62 - %64 = load i16, ptr %63, align 2, !tbaa !6 - %65 = icmp eq i16 %64, 0 - br i1 %65, label %66, label %67 - -66: ; preds = %61 - store i16 %39, ptr %63, align 2, !tbaa !6 - br label %105 - -67: ; preds = %61 - %68 = and i16 %13, 1 - %69 = icmp eq i16 %68, 0 - %70 = lshr i16 %13, 1 - %71 = xor i16 %70, -19456 - %72 = select i1 %69, i16 %70, i16 %71 - %73 = and i16 %72, 128 - %74 = icmp eq i16 %73, 0 - %75 = select i1 %74, i16 %55, i16 %52 - %76 = zext nneg i16 %75 to i64 - %77 = getelementptr inbounds nuw i16, ptr @filter, i64 %76 - %78 = load i16, ptr %77, align 2, !tbaa !6 - store i16 %39, ptr %77, align 2, !tbaa !6 - br label %79 - -79: ; preds = %93, %67 - %80 = phi i32 [ 0, %67 ], [ %101, %93 ] - %81 = phi i16 [ %75, %67 ], [ %96, %93 ] - %82 = phi i16 [ %78, %67 ], [ %100, %93 ] - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) - store i16 %82, ptr %4, align 2, !tbaa !6 - br label %83 - -83: ; preds = %83, %79 - %84 = phi i32 [ 5381, %79 ], [ %90, %83 ] - %85 = phi i64 [ 0, %79 ], [ %91, %83 ] - %86 = getelementptr inbounds nuw i8, ptr %4, i64 %85 - %87 = mul i32 %84, 33 - %88 = load i8, ptr %86, align 1, !tbaa !12 - %89 = zext i8 %88 to i32 - %90 = add i32 %87, %89 - %91 = add nuw nsw i64 %85, 1 - %92 = icmp eq i64 %85, 1 - br i1 %92, label %93, label %83, !llvm.loop !13 - -93: ; preds = %83 - %94 = trunc i32 %90 to i16 - %95 = and i16 %94, 255 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) - %96 = xor i16 %95, %81 - %97 = zext nneg i16 %96 to i64 - %98 = getelementptr inbounds nuw i16, ptr @filter, i64 %97 - %99 = load i16, ptr %98, align 2, !tbaa !6 - %100 = freeze i16 %99 - store i16 %82, ptr %98, align 2, !tbaa !6 - %101 = add nuw nsw i32 %80, 1 - %102 = icmp ne i16 %100, 0 - %103 = icmp samesign ult i32 %80, 7 - %104 = select i1 %102, i1 %103, i1 false - br i1 %104, label %79, label %105, !llvm.loop !16 - -105: ; preds = %93, %66, %60 - %106 = phi i16 [ %13, %60 ], [ %13, %66 ], [ %72, %93 ] - %107 = add nuw nsw i32 %12, 1 - %108 = icmp eq i32 %107, 128 - br i1 %108, label %9, label %10, !llvm.loop !17 - -109: ; preds = %165 - call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) - ret i32 0 - -110: ; preds = %9, %165 - %111 = phi i32 [ 0, %9 ], [ %166, %165 ] - %112 = phi i16 [ 1, %9 ], [ %114, %165 ] - %113 = mul i16 %112, 17 - %114 = add i16 %113, 17 - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) - store i16 %114, ptr %3, align 2, !tbaa !6 - br label %115 - -115: ; preds = %115, %110 - %116 = phi i32 [ 5381, %110 ], [ %122, %115 ] - %117 = phi i64 [ 0, %110 ], [ %123, %115 ] - %118 = getelementptr inbounds nuw i8, ptr %3, i64 %117 - %119 = mul i32 %116, 33 - %120 = load i8, ptr %118, align 1, !tbaa !12 - %121 = zext i8 %120 to i32 - %122 = add i32 %119, %121 - %123 = add nuw nsw i64 %117, 1 - %124 = icmp eq i64 %117, 1 - br i1 %124, label %125, label %115, !llvm.loop !13 - -125: ; preds = %115 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) - store i16 %114, ptr %2, align 2, !tbaa !6 - br label %126 - -126: ; preds = %126, %125 - %127 = phi i32 [ 5381, %125 ], [ %133, %126 ] - %128 = phi i64 [ 0, %125 ], [ %134, %126 ] - %129 = getelementptr inbounds nuw i8, ptr %2, i64 %128 - %130 = mul i32 %127, 33 - %131 = load i8, ptr %129, align 1, !tbaa !12 - %132 = zext i8 %131 to i32 - %133 = add i32 %130, %132 - %134 = add nuw nsw i64 %128, 1 - %135 = icmp eq i64 %128, 1 - br i1 %135, label %136, label %126, !llvm.loop !13 - -136: ; preds = %126 - %137 = trunc i32 %122 to i16 - %138 = tail call range(i16 1, 0) i16 @llvm.umax.i16(i16 %137, i16 1) - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) - call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %1) - store i16 %138, ptr %1, align 2, !tbaa !6 - br label %139 - -139: ; preds = %139, %136 - %140 = phi i32 [ 5381, %136 ], [ %146, %139 ] - %141 = phi i64 [ 0, %136 ], [ %147, %139 ] - %142 = getelementptr inbounds nuw i8, ptr %1, i64 %141 - %143 = mul i32 %140, 33 - %144 = load i8, ptr %142, align 1, !tbaa !12 - %145 = zext i8 %144 to i32 - %146 = add i32 %143, %145 - %147 = add nuw nsw i64 %141, 1 - %148 = icmp eq i64 %141, 1 - br i1 %148, label %149, label %139, !llvm.loop !13 - -149: ; preds = %139 - %150 = and i32 %133, 255 - %151 = zext nneg i32 %150 to i64 - call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %1) - %152 = getelementptr inbounds nuw i16, ptr @filter, i64 %151 - %153 = load i16, ptr %152, align 2, !tbaa !6 - %154 = icmp eq i16 %153, %138 - br i1 %154, label %162, label %155 - -155: ; preds = %149 - %156 = xor i32 %146, %133 - %157 = and i32 %156, 255 - %158 = zext nneg i32 %157 to i64 - %159 = getelementptr inbounds nuw i16, ptr @filter, i64 %158 - %160 = load i16, ptr %159, align 2, !tbaa !6 - %161 = icmp eq i16 %160, %138 - br i1 %161, label %162, label %165 - -162: ; preds = %149, %155 - %163 = load volatile i32, ptr %8, align 4, !tbaa !10 - %164 = add i32 %163, 1 - store volatile i32 %164, ptr %8, align 4, !tbaa !10 - br label %165 - -165: ; preds = %155, %162 - %166 = add nuw nsw i32 %111, 1 - %167 = icmp eq i32 %166, 128 - br i1 %167, label %109, label %110, !llvm.loop !18 -} - -; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) -declare i16 @llvm.umax.i16(i16, i16) #3 - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #4 - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -attributes #2 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } -attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = !{!8, !8, i64 0} -!13 = distinct !{!13, !14, !15} -!14 = !{!"llvm.loop.mustprogress"} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !14, !15} -!17 = distinct !{!17, !14, !15} -!18 = distinct !{!18, !14, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_simplified.ll b/benchmarks/intermittent/cuckoo_filter_simplified.ll deleted file mode 100644 index c7ed83c..0000000 --- a/benchmarks/intermittent/cuckoo_filter_simplified.ll +++ /dev/null @@ -1,757 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter_unrolled_checkpointed.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb7\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [5 x i8] c"bb11\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb20\00", align 1 -@checkpoint_name.4 = private unnamed_addr constant [5 x i8] c"bb23\00", align 1 -@checkpoint_name.5 = private unnamed_addr constant [5 x i8] c"bb29\00", align 1 -@checkpoint_name.6 = private unnamed_addr constant [5 x i8] c"bb32\00", align 1 -@checkpoint_name.7 = private unnamed_addr constant [5 x i8] c"bb38\00", align 1 -@checkpoint_name.8 = private unnamed_addr constant [5 x i8] c"bb41\00", align 1 -@checkpoint_name.9 = private unnamed_addr constant [5 x i8] c"bb42\00", align 1 -@checkpoint_name.10 = private unnamed_addr constant [5 x i8] c"bb47\00", align 1 -@checkpoint_name.11 = private unnamed_addr constant [5 x i8] c"bb48\00", align 1 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %3 - -2: ; preds = %393 - call void @llvm.lifetime.start.p0(ptr nonnull %1) - store volatile i32 0, ptr %1, align 4, !tbaa !10 - br label %398 - -3: ; preds = %393, %0 - %4 = phi i16 [ 1, %0 ], [ %299, %393 ] - %5 = phi i32 [ 0, %0 ], [ %395, %393 ] - %6 = phi i16 [ -21279, %0 ], [ %394, %393 ] - %7 = mul i16 %4, 17 - %8 = add i16 %7, 17 - %9 = lshr i16 %8, 8 - %10 = and i16 %8, 255 - %11 = mul nuw nsw i16 %10, 33 - %12 = add nuw nsw i16 %9, 27205 - %13 = add nuw i16 %12, %11 - %14 = mul i16 %8, 33 - %15 = add i16 %14, 69 - %16 = add i16 %15, %9 - %17 = and i16 %16, 255 - %18 = lshr i16 %13, 8 - %19 = mul i16 %13, 33 - %20 = add i16 %19, 69 - %21 = add i16 %20, %18 - %22 = xor i16 %21, %16 - %23 = and i16 %22, 255 - %24 = zext nneg i16 %17 to i64 - %25 = getelementptr inbounds nuw i16, ptr @filter, i64 %24 - %26 = load i16, ptr %25, align 2, !tbaa !6 - %27 = icmp eq i16 %26, 0 - br i1 %27, label %28, label %29 - -28: ; preds = %3 - store i16 %13, ptr %25, align 2, !tbaa !6 - br label %102 - -29: ; preds = %3 - %30 = zext nneg i16 %23 to i64 - %31 = getelementptr inbounds nuw i16, ptr @filter, i64 %30 - %32 = load i16, ptr %31, align 2, !tbaa !6 - %33 = icmp eq i16 %32, 0 - br i1 %33, label %34, label %35 - -34: ; preds = %29 - store i16 %13, ptr %31, align 2, !tbaa !6 - br label %102 - -35: ; preds = %29 - %36 = and i16 %6, 1 - %37 = icmp eq i16 %36, 0 - %38 = lshr i16 %6, 1 - %39 = xor i16 %38, -19456 - %40 = select i1 %37, i16 %38, i16 %39 - %41 = and i16 %40, 128 - %42 = icmp eq i16 %41, 0 - %43 = select i1 %42, i16 %23, i16 %17 - %44 = zext nneg i16 %43 to i64 - %45 = getelementptr inbounds nuw i16, ptr @filter, i64 %44 - %46 = load i16, ptr %45, align 2, !tbaa !6 - store i16 %13, ptr %45, align 2, !tbaa !6 - br label %47 - -47: ; preds = %86, %35 - %48 = phi i32 [ 0, %35 ], [ %98, %86 ] - %49 = phi i16 [ %43, %35 ], [ %93, %86 ] - %50 = phi i16 [ %46, %35 ], [ %97, %86 ] - call void @__checkpoint(ptr nonnull @checkpoint_name) #4 - %51 = lshr i16 %50, 8 - %52 = mul i16 %50, 33 - %53 = add i16 %52, 69 - %54 = add i16 %53, %51 - %55 = and i16 %54, 255 - %56 = xor i16 %55, %49 - %57 = zext nneg i16 %56 to i64 - %58 = getelementptr inbounds nuw i16, ptr @filter, i64 %57 - %59 = load i16, ptr %58, align 2, !tbaa !6 - %60 = freeze i16 %59 - store i16 %50, ptr %58, align 2, !tbaa !6 - %61 = icmp eq i16 %60, 0 - br i1 %61, label %.loopexit3, label %62, !llvm.loop !12 - -62: ; preds = %47 - %63 = lshr i16 %60, 8 - %64 = mul i16 %60, 33 - %65 = add i16 %64, 69 - %66 = add i16 %65, %63 - %67 = and i16 %66, 255 - %68 = xor i16 %67, %56 - %69 = zext nneg i16 %68 to i64 - %70 = getelementptr inbounds nuw i16, ptr @filter, i64 %69 - %71 = load i16, ptr %70, align 2, !tbaa !6 - %72 = freeze i16 %71 - store i16 %60, ptr %70, align 2, !tbaa !6 - %73 = icmp eq i16 %72, 0 - br i1 %73, label %.loopexit3, label %74, !llvm.loop !12 - -74: ; preds = %62 - %75 = lshr i16 %72, 8 - %76 = mul i16 %72, 33 - %77 = add i16 %76, 69 - %78 = add i16 %77, %75 - %79 = and i16 %78, 255 - %80 = xor i16 %79, %68 - %81 = zext nneg i16 %80 to i64 - %82 = getelementptr inbounds nuw i16, ptr @filter, i64 %81 - %83 = load i16, ptr %82, align 2, !tbaa !6 - %84 = freeze i16 %83 - store i16 %72, ptr %82, align 2, !tbaa !6 - %85 = icmp eq i16 %84, 0 - br i1 %85, label %.loopexit3, label %86, !llvm.loop !12 - -86: ; preds = %74 - %87 = or disjoint i32 %48, 3 - %88 = lshr i16 %84, 8 - %89 = mul i16 %84, 33 - %90 = add i16 %89, 69 - %91 = add i16 %90, %88 - %92 = and i16 %91, 255 - %93 = xor i16 %92, %80 - %94 = zext nneg i16 %93 to i64 - %95 = getelementptr inbounds nuw i16, ptr @filter, i64 %94 - %96 = load i16, ptr %95, align 2, !tbaa !6 - %97 = freeze i16 %96 - store i16 %84, ptr %95, align 2, !tbaa !6 - %98 = add nuw nsw i32 %48, 4 - %99 = icmp ne i16 %97, 0 - %100 = icmp samesign ult i32 %87, 7 - %101 = select i1 %99, i1 %100, i1 false - br i1 %101, label %47, label %.loopexit3, !llvm.loop !14 - -.loopexit3: ; preds = %47, %62, %74, %86 - br label %102 - -102: ; preds = %.loopexit3, %34, %28 - %103 = phi i16 [ %6, %28 ], [ %6, %34 ], [ %40, %.loopexit3 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.1) #4 - %104 = mul i16 %8, 17 - %105 = add i16 %104, 17 - %106 = lshr i16 %105, 8 - %107 = and i16 %105, 255 - %108 = mul nuw nsw i16 %107, 33 - %109 = add nuw nsw i16 %106, 27205 - %110 = add nuw i16 %109, %108 - %111 = mul i16 %105, 33 - %112 = add i16 %111, 69 - %113 = add i16 %112, %106 - %114 = and i16 %113, 255 - %115 = lshr i16 %110, 8 - %116 = mul i16 %110, 33 - %117 = add i16 %116, 69 - %118 = add i16 %117, %115 - %119 = xor i16 %118, %113 - %120 = and i16 %119, 255 - %121 = zext nneg i16 %114 to i64 - %122 = getelementptr inbounds nuw i16, ptr @filter, i64 %121 - %123 = load i16, ptr %122, align 2, !tbaa !6 - %124 = icmp eq i16 %123, 0 - br i1 %124, label %198, label %125 - -125: ; preds = %102 - %126 = zext nneg i16 %120 to i64 - %127 = getelementptr inbounds nuw i16, ptr @filter, i64 %126 - %128 = load i16, ptr %127, align 2, !tbaa !6 - %129 = icmp eq i16 %128, 0 - br i1 %129, label %197, label %130 - -130: ; preds = %125 - %131 = and i16 %103, 1 - %132 = icmp eq i16 %131, 0 - %133 = lshr i16 %103, 1 - %134 = xor i16 %133, -19456 - %135 = select i1 %132, i16 %133, i16 %134 - %136 = and i16 %135, 128 - %137 = icmp eq i16 %136, 0 - %138 = select i1 %137, i16 %120, i16 %114 - %139 = zext nneg i16 %138 to i64 - %140 = getelementptr inbounds nuw i16, ptr @filter, i64 %139 - %141 = load i16, ptr %140, align 2, !tbaa !6 - store i16 %110, ptr %140, align 2, !tbaa !6 - br label %142 - -142: ; preds = %181, %130 - %143 = phi i32 [ 0, %130 ], [ %193, %181 ] - %144 = phi i16 [ %138, %130 ], [ %188, %181 ] - %145 = phi i16 [ %141, %130 ], [ %192, %181 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.2) #4 - %146 = lshr i16 %145, 8 - %147 = mul i16 %145, 33 - %148 = add i16 %147, 69 - %149 = add i16 %148, %146 - %150 = and i16 %149, 255 - %151 = xor i16 %150, %144 - %152 = zext nneg i16 %151 to i64 - %153 = getelementptr inbounds nuw i16, ptr @filter, i64 %152 - %154 = load i16, ptr %153, align 2, !tbaa !6 - %155 = freeze i16 %154 - store i16 %145, ptr %153, align 2, !tbaa !6 - %156 = icmp eq i16 %155, 0 - br i1 %156, label %.loopexit2, label %157, !llvm.loop !12 - -157: ; preds = %142 - %158 = lshr i16 %155, 8 - %159 = mul i16 %155, 33 - %160 = add i16 %159, 69 - %161 = add i16 %160, %158 - %162 = and i16 %161, 255 - %163 = xor i16 %162, %151 - %164 = zext nneg i16 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = freeze i16 %166 - store i16 %155, ptr %165, align 2, !tbaa !6 - %168 = icmp eq i16 %167, 0 - br i1 %168, label %.loopexit2, label %169, !llvm.loop !12 - -169: ; preds = %157 - %170 = lshr i16 %167, 8 - %171 = mul i16 %167, 33 - %172 = add i16 %171, 69 - %173 = add i16 %172, %170 - %174 = and i16 %173, 255 - %175 = xor i16 %174, %163 - %176 = zext nneg i16 %175 to i64 - %177 = getelementptr inbounds nuw i16, ptr @filter, i64 %176 - %178 = load i16, ptr %177, align 2, !tbaa !6 - %179 = freeze i16 %178 - store i16 %167, ptr %177, align 2, !tbaa !6 - %180 = icmp eq i16 %179, 0 - br i1 %180, label %.loopexit2, label %181, !llvm.loop !12 - -181: ; preds = %169 - %182 = or disjoint i32 %143, 3 - %183 = lshr i16 %179, 8 - %184 = mul i16 %179, 33 - %185 = add i16 %184, 69 - %186 = add i16 %185, %183 - %187 = and i16 %186, 255 - %188 = xor i16 %187, %175 - %189 = zext nneg i16 %188 to i64 - %190 = getelementptr inbounds nuw i16, ptr @filter, i64 %189 - %191 = load i16, ptr %190, align 2, !tbaa !6 - %192 = freeze i16 %191 - store i16 %179, ptr %190, align 2, !tbaa !6 - %193 = add nuw nsw i32 %143, 4 - %194 = icmp ne i16 %192, 0 - %195 = icmp samesign ult i32 %182, 7 - %196 = select i1 %194, i1 %195, i1 false - br i1 %196, label %142, label %.loopexit2, !llvm.loop !14 - -197: ; preds = %125 - store i16 %110, ptr %127, align 2, !tbaa !6 - br label %199 - -198: ; preds = %102 - store i16 %110, ptr %122, align 2, !tbaa !6 - br label %199 - -.loopexit2: ; preds = %142, %157, %169, %181 - br label %199 - -199: ; preds = %.loopexit2, %198, %197 - %200 = phi i16 [ %103, %198 ], [ %103, %197 ], [ %135, %.loopexit2 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.3) #4 - %201 = mul i16 %105, 17 - %202 = add i16 %201, 17 - %203 = lshr i16 %202, 8 - %204 = and i16 %202, 255 - %205 = mul nuw nsw i16 %204, 33 - %206 = add nuw nsw i16 %203, 27205 - %207 = add nuw i16 %206, %205 - %208 = mul i16 %202, 33 - %209 = add i16 %208, 69 - %210 = add i16 %209, %203 - %211 = and i16 %210, 255 - %212 = lshr i16 %207, 8 - %213 = mul i16 %207, 33 - %214 = add i16 %213, 69 - %215 = add i16 %214, %212 - %216 = xor i16 %215, %210 - %217 = and i16 %216, 255 - %218 = zext nneg i16 %211 to i64 - %219 = getelementptr inbounds nuw i16, ptr @filter, i64 %218 - %220 = load i16, ptr %219, align 2, !tbaa !6 - %221 = icmp eq i16 %220, 0 - br i1 %221, label %295, label %222 - -222: ; preds = %199 - %223 = zext nneg i16 %217 to i64 - %224 = getelementptr inbounds nuw i16, ptr @filter, i64 %223 - %225 = load i16, ptr %224, align 2, !tbaa !6 - %226 = icmp eq i16 %225, 0 - br i1 %226, label %294, label %227 - -227: ; preds = %222 - %228 = and i16 %200, 1 - %229 = icmp eq i16 %228, 0 - %230 = lshr i16 %200, 1 - %231 = xor i16 %230, -19456 - %232 = select i1 %229, i16 %230, i16 %231 - %233 = and i16 %232, 128 - %234 = icmp eq i16 %233, 0 - %235 = select i1 %234, i16 %217, i16 %211 - %236 = zext nneg i16 %235 to i64 - %237 = getelementptr inbounds nuw i16, ptr @filter, i64 %236 - %238 = load i16, ptr %237, align 2, !tbaa !6 - store i16 %207, ptr %237, align 2, !tbaa !6 - br label %239 - -239: ; preds = %278, %227 - %240 = phi i32 [ 0, %227 ], [ %290, %278 ] - %241 = phi i16 [ %235, %227 ], [ %285, %278 ] - %242 = phi i16 [ %238, %227 ], [ %289, %278 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.4) #4 - %243 = lshr i16 %242, 8 - %244 = mul i16 %242, 33 - %245 = add i16 %244, 69 - %246 = add i16 %245, %243 - %247 = and i16 %246, 255 - %248 = xor i16 %247, %241 - %249 = zext nneg i16 %248 to i64 - %250 = getelementptr inbounds nuw i16, ptr @filter, i64 %249 - %251 = load i16, ptr %250, align 2, !tbaa !6 - %252 = freeze i16 %251 - store i16 %242, ptr %250, align 2, !tbaa !6 - %253 = icmp eq i16 %252, 0 - br i1 %253, label %.loopexit1, label %254, !llvm.loop !12 - -254: ; preds = %239 - %255 = lshr i16 %252, 8 - %256 = mul i16 %252, 33 - %257 = add i16 %256, 69 - %258 = add i16 %257, %255 - %259 = and i16 %258, 255 - %260 = xor i16 %259, %248 - %261 = zext nneg i16 %260 to i64 - %262 = getelementptr inbounds nuw i16, ptr @filter, i64 %261 - %263 = load i16, ptr %262, align 2, !tbaa !6 - %264 = freeze i16 %263 - store i16 %252, ptr %262, align 2, !tbaa !6 - %265 = icmp eq i16 %264, 0 - br i1 %265, label %.loopexit1, label %266, !llvm.loop !12 - -266: ; preds = %254 - %267 = lshr i16 %264, 8 - %268 = mul i16 %264, 33 - %269 = add i16 %268, 69 - %270 = add i16 %269, %267 - %271 = and i16 %270, 255 - %272 = xor i16 %271, %260 - %273 = zext nneg i16 %272 to i64 - %274 = getelementptr inbounds nuw i16, ptr @filter, i64 %273 - %275 = load i16, ptr %274, align 2, !tbaa !6 - %276 = freeze i16 %275 - store i16 %264, ptr %274, align 2, !tbaa !6 - %277 = icmp eq i16 %276, 0 - br i1 %277, label %.loopexit1, label %278, !llvm.loop !12 - -278: ; preds = %266 - %279 = or disjoint i32 %240, 3 - %280 = lshr i16 %276, 8 - %281 = mul i16 %276, 33 - %282 = add i16 %281, 69 - %283 = add i16 %282, %280 - %284 = and i16 %283, 255 - %285 = xor i16 %284, %272 - %286 = zext nneg i16 %285 to i64 - %287 = getelementptr inbounds nuw i16, ptr @filter, i64 %286 - %288 = load i16, ptr %287, align 2, !tbaa !6 - %289 = freeze i16 %288 - store i16 %276, ptr %287, align 2, !tbaa !6 - %290 = add nuw nsw i32 %240, 4 - %291 = icmp ne i16 %289, 0 - %292 = icmp samesign ult i32 %279, 7 - %293 = select i1 %291, i1 %292, i1 false - br i1 %293, label %239, label %.loopexit1, !llvm.loop !14 - -294: ; preds = %222 - store i16 %207, ptr %224, align 2, !tbaa !6 - br label %296 - -295: ; preds = %199 - store i16 %207, ptr %219, align 2, !tbaa !6 - br label %296 - -.loopexit1: ; preds = %239, %254, %266, %278 - br label %296 - -296: ; preds = %.loopexit1, %295, %294 - %297 = phi i16 [ %200, %295 ], [ %200, %294 ], [ %232, %.loopexit1 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.5) #4 - %298 = mul i16 %202, 17 - %299 = add i16 %298, 17 - %300 = lshr i16 %299, 8 - %301 = and i16 %299, 255 - %302 = mul nuw nsw i16 %301, 33 - %303 = add nuw nsw i16 %300, 27205 - %304 = add nuw i16 %303, %302 - %305 = mul i16 %299, 33 - %306 = add i16 %305, 69 - %307 = add i16 %306, %300 - %308 = and i16 %307, 255 - %309 = lshr i16 %304, 8 - %310 = mul i16 %304, 33 - %311 = add i16 %310, 69 - %312 = add i16 %311, %309 - %313 = xor i16 %312, %307 - %314 = and i16 %313, 255 - %315 = zext nneg i16 %308 to i64 - %316 = getelementptr inbounds nuw i16, ptr @filter, i64 %315 - %317 = load i16, ptr %316, align 2, !tbaa !6 - %318 = icmp eq i16 %317, 0 - br i1 %318, label %392, label %319 - -319: ; preds = %296 - %320 = zext nneg i16 %314 to i64 - %321 = getelementptr inbounds nuw i16, ptr @filter, i64 %320 - %322 = load i16, ptr %321, align 2, !tbaa !6 - %323 = icmp eq i16 %322, 0 - br i1 %323, label %391, label %324 - -324: ; preds = %319 - %325 = and i16 %297, 1 - %326 = icmp eq i16 %325, 0 - %327 = lshr i16 %297, 1 - %328 = xor i16 %327, -19456 - %329 = select i1 %326, i16 %327, i16 %328 - %330 = and i16 %329, 128 - %331 = icmp eq i16 %330, 0 - %332 = select i1 %331, i16 %314, i16 %308 - %333 = zext nneg i16 %332 to i64 - %334 = getelementptr inbounds nuw i16, ptr @filter, i64 %333 - %335 = load i16, ptr %334, align 2, !tbaa !6 - store i16 %304, ptr %334, align 2, !tbaa !6 - br label %336 - -336: ; preds = %375, %324 - %337 = phi i32 [ 0, %324 ], [ %387, %375 ] - %338 = phi i16 [ %332, %324 ], [ %382, %375 ] - %339 = phi i16 [ %335, %324 ], [ %386, %375 ] - call void @__checkpoint(ptr nonnull @checkpoint_name.6) #4 - %340 = lshr i16 %339, 8 - %341 = mul i16 %339, 33 - %342 = add i16 %341, 69 - %343 = add i16 %342, %340 - %344 = and i16 %343, 255 - %345 = xor i16 %344, %338 - %346 = zext nneg i16 %345 to i64 - %347 = getelementptr inbounds nuw i16, ptr @filter, i64 %346 - %348 = load i16, ptr %347, align 2, !tbaa !6 - %349 = freeze i16 %348 - store i16 %339, ptr %347, align 2, !tbaa !6 - %350 = icmp eq i16 %349, 0 - br i1 %350, label %.loopexit, label %351, !llvm.loop !12 - -351: ; preds = %336 - %352 = lshr i16 %349, 8 - %353 = mul i16 %349, 33 - %354 = add i16 %353, 69 - %355 = add i16 %354, %352 - %356 = and i16 %355, 255 - %357 = xor i16 %356, %345 - %358 = zext nneg i16 %357 to i64 - %359 = getelementptr inbounds nuw i16, ptr @filter, i64 %358 - %360 = load i16, ptr %359, align 2, !tbaa !6 - %361 = freeze i16 %360 - store i16 %349, ptr %359, align 2, !tbaa !6 - %362 = icmp eq i16 %361, 0 - br i1 %362, label %.loopexit, label %363, !llvm.loop !12 - -363: ; preds = %351 - %364 = lshr i16 %361, 8 - %365 = mul i16 %361, 33 - %366 = add i16 %365, 69 - %367 = add i16 %366, %364 - %368 = and i16 %367, 255 - %369 = xor i16 %368, %357 - %370 = zext nneg i16 %369 to i64 - %371 = getelementptr inbounds nuw i16, ptr @filter, i64 %370 - %372 = load i16, ptr %371, align 2, !tbaa !6 - %373 = freeze i16 %372 - store i16 %361, ptr %371, align 2, !tbaa !6 - %374 = icmp eq i16 %373, 0 - br i1 %374, label %.loopexit, label %375, !llvm.loop !12 - -375: ; preds = %363 - %376 = or disjoint i32 %337, 3 - %377 = lshr i16 %373, 8 - %378 = mul i16 %373, 33 - %379 = add i16 %378, 69 - %380 = add i16 %379, %377 - %381 = and i16 %380, 255 - %382 = xor i16 %381, %369 - %383 = zext nneg i16 %382 to i64 - %384 = getelementptr inbounds nuw i16, ptr @filter, i64 %383 - %385 = load i16, ptr %384, align 2, !tbaa !6 - %386 = freeze i16 %385 - store i16 %373, ptr %384, align 2, !tbaa !6 - %387 = add nuw nsw i32 %337, 4 - %388 = icmp ne i16 %386, 0 - %389 = icmp samesign ult i32 %376, 7 - %390 = select i1 %388, i1 %389, i1 false - br i1 %390, label %336, label %.loopexit, !llvm.loop !14 - -391: ; preds = %319 - store i16 %304, ptr %321, align 2, !tbaa !6 - br label %393 - -392: ; preds = %296 - store i16 %304, ptr %316, align 2, !tbaa !6 - br label %393 - -.loopexit: ; preds = %336, %351, %363, %375 - br label %393 - -393: ; preds = %.loopexit, %392, %391 - %394 = phi i16 [ %297, %392 ], [ %297, %391 ], [ %329, %.loopexit ] - call void @__checkpoint(ptr nonnull @checkpoint_name.7) #4 - %395 = add nuw nsw i32 %5, 4 - %396 = icmp eq i32 %395, 128 - br i1 %396, label %2, label %3, !llvm.loop !16 - -397: ; preds = %520 - call void @llvm.lifetime.end.p0(ptr nonnull %1) - ret i32 0 - -398: ; preds = %520, %2 - %399 = phi i32 [ 0, %2 ], [ %521, %520 ] - %400 = phi i16 [ 1, %2 ], [ %492, %520 ] - %401 = mul i16 %400, 17 - %402 = add i16 %401, 17 - %403 = lshr i16 %402, 8 - %404 = and i16 %402, 255 - %405 = mul nuw nsw i16 %404, 33 - %406 = add nuw nsw i16 %403, 27205 - %407 = add nuw i16 %406, %405 - %408 = mul i16 %402, 33 - %409 = add i16 %408, 69 - %410 = add i16 %409, %403 - %411 = and i16 %410, 255 - %412 = zext nneg i16 %411 to i64 - %413 = getelementptr inbounds nuw i16, ptr @filter, i64 %412 - %414 = load i16, ptr %413, align 2, !tbaa !6 - %415 = icmp eq i16 %414, %407 - br i1 %415, label %427, label %416 - -416: ; preds = %398 - call void @__checkpoint(ptr nonnull @checkpoint_name.8) #4 - %417 = mul i16 %407, 33 - %418 = add i16 %417, 69 - %419 = lshr i16 %407, 8 - %420 = add i16 %418, %419 - %421 = xor i16 %420, %410 - %422 = and i16 %421, 255 - %423 = zext nneg i16 %422 to i64 - %424 = getelementptr inbounds nuw i16, ptr @filter, i64 %423 - %425 = load i16, ptr %424, align 2, !tbaa !6 - %426 = icmp eq i16 %425, %407 - br i1 %426, label %427, label %430 - -427: ; preds = %416, %398 - call void @__checkpoint(ptr nonnull @checkpoint_name.9) #4 - %428 = load volatile i32, ptr %1, align 4, !tbaa !10 - %429 = add i32 %428, 1 - store volatile i32 %429, ptr %1, align 4, !tbaa !10 - br label %430 - -430: ; preds = %427, %416 - %431 = mul i16 %402, 17 - %432 = add i16 %431, 17 - %433 = lshr i16 %432, 8 - %434 = and i16 %432, 255 - %435 = mul nuw nsw i16 %434, 33 - %436 = add nuw nsw i16 %433, 27205 - %437 = add nuw i16 %436, %435 - %438 = mul i16 %432, 33 - %439 = add i16 %438, 69 - %440 = add i16 %439, %433 - %441 = and i16 %440, 255 - %442 = zext nneg i16 %441 to i64 - %443 = getelementptr inbounds nuw i16, ptr @filter, i64 %442 - %444 = load i16, ptr %443, align 2, !tbaa !6 - %445 = icmp eq i16 %444, %437 - br i1 %445, label %457, label %446 - -446: ; preds = %430 - %447 = mul i16 %437, 33 - %448 = add i16 %447, 69 - %449 = lshr i16 %437, 8 - %450 = add i16 %448, %449 - %451 = xor i16 %450, %440 - %452 = and i16 %451, 255 - %453 = zext nneg i16 %452 to i64 - %454 = getelementptr inbounds nuw i16, ptr @filter, i64 %453 - %455 = load i16, ptr %454, align 2, !tbaa !6 - %456 = icmp eq i16 %455, %437 - br i1 %456, label %457, label %460 - -457: ; preds = %446, %430 - %458 = load volatile i32, ptr %1, align 4, !tbaa !10 - %459 = add i32 %458, 1 - store volatile i32 %459, ptr %1, align 4, !tbaa !10 - br label %460 - -460: ; preds = %457, %446 - %461 = mul i16 %432, 17 - %462 = add i16 %461, 17 - %463 = lshr i16 %462, 8 - %464 = and i16 %462, 255 - %465 = mul nuw nsw i16 %464, 33 - %466 = add nuw nsw i16 %463, 27205 - %467 = add nuw i16 %466, %465 - %468 = mul i16 %462, 33 - %469 = add i16 %468, 69 - %470 = add i16 %469, %463 - %471 = and i16 %470, 255 - %472 = zext nneg i16 %471 to i64 - %473 = getelementptr inbounds nuw i16, ptr @filter, i64 %472 - %474 = load i16, ptr %473, align 2, !tbaa !6 - %475 = icmp eq i16 %474, %467 - br i1 %475, label %487, label %476 - -476: ; preds = %460 - call void @__checkpoint(ptr nonnull @checkpoint_name.10) #4 - %477 = mul i16 %467, 33 - %478 = add i16 %477, 69 - %479 = lshr i16 %467, 8 - %480 = add i16 %478, %479 - %481 = xor i16 %480, %470 - %482 = and i16 %481, 255 - %483 = zext nneg i16 %482 to i64 - %484 = getelementptr inbounds nuw i16, ptr @filter, i64 %483 - %485 = load i16, ptr %484, align 2, !tbaa !6 - %486 = icmp eq i16 %485, %467 - br i1 %486, label %487, label %490 - -487: ; preds = %476, %460 - call void @__checkpoint(ptr nonnull @checkpoint_name.11) #4 - %488 = load volatile i32, ptr %1, align 4, !tbaa !10 - %489 = add i32 %488, 1 - store volatile i32 %489, ptr %1, align 4, !tbaa !10 - br label %490 - -490: ; preds = %487, %476 - %491 = mul i16 %462, 17 - %492 = add i16 %491, 17 - %493 = lshr i16 %492, 8 - %494 = and i16 %492, 255 - %495 = mul nuw nsw i16 %494, 33 - %496 = add nuw nsw i16 %493, 27205 - %497 = add nuw i16 %496, %495 - %498 = mul i16 %492, 33 - %499 = add i16 %498, 69 - %500 = add i16 %499, %493 - %501 = and i16 %500, 255 - %502 = zext nneg i16 %501 to i64 - %503 = getelementptr inbounds nuw i16, ptr @filter, i64 %502 - %504 = load i16, ptr %503, align 2, !tbaa !6 - %505 = icmp eq i16 %504, %497 - br i1 %505, label %517, label %506 - -506: ; preds = %490 - %507 = mul i16 %497, 33 - %508 = add i16 %507, 69 - %509 = lshr i16 %497, 8 - %510 = add i16 %508, %509 - %511 = xor i16 %510, %500 - %512 = and i16 %511, 255 - %513 = zext nneg i16 %512 to i64 - %514 = getelementptr inbounds nuw i16, ptr @filter, i64 %513 - %515 = load i16, ptr %514, align 2, !tbaa !6 - %516 = icmp eq i16 %515, %497 - br i1 %516, label %517, label %520 - -517: ; preds = %506, %490 - %518 = load volatile i32, ptr %1, align 4, !tbaa !10 - %519 = add i32 %518, 1 - store volatile i32 %519, ptr %1, align 4, !tbaa !10 - br label %520 - -520: ; preds = %517, %506 - %521 = add nuw nsw i32 %399, 4 - %522 = icmp eq i32 %521, 128 - br i1 %522, label %397, label %398, !llvm.loop !17 -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #2 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #3 - -declare void @__checkpoint(ptr) - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -attributes #4 = { nounwind } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = distinct !{!12, !13} -!13 = !{!"llvm.loop.mustprogress"} -!14 = distinct !{!14, !13, !15} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !13, !15} -!17 = distinct !{!17, !13, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_unrolled_checkpointed.ll b/benchmarks/intermittent/cuckoo_filter_unrolled_checkpointed.ll deleted file mode 100644 index cca8be4..0000000 --- a/benchmarks/intermittent/cuckoo_filter_unrolled_checkpointed.ll +++ /dev/null @@ -1,744 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter_clang_unrolled.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb7\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [5 x i8] c"bb11\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb20\00", align 1 -@checkpoint_name.4 = private unnamed_addr constant [5 x i8] c"bb23\00", align 1 -@checkpoint_name.5 = private unnamed_addr constant [5 x i8] c"bb29\00", align 1 -@checkpoint_name.6 = private unnamed_addr constant [5 x i8] c"bb32\00", align 1 -@checkpoint_name.7 = private unnamed_addr constant [5 x i8] c"bb38\00", align 1 -@checkpoint_name.8 = private unnamed_addr constant [5 x i8] c"bb41\00", align 1 -@checkpoint_name.9 = private unnamed_addr constant [5 x i8] c"bb42\00", align 1 -@checkpoint_name.10 = private unnamed_addr constant [5 x i8] c"bb47\00", align 1 -@checkpoint_name.11 = private unnamed_addr constant [5 x i8] c"bb48\00", align 1 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %3 - -2: ; preds = %393 - call void @llvm.lifetime.start.p0(ptr %1) - store volatile i32 0, ptr %1, align 4, !tbaa !10 - br label %398 - -3: ; preds = %393, %0 - %4 = phi i16 [ 1, %0 ], [ %299, %393 ] - %5 = phi i32 [ 0, %0 ], [ %395, %393 ] - %6 = phi i16 [ -21279, %0 ], [ %394, %393 ] - %7 = mul i16 %4, 17 - %8 = add i16 %7, 17 - %9 = lshr i16 %8, 8 - %10 = and i16 %8, 255 - %11 = mul nuw nsw i16 %10, 33 - %12 = add nuw nsw i16 %9, 27205 - %13 = add nuw i16 %12, %11 - %14 = mul i16 %8, 33 - %15 = add i16 %14, 69 - %16 = add i16 %15, %9 - %17 = and i16 %16, 255 - %18 = lshr i16 %13, 8 - %19 = mul i16 %13, 33 - %20 = add i16 %19, 69 - %21 = add i16 %20, %18 - %22 = xor i16 %21, %16 - %23 = and i16 %22, 255 - %24 = zext nneg i16 %17 to i64 - %25 = getelementptr inbounds nuw i16, ptr @filter, i64 %24 - %26 = load i16, ptr %25, align 2, !tbaa !6 - %27 = icmp eq i16 %26, 0 - br i1 %27, label %28, label %29 - -28: ; preds = %3 - store i16 %13, ptr %25, align 2, !tbaa !6 - br label %102 - -29: ; preds = %3 - %30 = zext nneg i16 %23 to i64 - %31 = getelementptr inbounds nuw i16, ptr @filter, i64 %30 - %32 = load i16, ptr %31, align 2, !tbaa !6 - %33 = icmp eq i16 %32, 0 - br i1 %33, label %34, label %35 - -34: ; preds = %29 - store i16 %13, ptr %31, align 2, !tbaa !6 - br label %102 - -35: ; preds = %29 - %36 = and i16 %6, 1 - %37 = icmp eq i16 %36, 0 - %38 = lshr i16 %6, 1 - %39 = xor i16 %38, -19456 - %40 = select i1 %37, i16 %38, i16 %39 - %41 = and i16 %40, 128 - %42 = icmp eq i16 %41, 0 - %43 = select i1 %42, i16 %23, i16 %17 - %44 = zext nneg i16 %43 to i64 - %45 = getelementptr inbounds nuw i16, ptr @filter, i64 %44 - %46 = load i16, ptr %45, align 2, !tbaa !6 - store i16 %13, ptr %45, align 2, !tbaa !6 - br label %47 - -47: ; preds = %86, %35 - %48 = phi i32 [ 0, %35 ], [ %98, %86 ] - %49 = phi i16 [ %43, %35 ], [ %93, %86 ] - %50 = phi i16 [ %46, %35 ], [ %97, %86 ] - call void @__checkpoint(ptr @checkpoint_name) - %51 = lshr i16 %50, 8 - %52 = mul i16 %50, 33 - %53 = add i16 %52, 69 - %54 = add i16 %53, %51 - %55 = and i16 %54, 255 - %56 = xor i16 %55, %49 - %57 = zext nneg i16 %56 to i64 - %58 = getelementptr inbounds nuw i16, ptr @filter, i64 %57 - %59 = load i16, ptr %58, align 2, !tbaa !6 - %60 = freeze i16 %59 - store i16 %50, ptr %58, align 2, !tbaa !6 - %61 = icmp eq i16 %60, 0 - br i1 %61, label %102, label %62, !llvm.loop !12 - -62: ; preds = %47 - %63 = lshr i16 %60, 8 - %64 = mul i16 %60, 33 - %65 = add i16 %64, 69 - %66 = add i16 %65, %63 - %67 = and i16 %66, 255 - %68 = xor i16 %67, %56 - %69 = zext nneg i16 %68 to i64 - %70 = getelementptr inbounds nuw i16, ptr @filter, i64 %69 - %71 = load i16, ptr %70, align 2, !tbaa !6 - %72 = freeze i16 %71 - store i16 %60, ptr %70, align 2, !tbaa !6 - %73 = icmp eq i16 %72, 0 - br i1 %73, label %102, label %74, !llvm.loop !12 - -74: ; preds = %62 - %75 = lshr i16 %72, 8 - %76 = mul i16 %72, 33 - %77 = add i16 %76, 69 - %78 = add i16 %77, %75 - %79 = and i16 %78, 255 - %80 = xor i16 %79, %68 - %81 = zext nneg i16 %80 to i64 - %82 = getelementptr inbounds nuw i16, ptr @filter, i64 %81 - %83 = load i16, ptr %82, align 2, !tbaa !6 - %84 = freeze i16 %83 - store i16 %72, ptr %82, align 2, !tbaa !6 - %85 = icmp eq i16 %84, 0 - br i1 %85, label %102, label %86, !llvm.loop !12 - -86: ; preds = %74 - %87 = or disjoint i32 %48, 3 - %88 = lshr i16 %84, 8 - %89 = mul i16 %84, 33 - %90 = add i16 %89, 69 - %91 = add i16 %90, %88 - %92 = and i16 %91, 255 - %93 = xor i16 %92, %80 - %94 = zext nneg i16 %93 to i64 - %95 = getelementptr inbounds nuw i16, ptr @filter, i64 %94 - %96 = load i16, ptr %95, align 2, !tbaa !6 - %97 = freeze i16 %96 - store i16 %84, ptr %95, align 2, !tbaa !6 - %98 = add nuw nsw i32 %48, 4 - %99 = icmp ne i16 %97, 0 - %100 = icmp samesign ult i32 %87, 7 - %101 = select i1 %99, i1 %100, i1 false - br i1 %101, label %47, label %102, !llvm.loop !14 - -102: ; preds = %86, %74, %62, %47, %34, %28 - %103 = phi i16 [ %6, %28 ], [ %6, %34 ], [ %40, %86 ], [ %40, %74 ], [ %40, %62 ], [ %40, %47 ] - call void @__checkpoint(ptr @checkpoint_name.1) - %104 = mul i16 %8, 17 - %105 = add i16 %104, 17 - %106 = lshr i16 %105, 8 - %107 = and i16 %105, 255 - %108 = mul nuw nsw i16 %107, 33 - %109 = add nuw nsw i16 %106, 27205 - %110 = add nuw i16 %109, %108 - %111 = mul i16 %105, 33 - %112 = add i16 %111, 69 - %113 = add i16 %112, %106 - %114 = and i16 %113, 255 - %115 = lshr i16 %110, 8 - %116 = mul i16 %110, 33 - %117 = add i16 %116, 69 - %118 = add i16 %117, %115 - %119 = xor i16 %118, %113 - %120 = and i16 %119, 255 - %121 = zext nneg i16 %114 to i64 - %122 = getelementptr inbounds nuw i16, ptr @filter, i64 %121 - %123 = load i16, ptr %122, align 2, !tbaa !6 - %124 = icmp eq i16 %123, 0 - br i1 %124, label %198, label %125 - -125: ; preds = %102 - %126 = zext nneg i16 %120 to i64 - %127 = getelementptr inbounds nuw i16, ptr @filter, i64 %126 - %128 = load i16, ptr %127, align 2, !tbaa !6 - %129 = icmp eq i16 %128, 0 - br i1 %129, label %197, label %130 - -130: ; preds = %125 - %131 = and i16 %103, 1 - %132 = icmp eq i16 %131, 0 - %133 = lshr i16 %103, 1 - %134 = xor i16 %133, -19456 - %135 = select i1 %132, i16 %133, i16 %134 - %136 = and i16 %135, 128 - %137 = icmp eq i16 %136, 0 - %138 = select i1 %137, i16 %120, i16 %114 - %139 = zext nneg i16 %138 to i64 - %140 = getelementptr inbounds nuw i16, ptr @filter, i64 %139 - %141 = load i16, ptr %140, align 2, !tbaa !6 - store i16 %110, ptr %140, align 2, !tbaa !6 - br label %142 - -142: ; preds = %181, %130 - %143 = phi i32 [ 0, %130 ], [ %193, %181 ] - %144 = phi i16 [ %138, %130 ], [ %188, %181 ] - %145 = phi i16 [ %141, %130 ], [ %192, %181 ] - call void @__checkpoint(ptr @checkpoint_name.2) - %146 = lshr i16 %145, 8 - %147 = mul i16 %145, 33 - %148 = add i16 %147, 69 - %149 = add i16 %148, %146 - %150 = and i16 %149, 255 - %151 = xor i16 %150, %144 - %152 = zext nneg i16 %151 to i64 - %153 = getelementptr inbounds nuw i16, ptr @filter, i64 %152 - %154 = load i16, ptr %153, align 2, !tbaa !6 - %155 = freeze i16 %154 - store i16 %145, ptr %153, align 2, !tbaa !6 - %156 = icmp eq i16 %155, 0 - br i1 %156, label %199, label %157, !llvm.loop !12 - -157: ; preds = %142 - %158 = lshr i16 %155, 8 - %159 = mul i16 %155, 33 - %160 = add i16 %159, 69 - %161 = add i16 %160, %158 - %162 = and i16 %161, 255 - %163 = xor i16 %162, %151 - %164 = zext nneg i16 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = freeze i16 %166 - store i16 %155, ptr %165, align 2, !tbaa !6 - %168 = icmp eq i16 %167, 0 - br i1 %168, label %199, label %169, !llvm.loop !12 - -169: ; preds = %157 - %170 = lshr i16 %167, 8 - %171 = mul i16 %167, 33 - %172 = add i16 %171, 69 - %173 = add i16 %172, %170 - %174 = and i16 %173, 255 - %175 = xor i16 %174, %163 - %176 = zext nneg i16 %175 to i64 - %177 = getelementptr inbounds nuw i16, ptr @filter, i64 %176 - %178 = load i16, ptr %177, align 2, !tbaa !6 - %179 = freeze i16 %178 - store i16 %167, ptr %177, align 2, !tbaa !6 - %180 = icmp eq i16 %179, 0 - br i1 %180, label %199, label %181, !llvm.loop !12 - -181: ; preds = %169 - %182 = or disjoint i32 %143, 3 - %183 = lshr i16 %179, 8 - %184 = mul i16 %179, 33 - %185 = add i16 %184, 69 - %186 = add i16 %185, %183 - %187 = and i16 %186, 255 - %188 = xor i16 %187, %175 - %189 = zext nneg i16 %188 to i64 - %190 = getelementptr inbounds nuw i16, ptr @filter, i64 %189 - %191 = load i16, ptr %190, align 2, !tbaa !6 - %192 = freeze i16 %191 - store i16 %179, ptr %190, align 2, !tbaa !6 - %193 = add nuw nsw i32 %143, 4 - %194 = icmp ne i16 %192, 0 - %195 = icmp samesign ult i32 %182, 7 - %196 = select i1 %194, i1 %195, i1 false - br i1 %196, label %142, label %199, !llvm.loop !14 - -197: ; preds = %125 - store i16 %110, ptr %127, align 2, !tbaa !6 - br label %199 - -198: ; preds = %102 - store i16 %110, ptr %122, align 2, !tbaa !6 - br label %199 - -199: ; preds = %198, %197, %181, %169, %157, %142 - %200 = phi i16 [ %103, %198 ], [ %103, %197 ], [ %135, %181 ], [ %135, %169 ], [ %135, %157 ], [ %135, %142 ] - call void @__checkpoint(ptr @checkpoint_name.3) - %201 = mul i16 %105, 17 - %202 = add i16 %201, 17 - %203 = lshr i16 %202, 8 - %204 = and i16 %202, 255 - %205 = mul nuw nsw i16 %204, 33 - %206 = add nuw nsw i16 %203, 27205 - %207 = add nuw i16 %206, %205 - %208 = mul i16 %202, 33 - %209 = add i16 %208, 69 - %210 = add i16 %209, %203 - %211 = and i16 %210, 255 - %212 = lshr i16 %207, 8 - %213 = mul i16 %207, 33 - %214 = add i16 %213, 69 - %215 = add i16 %214, %212 - %216 = xor i16 %215, %210 - %217 = and i16 %216, 255 - %218 = zext nneg i16 %211 to i64 - %219 = getelementptr inbounds nuw i16, ptr @filter, i64 %218 - %220 = load i16, ptr %219, align 2, !tbaa !6 - %221 = icmp eq i16 %220, 0 - br i1 %221, label %295, label %222 - -222: ; preds = %199 - %223 = zext nneg i16 %217 to i64 - %224 = getelementptr inbounds nuw i16, ptr @filter, i64 %223 - %225 = load i16, ptr %224, align 2, !tbaa !6 - %226 = icmp eq i16 %225, 0 - br i1 %226, label %294, label %227 - -227: ; preds = %222 - %228 = and i16 %200, 1 - %229 = icmp eq i16 %228, 0 - %230 = lshr i16 %200, 1 - %231 = xor i16 %230, -19456 - %232 = select i1 %229, i16 %230, i16 %231 - %233 = and i16 %232, 128 - %234 = icmp eq i16 %233, 0 - %235 = select i1 %234, i16 %217, i16 %211 - %236 = zext nneg i16 %235 to i64 - %237 = getelementptr inbounds nuw i16, ptr @filter, i64 %236 - %238 = load i16, ptr %237, align 2, !tbaa !6 - store i16 %207, ptr %237, align 2, !tbaa !6 - br label %239 - -239: ; preds = %278, %227 - %240 = phi i32 [ 0, %227 ], [ %290, %278 ] - %241 = phi i16 [ %235, %227 ], [ %285, %278 ] - %242 = phi i16 [ %238, %227 ], [ %289, %278 ] - call void @__checkpoint(ptr @checkpoint_name.4) - %243 = lshr i16 %242, 8 - %244 = mul i16 %242, 33 - %245 = add i16 %244, 69 - %246 = add i16 %245, %243 - %247 = and i16 %246, 255 - %248 = xor i16 %247, %241 - %249 = zext nneg i16 %248 to i64 - %250 = getelementptr inbounds nuw i16, ptr @filter, i64 %249 - %251 = load i16, ptr %250, align 2, !tbaa !6 - %252 = freeze i16 %251 - store i16 %242, ptr %250, align 2, !tbaa !6 - %253 = icmp eq i16 %252, 0 - br i1 %253, label %296, label %254, !llvm.loop !12 - -254: ; preds = %239 - %255 = lshr i16 %252, 8 - %256 = mul i16 %252, 33 - %257 = add i16 %256, 69 - %258 = add i16 %257, %255 - %259 = and i16 %258, 255 - %260 = xor i16 %259, %248 - %261 = zext nneg i16 %260 to i64 - %262 = getelementptr inbounds nuw i16, ptr @filter, i64 %261 - %263 = load i16, ptr %262, align 2, !tbaa !6 - %264 = freeze i16 %263 - store i16 %252, ptr %262, align 2, !tbaa !6 - %265 = icmp eq i16 %264, 0 - br i1 %265, label %296, label %266, !llvm.loop !12 - -266: ; preds = %254 - %267 = lshr i16 %264, 8 - %268 = mul i16 %264, 33 - %269 = add i16 %268, 69 - %270 = add i16 %269, %267 - %271 = and i16 %270, 255 - %272 = xor i16 %271, %260 - %273 = zext nneg i16 %272 to i64 - %274 = getelementptr inbounds nuw i16, ptr @filter, i64 %273 - %275 = load i16, ptr %274, align 2, !tbaa !6 - %276 = freeze i16 %275 - store i16 %264, ptr %274, align 2, !tbaa !6 - %277 = icmp eq i16 %276, 0 - br i1 %277, label %296, label %278, !llvm.loop !12 - -278: ; preds = %266 - %279 = or disjoint i32 %240, 3 - %280 = lshr i16 %276, 8 - %281 = mul i16 %276, 33 - %282 = add i16 %281, 69 - %283 = add i16 %282, %280 - %284 = and i16 %283, 255 - %285 = xor i16 %284, %272 - %286 = zext nneg i16 %285 to i64 - %287 = getelementptr inbounds nuw i16, ptr @filter, i64 %286 - %288 = load i16, ptr %287, align 2, !tbaa !6 - %289 = freeze i16 %288 - store i16 %276, ptr %287, align 2, !tbaa !6 - %290 = add nuw nsw i32 %240, 4 - %291 = icmp ne i16 %289, 0 - %292 = icmp samesign ult i32 %279, 7 - %293 = select i1 %291, i1 %292, i1 false - br i1 %293, label %239, label %296, !llvm.loop !14 - -294: ; preds = %222 - store i16 %207, ptr %224, align 2, !tbaa !6 - br label %296 - -295: ; preds = %199 - store i16 %207, ptr %219, align 2, !tbaa !6 - br label %296 - -296: ; preds = %295, %294, %278, %266, %254, %239 - %297 = phi i16 [ %200, %295 ], [ %200, %294 ], [ %232, %278 ], [ %232, %266 ], [ %232, %254 ], [ %232, %239 ] - call void @__checkpoint(ptr @checkpoint_name.5) - %298 = mul i16 %202, 17 - %299 = add i16 %298, 17 - %300 = lshr i16 %299, 8 - %301 = and i16 %299, 255 - %302 = mul nuw nsw i16 %301, 33 - %303 = add nuw nsw i16 %300, 27205 - %304 = add nuw i16 %303, %302 - %305 = mul i16 %299, 33 - %306 = add i16 %305, 69 - %307 = add i16 %306, %300 - %308 = and i16 %307, 255 - %309 = lshr i16 %304, 8 - %310 = mul i16 %304, 33 - %311 = add i16 %310, 69 - %312 = add i16 %311, %309 - %313 = xor i16 %312, %307 - %314 = and i16 %313, 255 - %315 = zext nneg i16 %308 to i64 - %316 = getelementptr inbounds nuw i16, ptr @filter, i64 %315 - %317 = load i16, ptr %316, align 2, !tbaa !6 - %318 = icmp eq i16 %317, 0 - br i1 %318, label %392, label %319 - -319: ; preds = %296 - %320 = zext nneg i16 %314 to i64 - %321 = getelementptr inbounds nuw i16, ptr @filter, i64 %320 - %322 = load i16, ptr %321, align 2, !tbaa !6 - %323 = icmp eq i16 %322, 0 - br i1 %323, label %391, label %324 - -324: ; preds = %319 - %325 = and i16 %297, 1 - %326 = icmp eq i16 %325, 0 - %327 = lshr i16 %297, 1 - %328 = xor i16 %327, -19456 - %329 = select i1 %326, i16 %327, i16 %328 - %330 = and i16 %329, 128 - %331 = icmp eq i16 %330, 0 - %332 = select i1 %331, i16 %314, i16 %308 - %333 = zext nneg i16 %332 to i64 - %334 = getelementptr inbounds nuw i16, ptr @filter, i64 %333 - %335 = load i16, ptr %334, align 2, !tbaa !6 - store i16 %304, ptr %334, align 2, !tbaa !6 - br label %336 - -336: ; preds = %375, %324 - %337 = phi i32 [ 0, %324 ], [ %387, %375 ] - %338 = phi i16 [ %332, %324 ], [ %382, %375 ] - %339 = phi i16 [ %335, %324 ], [ %386, %375 ] - call void @__checkpoint(ptr @checkpoint_name.6) - %340 = lshr i16 %339, 8 - %341 = mul i16 %339, 33 - %342 = add i16 %341, 69 - %343 = add i16 %342, %340 - %344 = and i16 %343, 255 - %345 = xor i16 %344, %338 - %346 = zext nneg i16 %345 to i64 - %347 = getelementptr inbounds nuw i16, ptr @filter, i64 %346 - %348 = load i16, ptr %347, align 2, !tbaa !6 - %349 = freeze i16 %348 - store i16 %339, ptr %347, align 2, !tbaa !6 - %350 = icmp eq i16 %349, 0 - br i1 %350, label %393, label %351, !llvm.loop !12 - -351: ; preds = %336 - %352 = lshr i16 %349, 8 - %353 = mul i16 %349, 33 - %354 = add i16 %353, 69 - %355 = add i16 %354, %352 - %356 = and i16 %355, 255 - %357 = xor i16 %356, %345 - %358 = zext nneg i16 %357 to i64 - %359 = getelementptr inbounds nuw i16, ptr @filter, i64 %358 - %360 = load i16, ptr %359, align 2, !tbaa !6 - %361 = freeze i16 %360 - store i16 %349, ptr %359, align 2, !tbaa !6 - %362 = icmp eq i16 %361, 0 - br i1 %362, label %393, label %363, !llvm.loop !12 - -363: ; preds = %351 - %364 = lshr i16 %361, 8 - %365 = mul i16 %361, 33 - %366 = add i16 %365, 69 - %367 = add i16 %366, %364 - %368 = and i16 %367, 255 - %369 = xor i16 %368, %357 - %370 = zext nneg i16 %369 to i64 - %371 = getelementptr inbounds nuw i16, ptr @filter, i64 %370 - %372 = load i16, ptr %371, align 2, !tbaa !6 - %373 = freeze i16 %372 - store i16 %361, ptr %371, align 2, !tbaa !6 - %374 = icmp eq i16 %373, 0 - br i1 %374, label %393, label %375, !llvm.loop !12 - -375: ; preds = %363 - %376 = or disjoint i32 %337, 3 - %377 = lshr i16 %373, 8 - %378 = mul i16 %373, 33 - %379 = add i16 %378, 69 - %380 = add i16 %379, %377 - %381 = and i16 %380, 255 - %382 = xor i16 %381, %369 - %383 = zext nneg i16 %382 to i64 - %384 = getelementptr inbounds nuw i16, ptr @filter, i64 %383 - %385 = load i16, ptr %384, align 2, !tbaa !6 - %386 = freeze i16 %385 - store i16 %373, ptr %384, align 2, !tbaa !6 - %387 = add nuw nsw i32 %337, 4 - %388 = icmp ne i16 %386, 0 - %389 = icmp samesign ult i32 %376, 7 - %390 = select i1 %388, i1 %389, i1 false - br i1 %390, label %336, label %393, !llvm.loop !14 - -391: ; preds = %319 - store i16 %304, ptr %321, align 2, !tbaa !6 - br label %393 - -392: ; preds = %296 - store i16 %304, ptr %316, align 2, !tbaa !6 - br label %393 - -393: ; preds = %392, %391, %375, %363, %351, %336 - %394 = phi i16 [ %297, %392 ], [ %297, %391 ], [ %329, %375 ], [ %329, %363 ], [ %329, %351 ], [ %329, %336 ] - call void @__checkpoint(ptr @checkpoint_name.7) - %395 = add nuw nsw i32 %5, 4 - %396 = icmp eq i32 %395, 128 - br i1 %396, label %2, label %3, !llvm.loop !16 - -397: ; preds = %520 - call void @llvm.lifetime.end.p0(ptr %1) - ret i32 0 - -398: ; preds = %520, %2 - %399 = phi i32 [ 0, %2 ], [ %521, %520 ] - %400 = phi i16 [ 1, %2 ], [ %492, %520 ] - %401 = mul i16 %400, 17 - %402 = add i16 %401, 17 - %403 = lshr i16 %402, 8 - %404 = and i16 %402, 255 - %405 = mul nuw nsw i16 %404, 33 - %406 = add nuw nsw i16 %403, 27205 - %407 = add nuw i16 %406, %405 - %408 = mul i16 %402, 33 - %409 = add i16 %408, 69 - %410 = add i16 %409, %403 - %411 = and i16 %410, 255 - %412 = zext nneg i16 %411 to i64 - %413 = getelementptr inbounds nuw i16, ptr @filter, i64 %412 - %414 = load i16, ptr %413, align 2, !tbaa !6 - %415 = icmp eq i16 %414, %407 - br i1 %415, label %427, label %416 - -416: ; preds = %398 - call void @__checkpoint(ptr @checkpoint_name.8) - %417 = mul i16 %407, 33 - %418 = add i16 %417, 69 - %419 = lshr i16 %407, 8 - %420 = add i16 %418, %419 - %421 = xor i16 %420, %410 - %422 = and i16 %421, 255 - %423 = zext nneg i16 %422 to i64 - %424 = getelementptr inbounds nuw i16, ptr @filter, i64 %423 - %425 = load i16, ptr %424, align 2, !tbaa !6 - %426 = icmp eq i16 %425, %407 - br i1 %426, label %427, label %430 - -427: ; preds = %416, %398 - call void @__checkpoint(ptr @checkpoint_name.9) - %428 = load volatile i32, ptr %1, align 4, !tbaa !10 - %429 = add i32 %428, 1 - store volatile i32 %429, ptr %1, align 4, !tbaa !10 - br label %430 - -430: ; preds = %427, %416 - %431 = mul i16 %402, 17 - %432 = add i16 %431, 17 - %433 = lshr i16 %432, 8 - %434 = and i16 %432, 255 - %435 = mul nuw nsw i16 %434, 33 - %436 = add nuw nsw i16 %433, 27205 - %437 = add nuw i16 %436, %435 - %438 = mul i16 %432, 33 - %439 = add i16 %438, 69 - %440 = add i16 %439, %433 - %441 = and i16 %440, 255 - %442 = zext nneg i16 %441 to i64 - %443 = getelementptr inbounds nuw i16, ptr @filter, i64 %442 - %444 = load i16, ptr %443, align 2, !tbaa !6 - %445 = icmp eq i16 %444, %437 - br i1 %445, label %457, label %446 - -446: ; preds = %430 - %447 = mul i16 %437, 33 - %448 = add i16 %447, 69 - %449 = lshr i16 %437, 8 - %450 = add i16 %448, %449 - %451 = xor i16 %450, %440 - %452 = and i16 %451, 255 - %453 = zext nneg i16 %452 to i64 - %454 = getelementptr inbounds nuw i16, ptr @filter, i64 %453 - %455 = load i16, ptr %454, align 2, !tbaa !6 - %456 = icmp eq i16 %455, %437 - br i1 %456, label %457, label %460 - -457: ; preds = %446, %430 - %458 = load volatile i32, ptr %1, align 4, !tbaa !10 - %459 = add i32 %458, 1 - store volatile i32 %459, ptr %1, align 4, !tbaa !10 - br label %460 - -460: ; preds = %457, %446 - %461 = mul i16 %432, 17 - %462 = add i16 %461, 17 - %463 = lshr i16 %462, 8 - %464 = and i16 %462, 255 - %465 = mul nuw nsw i16 %464, 33 - %466 = add nuw nsw i16 %463, 27205 - %467 = add nuw i16 %466, %465 - %468 = mul i16 %462, 33 - %469 = add i16 %468, 69 - %470 = add i16 %469, %463 - %471 = and i16 %470, 255 - %472 = zext nneg i16 %471 to i64 - %473 = getelementptr inbounds nuw i16, ptr @filter, i64 %472 - %474 = load i16, ptr %473, align 2, !tbaa !6 - %475 = icmp eq i16 %474, %467 - br i1 %475, label %487, label %476 - -476: ; preds = %460 - call void @__checkpoint(ptr @checkpoint_name.10) - %477 = mul i16 %467, 33 - %478 = add i16 %477, 69 - %479 = lshr i16 %467, 8 - %480 = add i16 %478, %479 - %481 = xor i16 %480, %470 - %482 = and i16 %481, 255 - %483 = zext nneg i16 %482 to i64 - %484 = getelementptr inbounds nuw i16, ptr @filter, i64 %483 - %485 = load i16, ptr %484, align 2, !tbaa !6 - %486 = icmp eq i16 %485, %467 - br i1 %486, label %487, label %490 - -487: ; preds = %476, %460 - call void @__checkpoint(ptr @checkpoint_name.11) - %488 = load volatile i32, ptr %1, align 4, !tbaa !10 - %489 = add i32 %488, 1 - store volatile i32 %489, ptr %1, align 4, !tbaa !10 - br label %490 - -490: ; preds = %487, %476 - %491 = mul i16 %462, 17 - %492 = add i16 %491, 17 - %493 = lshr i16 %492, 8 - %494 = and i16 %492, 255 - %495 = mul nuw nsw i16 %494, 33 - %496 = add nuw nsw i16 %493, 27205 - %497 = add nuw i16 %496, %495 - %498 = mul i16 %492, 33 - %499 = add i16 %498, 69 - %500 = add i16 %499, %493 - %501 = and i16 %500, 255 - %502 = zext nneg i16 %501 to i64 - %503 = getelementptr inbounds nuw i16, ptr @filter, i64 %502 - %504 = load i16, ptr %503, align 2, !tbaa !6 - %505 = icmp eq i16 %504, %497 - br i1 %505, label %517, label %506 - -506: ; preds = %490 - %507 = mul i16 %497, 33 - %508 = add i16 %507, 69 - %509 = lshr i16 %497, 8 - %510 = add i16 %508, %509 - %511 = xor i16 %510, %500 - %512 = and i16 %511, 255 - %513 = zext nneg i16 %512 to i64 - %514 = getelementptr inbounds nuw i16, ptr @filter, i64 %513 - %515 = load i16, ptr %514, align 2, !tbaa !6 - %516 = icmp eq i16 %515, %497 - br i1 %516, label %517, label %520 - -517: ; preds = %506, %490 - %518 = load volatile i32, ptr %1, align 4, !tbaa !10 - %519 = add i32 %518, 1 - store volatile i32 %519, ptr %1, align 4, !tbaa !10 - br label %520 - -520: ; preds = %517, %506 - %521 = add nuw nsw i32 %399, 4 - %522 = icmp eq i32 %521, 128 - br i1 %522, label %397, label %398, !llvm.loop !17 -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #2 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #3 - -declare void @__checkpoint(ptr) - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = distinct !{!12, !13} -!13 = !{!"llvm.loop.mustprogress"} -!14 = distinct !{!14, !13, !15} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !13, !15} -!17 = distinct !{!17, !13, !15} diff --git a/benchmarks/intermittent/cuckoo_filter_unrolled_out.ll b/benchmarks/intermittent/cuckoo_filter_unrolled_out.ll deleted file mode 100644 index ae74b88..0000000 --- a/benchmarks/intermittent/cuckoo_filter_unrolled_out.ll +++ /dev/null @@ -1,744 +0,0 @@ -; ModuleID = 'test/intermittent/cuckoo_filter_unrolled.ll' -source_filename = "test/intermittent/cuckoo_filter.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -@filter = internal unnamed_addr global [256 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb7\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [5 x i8] c"bb11\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb20\00", align 1 -@checkpoint_name.4 = private unnamed_addr constant [5 x i8] c"bb23\00", align 1 -@checkpoint_name.5 = private unnamed_addr constant [5 x i8] c"bb29\00", align 1 -@checkpoint_name.6 = private unnamed_addr constant [5 x i8] c"bb32\00", align 1 -@checkpoint_name.7 = private unnamed_addr constant [5 x i8] c"bb38\00", align 1 -@checkpoint_name.8 = private unnamed_addr constant [5 x i8] c"bb41\00", align 1 -@checkpoint_name.9 = private unnamed_addr constant [5 x i8] c"bb42\00", align 1 -@checkpoint_name.10 = private unnamed_addr constant [5 x i8] c"bb47\00", align 1 -@checkpoint_name.11 = private unnamed_addr constant [5 x i8] c"bb48\00", align 1 - -; Function Attrs: mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) -define void @print_filter(ptr noundef readonly captures(none) %0) local_unnamed_addr #0 { - ret void -} - -; Function Attrs: nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) -define noundef i32 @main() local_unnamed_addr #1 { - %1 = alloca i32, align 4 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(512) @filter, i8 0, i64 512, i1 false), !tbaa !6 - br label %3 - -2: ; preds = %393 - call void @llvm.lifetime.start.p0(ptr %1) - store volatile i32 0, ptr %1, align 4, !tbaa !10 - br label %398 - -3: ; preds = %393, %0 - %4 = phi i16 [ 1, %0 ], [ %299, %393 ] - %5 = phi i32 [ 0, %0 ], [ %395, %393 ] - %6 = phi i16 [ -21279, %0 ], [ %394, %393 ] - %7 = mul i16 %4, 17 - %8 = add i16 %7, 17 - %9 = lshr i16 %8, 8 - %10 = and i16 %8, 255 - %11 = mul nuw nsw i16 %10, 33 - %12 = add nuw nsw i16 %9, 27205 - %13 = add nuw i16 %12, %11 - %14 = mul i16 %8, 33 - %15 = add i16 %14, 69 - %16 = add i16 %15, %9 - %17 = and i16 %16, 255 - %18 = lshr i16 %13, 8 - %19 = mul i16 %13, 33 - %20 = add i16 %19, 69 - %21 = add i16 %20, %18 - %22 = xor i16 %21, %16 - %23 = and i16 %22, 255 - %24 = zext nneg i16 %17 to i64 - %25 = getelementptr inbounds nuw i16, ptr @filter, i64 %24 - %26 = load i16, ptr %25, align 2, !tbaa !6 - %27 = icmp eq i16 %26, 0 - br i1 %27, label %28, label %29 - -28: ; preds = %3 - store i16 %13, ptr %25, align 2, !tbaa !6 - br label %102 - -29: ; preds = %3 - %30 = zext nneg i16 %23 to i64 - %31 = getelementptr inbounds nuw i16, ptr @filter, i64 %30 - %32 = load i16, ptr %31, align 2, !tbaa !6 - %33 = icmp eq i16 %32, 0 - br i1 %33, label %34, label %35 - -34: ; preds = %29 - store i16 %13, ptr %31, align 2, !tbaa !6 - br label %102 - -35: ; preds = %29 - %36 = and i16 %6, 1 - %37 = icmp eq i16 %36, 0 - %38 = lshr i16 %6, 1 - %39 = xor i16 %38, -19456 - %40 = select i1 %37, i16 %38, i16 %39 - %41 = and i16 %40, 128 - %42 = icmp eq i16 %41, 0 - %43 = select i1 %42, i16 %23, i16 %17 - %44 = zext nneg i16 %43 to i64 - %45 = getelementptr inbounds nuw i16, ptr @filter, i64 %44 - %46 = load i16, ptr %45, align 2, !tbaa !6 - store i16 %13, ptr %45, align 2, !tbaa !6 - br label %47 - -47: ; preds = %86, %35 - %48 = phi i32 [ 0, %35 ], [ %98, %86 ] - %49 = phi i16 [ %43, %35 ], [ %93, %86 ] - %50 = phi i16 [ %46, %35 ], [ %97, %86 ] - call void @__checkpoint(ptr @checkpoint_name) - %51 = lshr i16 %50, 8 - %52 = mul i16 %50, 33 - %53 = add i16 %52, 69 - %54 = add i16 %53, %51 - %55 = and i16 %54, 255 - %56 = xor i16 %55, %49 - %57 = zext nneg i16 %56 to i64 - %58 = getelementptr inbounds nuw i16, ptr @filter, i64 %57 - %59 = load i16, ptr %58, align 2, !tbaa !6 - %60 = freeze i16 %59 - store i16 %50, ptr %58, align 2, !tbaa !6 - %61 = icmp eq i16 %60, 0 - br i1 %61, label %102, label %62, !llvm.loop !12 - -62: ; preds = %47 - %63 = lshr i16 %60, 8 - %64 = mul i16 %60, 33 - %65 = add i16 %64, 69 - %66 = add i16 %65, %63 - %67 = and i16 %66, 255 - %68 = xor i16 %67, %56 - %69 = zext nneg i16 %68 to i64 - %70 = getelementptr inbounds nuw i16, ptr @filter, i64 %69 - %71 = load i16, ptr %70, align 2, !tbaa !6 - %72 = freeze i16 %71 - store i16 %60, ptr %70, align 2, !tbaa !6 - %73 = icmp eq i16 %72, 0 - br i1 %73, label %102, label %74, !llvm.loop !12 - -74: ; preds = %62 - %75 = lshr i16 %72, 8 - %76 = mul i16 %72, 33 - %77 = add i16 %76, 69 - %78 = add i16 %77, %75 - %79 = and i16 %78, 255 - %80 = xor i16 %79, %68 - %81 = zext nneg i16 %80 to i64 - %82 = getelementptr inbounds nuw i16, ptr @filter, i64 %81 - %83 = load i16, ptr %82, align 2, !tbaa !6 - %84 = freeze i16 %83 - store i16 %72, ptr %82, align 2, !tbaa !6 - %85 = icmp eq i16 %84, 0 - br i1 %85, label %102, label %86, !llvm.loop !12 - -86: ; preds = %74 - %87 = or disjoint i32 %48, 3 - %88 = lshr i16 %84, 8 - %89 = mul i16 %84, 33 - %90 = add i16 %89, 69 - %91 = add i16 %90, %88 - %92 = and i16 %91, 255 - %93 = xor i16 %92, %80 - %94 = zext nneg i16 %93 to i64 - %95 = getelementptr inbounds nuw i16, ptr @filter, i64 %94 - %96 = load i16, ptr %95, align 2, !tbaa !6 - %97 = freeze i16 %96 - store i16 %84, ptr %95, align 2, !tbaa !6 - %98 = add nuw nsw i32 %48, 4 - %99 = icmp ne i16 %97, 0 - %100 = icmp samesign ult i32 %87, 7 - %101 = select i1 %99, i1 %100, i1 false - br i1 %101, label %47, label %102, !llvm.loop !14 - -102: ; preds = %86, %74, %62, %47, %34, %28 - %103 = phi i16 [ %6, %28 ], [ %6, %34 ], [ %40, %86 ], [ %40, %74 ], [ %40, %62 ], [ %40, %47 ] - call void @__checkpoint(ptr @checkpoint_name.1) - %104 = mul i16 %8, 17 - %105 = add i16 %104, 17 - %106 = lshr i16 %105, 8 - %107 = and i16 %105, 255 - %108 = mul nuw nsw i16 %107, 33 - %109 = add nuw nsw i16 %106, 27205 - %110 = add nuw i16 %109, %108 - %111 = mul i16 %105, 33 - %112 = add i16 %111, 69 - %113 = add i16 %112, %106 - %114 = and i16 %113, 255 - %115 = lshr i16 %110, 8 - %116 = mul i16 %110, 33 - %117 = add i16 %116, 69 - %118 = add i16 %117, %115 - %119 = xor i16 %118, %113 - %120 = and i16 %119, 255 - %121 = zext nneg i16 %114 to i64 - %122 = getelementptr inbounds nuw i16, ptr @filter, i64 %121 - %123 = load i16, ptr %122, align 2, !tbaa !6 - %124 = icmp eq i16 %123, 0 - br i1 %124, label %198, label %125 - -125: ; preds = %102 - %126 = zext nneg i16 %120 to i64 - %127 = getelementptr inbounds nuw i16, ptr @filter, i64 %126 - %128 = load i16, ptr %127, align 2, !tbaa !6 - %129 = icmp eq i16 %128, 0 - br i1 %129, label %197, label %130 - -130: ; preds = %125 - %131 = and i16 %103, 1 - %132 = icmp eq i16 %131, 0 - %133 = lshr i16 %103, 1 - %134 = xor i16 %133, -19456 - %135 = select i1 %132, i16 %133, i16 %134 - %136 = and i16 %135, 128 - %137 = icmp eq i16 %136, 0 - %138 = select i1 %137, i16 %120, i16 %114 - %139 = zext nneg i16 %138 to i64 - %140 = getelementptr inbounds nuw i16, ptr @filter, i64 %139 - %141 = load i16, ptr %140, align 2, !tbaa !6 - store i16 %110, ptr %140, align 2, !tbaa !6 - br label %142 - -142: ; preds = %181, %130 - %143 = phi i32 [ 0, %130 ], [ %193, %181 ] - %144 = phi i16 [ %138, %130 ], [ %188, %181 ] - %145 = phi i16 [ %141, %130 ], [ %192, %181 ] - call void @__checkpoint(ptr @checkpoint_name.2) - %146 = lshr i16 %145, 8 - %147 = mul i16 %145, 33 - %148 = add i16 %147, 69 - %149 = add i16 %148, %146 - %150 = and i16 %149, 255 - %151 = xor i16 %150, %144 - %152 = zext nneg i16 %151 to i64 - %153 = getelementptr inbounds nuw i16, ptr @filter, i64 %152 - %154 = load i16, ptr %153, align 2, !tbaa !6 - %155 = freeze i16 %154 - store i16 %145, ptr %153, align 2, !tbaa !6 - %156 = icmp eq i16 %155, 0 - br i1 %156, label %199, label %157, !llvm.loop !12 - -157: ; preds = %142 - %158 = lshr i16 %155, 8 - %159 = mul i16 %155, 33 - %160 = add i16 %159, 69 - %161 = add i16 %160, %158 - %162 = and i16 %161, 255 - %163 = xor i16 %162, %151 - %164 = zext nneg i16 %163 to i64 - %165 = getelementptr inbounds nuw i16, ptr @filter, i64 %164 - %166 = load i16, ptr %165, align 2, !tbaa !6 - %167 = freeze i16 %166 - store i16 %155, ptr %165, align 2, !tbaa !6 - %168 = icmp eq i16 %167, 0 - br i1 %168, label %199, label %169, !llvm.loop !12 - -169: ; preds = %157 - %170 = lshr i16 %167, 8 - %171 = mul i16 %167, 33 - %172 = add i16 %171, 69 - %173 = add i16 %172, %170 - %174 = and i16 %173, 255 - %175 = xor i16 %174, %163 - %176 = zext nneg i16 %175 to i64 - %177 = getelementptr inbounds nuw i16, ptr @filter, i64 %176 - %178 = load i16, ptr %177, align 2, !tbaa !6 - %179 = freeze i16 %178 - store i16 %167, ptr %177, align 2, !tbaa !6 - %180 = icmp eq i16 %179, 0 - br i1 %180, label %199, label %181, !llvm.loop !12 - -181: ; preds = %169 - %182 = or disjoint i32 %143, 3 - %183 = lshr i16 %179, 8 - %184 = mul i16 %179, 33 - %185 = add i16 %184, 69 - %186 = add i16 %185, %183 - %187 = and i16 %186, 255 - %188 = xor i16 %187, %175 - %189 = zext nneg i16 %188 to i64 - %190 = getelementptr inbounds nuw i16, ptr @filter, i64 %189 - %191 = load i16, ptr %190, align 2, !tbaa !6 - %192 = freeze i16 %191 - store i16 %179, ptr %190, align 2, !tbaa !6 - %193 = add nuw nsw i32 %143, 4 - %194 = icmp ne i16 %192, 0 - %195 = icmp samesign ult i32 %182, 7 - %196 = select i1 %194, i1 %195, i1 false - br i1 %196, label %142, label %199, !llvm.loop !14 - -197: ; preds = %125 - store i16 %110, ptr %127, align 2, !tbaa !6 - br label %199 - -198: ; preds = %102 - store i16 %110, ptr %122, align 2, !tbaa !6 - br label %199 - -199: ; preds = %198, %197, %181, %169, %157, %142 - %200 = phi i16 [ %103, %198 ], [ %103, %197 ], [ %135, %181 ], [ %135, %169 ], [ %135, %157 ], [ %135, %142 ] - call void @__checkpoint(ptr @checkpoint_name.3) - %201 = mul i16 %105, 17 - %202 = add i16 %201, 17 - %203 = lshr i16 %202, 8 - %204 = and i16 %202, 255 - %205 = mul nuw nsw i16 %204, 33 - %206 = add nuw nsw i16 %203, 27205 - %207 = add nuw i16 %206, %205 - %208 = mul i16 %202, 33 - %209 = add i16 %208, 69 - %210 = add i16 %209, %203 - %211 = and i16 %210, 255 - %212 = lshr i16 %207, 8 - %213 = mul i16 %207, 33 - %214 = add i16 %213, 69 - %215 = add i16 %214, %212 - %216 = xor i16 %215, %210 - %217 = and i16 %216, 255 - %218 = zext nneg i16 %211 to i64 - %219 = getelementptr inbounds nuw i16, ptr @filter, i64 %218 - %220 = load i16, ptr %219, align 2, !tbaa !6 - %221 = icmp eq i16 %220, 0 - br i1 %221, label %295, label %222 - -222: ; preds = %199 - %223 = zext nneg i16 %217 to i64 - %224 = getelementptr inbounds nuw i16, ptr @filter, i64 %223 - %225 = load i16, ptr %224, align 2, !tbaa !6 - %226 = icmp eq i16 %225, 0 - br i1 %226, label %294, label %227 - -227: ; preds = %222 - %228 = and i16 %200, 1 - %229 = icmp eq i16 %228, 0 - %230 = lshr i16 %200, 1 - %231 = xor i16 %230, -19456 - %232 = select i1 %229, i16 %230, i16 %231 - %233 = and i16 %232, 128 - %234 = icmp eq i16 %233, 0 - %235 = select i1 %234, i16 %217, i16 %211 - %236 = zext nneg i16 %235 to i64 - %237 = getelementptr inbounds nuw i16, ptr @filter, i64 %236 - %238 = load i16, ptr %237, align 2, !tbaa !6 - store i16 %207, ptr %237, align 2, !tbaa !6 - br label %239 - -239: ; preds = %278, %227 - %240 = phi i32 [ 0, %227 ], [ %290, %278 ] - %241 = phi i16 [ %235, %227 ], [ %285, %278 ] - %242 = phi i16 [ %238, %227 ], [ %289, %278 ] - call void @__checkpoint(ptr @checkpoint_name.4) - %243 = lshr i16 %242, 8 - %244 = mul i16 %242, 33 - %245 = add i16 %244, 69 - %246 = add i16 %245, %243 - %247 = and i16 %246, 255 - %248 = xor i16 %247, %241 - %249 = zext nneg i16 %248 to i64 - %250 = getelementptr inbounds nuw i16, ptr @filter, i64 %249 - %251 = load i16, ptr %250, align 2, !tbaa !6 - %252 = freeze i16 %251 - store i16 %242, ptr %250, align 2, !tbaa !6 - %253 = icmp eq i16 %252, 0 - br i1 %253, label %296, label %254, !llvm.loop !12 - -254: ; preds = %239 - %255 = lshr i16 %252, 8 - %256 = mul i16 %252, 33 - %257 = add i16 %256, 69 - %258 = add i16 %257, %255 - %259 = and i16 %258, 255 - %260 = xor i16 %259, %248 - %261 = zext nneg i16 %260 to i64 - %262 = getelementptr inbounds nuw i16, ptr @filter, i64 %261 - %263 = load i16, ptr %262, align 2, !tbaa !6 - %264 = freeze i16 %263 - store i16 %252, ptr %262, align 2, !tbaa !6 - %265 = icmp eq i16 %264, 0 - br i1 %265, label %296, label %266, !llvm.loop !12 - -266: ; preds = %254 - %267 = lshr i16 %264, 8 - %268 = mul i16 %264, 33 - %269 = add i16 %268, 69 - %270 = add i16 %269, %267 - %271 = and i16 %270, 255 - %272 = xor i16 %271, %260 - %273 = zext nneg i16 %272 to i64 - %274 = getelementptr inbounds nuw i16, ptr @filter, i64 %273 - %275 = load i16, ptr %274, align 2, !tbaa !6 - %276 = freeze i16 %275 - store i16 %264, ptr %274, align 2, !tbaa !6 - %277 = icmp eq i16 %276, 0 - br i1 %277, label %296, label %278, !llvm.loop !12 - -278: ; preds = %266 - %279 = or disjoint i32 %240, 3 - %280 = lshr i16 %276, 8 - %281 = mul i16 %276, 33 - %282 = add i16 %281, 69 - %283 = add i16 %282, %280 - %284 = and i16 %283, 255 - %285 = xor i16 %284, %272 - %286 = zext nneg i16 %285 to i64 - %287 = getelementptr inbounds nuw i16, ptr @filter, i64 %286 - %288 = load i16, ptr %287, align 2, !tbaa !6 - %289 = freeze i16 %288 - store i16 %276, ptr %287, align 2, !tbaa !6 - %290 = add nuw nsw i32 %240, 4 - %291 = icmp ne i16 %289, 0 - %292 = icmp samesign ult i32 %279, 7 - %293 = select i1 %291, i1 %292, i1 false - br i1 %293, label %239, label %296, !llvm.loop !14 - -294: ; preds = %222 - store i16 %207, ptr %224, align 2, !tbaa !6 - br label %296 - -295: ; preds = %199 - store i16 %207, ptr %219, align 2, !tbaa !6 - br label %296 - -296: ; preds = %295, %294, %278, %266, %254, %239 - %297 = phi i16 [ %200, %295 ], [ %200, %294 ], [ %232, %278 ], [ %232, %266 ], [ %232, %254 ], [ %232, %239 ] - call void @__checkpoint(ptr @checkpoint_name.5) - %298 = mul i16 %202, 17 - %299 = add i16 %298, 17 - %300 = lshr i16 %299, 8 - %301 = and i16 %299, 255 - %302 = mul nuw nsw i16 %301, 33 - %303 = add nuw nsw i16 %300, 27205 - %304 = add nuw i16 %303, %302 - %305 = mul i16 %299, 33 - %306 = add i16 %305, 69 - %307 = add i16 %306, %300 - %308 = and i16 %307, 255 - %309 = lshr i16 %304, 8 - %310 = mul i16 %304, 33 - %311 = add i16 %310, 69 - %312 = add i16 %311, %309 - %313 = xor i16 %312, %307 - %314 = and i16 %313, 255 - %315 = zext nneg i16 %308 to i64 - %316 = getelementptr inbounds nuw i16, ptr @filter, i64 %315 - %317 = load i16, ptr %316, align 2, !tbaa !6 - %318 = icmp eq i16 %317, 0 - br i1 %318, label %392, label %319 - -319: ; preds = %296 - %320 = zext nneg i16 %314 to i64 - %321 = getelementptr inbounds nuw i16, ptr @filter, i64 %320 - %322 = load i16, ptr %321, align 2, !tbaa !6 - %323 = icmp eq i16 %322, 0 - br i1 %323, label %391, label %324 - -324: ; preds = %319 - %325 = and i16 %297, 1 - %326 = icmp eq i16 %325, 0 - %327 = lshr i16 %297, 1 - %328 = xor i16 %327, -19456 - %329 = select i1 %326, i16 %327, i16 %328 - %330 = and i16 %329, 128 - %331 = icmp eq i16 %330, 0 - %332 = select i1 %331, i16 %314, i16 %308 - %333 = zext nneg i16 %332 to i64 - %334 = getelementptr inbounds nuw i16, ptr @filter, i64 %333 - %335 = load i16, ptr %334, align 2, !tbaa !6 - store i16 %304, ptr %334, align 2, !tbaa !6 - br label %336 - -336: ; preds = %375, %324 - %337 = phi i32 [ 0, %324 ], [ %387, %375 ] - %338 = phi i16 [ %332, %324 ], [ %382, %375 ] - %339 = phi i16 [ %335, %324 ], [ %386, %375 ] - call void @__checkpoint(ptr @checkpoint_name.6) - %340 = lshr i16 %339, 8 - %341 = mul i16 %339, 33 - %342 = add i16 %341, 69 - %343 = add i16 %342, %340 - %344 = and i16 %343, 255 - %345 = xor i16 %344, %338 - %346 = zext nneg i16 %345 to i64 - %347 = getelementptr inbounds nuw i16, ptr @filter, i64 %346 - %348 = load i16, ptr %347, align 2, !tbaa !6 - %349 = freeze i16 %348 - store i16 %339, ptr %347, align 2, !tbaa !6 - %350 = icmp eq i16 %349, 0 - br i1 %350, label %393, label %351, !llvm.loop !12 - -351: ; preds = %336 - %352 = lshr i16 %349, 8 - %353 = mul i16 %349, 33 - %354 = add i16 %353, 69 - %355 = add i16 %354, %352 - %356 = and i16 %355, 255 - %357 = xor i16 %356, %345 - %358 = zext nneg i16 %357 to i64 - %359 = getelementptr inbounds nuw i16, ptr @filter, i64 %358 - %360 = load i16, ptr %359, align 2, !tbaa !6 - %361 = freeze i16 %360 - store i16 %349, ptr %359, align 2, !tbaa !6 - %362 = icmp eq i16 %361, 0 - br i1 %362, label %393, label %363, !llvm.loop !12 - -363: ; preds = %351 - %364 = lshr i16 %361, 8 - %365 = mul i16 %361, 33 - %366 = add i16 %365, 69 - %367 = add i16 %366, %364 - %368 = and i16 %367, 255 - %369 = xor i16 %368, %357 - %370 = zext nneg i16 %369 to i64 - %371 = getelementptr inbounds nuw i16, ptr @filter, i64 %370 - %372 = load i16, ptr %371, align 2, !tbaa !6 - %373 = freeze i16 %372 - store i16 %361, ptr %371, align 2, !tbaa !6 - %374 = icmp eq i16 %373, 0 - br i1 %374, label %393, label %375, !llvm.loop !12 - -375: ; preds = %363 - %376 = or disjoint i32 %337, 3 - %377 = lshr i16 %373, 8 - %378 = mul i16 %373, 33 - %379 = add i16 %378, 69 - %380 = add i16 %379, %377 - %381 = and i16 %380, 255 - %382 = xor i16 %381, %369 - %383 = zext nneg i16 %382 to i64 - %384 = getelementptr inbounds nuw i16, ptr @filter, i64 %383 - %385 = load i16, ptr %384, align 2, !tbaa !6 - %386 = freeze i16 %385 - store i16 %373, ptr %384, align 2, !tbaa !6 - %387 = add nuw nsw i32 %337, 4 - %388 = icmp ne i16 %386, 0 - %389 = icmp samesign ult i32 %376, 7 - %390 = select i1 %388, i1 %389, i1 false - br i1 %390, label %336, label %393, !llvm.loop !14 - -391: ; preds = %319 - store i16 %304, ptr %321, align 2, !tbaa !6 - br label %393 - -392: ; preds = %296 - store i16 %304, ptr %316, align 2, !tbaa !6 - br label %393 - -393: ; preds = %392, %391, %375, %363, %351, %336 - %394 = phi i16 [ %297, %392 ], [ %297, %391 ], [ %329, %375 ], [ %329, %363 ], [ %329, %351 ], [ %329, %336 ] - call void @__checkpoint(ptr @checkpoint_name.7) - %395 = add nuw nsw i32 %5, 4 - %396 = icmp eq i32 %395, 128 - br i1 %396, label %2, label %3, !llvm.loop !16 - -397: ; preds = %520 - call void @llvm.lifetime.end.p0(ptr %1) - ret i32 0 - -398: ; preds = %520, %2 - %399 = phi i32 [ 0, %2 ], [ %521, %520 ] - %400 = phi i16 [ 1, %2 ], [ %492, %520 ] - %401 = mul i16 %400, 17 - %402 = add i16 %401, 17 - %403 = lshr i16 %402, 8 - %404 = and i16 %402, 255 - %405 = mul nuw nsw i16 %404, 33 - %406 = add nuw nsw i16 %403, 27205 - %407 = add nuw i16 %406, %405 - %408 = mul i16 %402, 33 - %409 = add i16 %408, 69 - %410 = add i16 %409, %403 - %411 = and i16 %410, 255 - %412 = zext nneg i16 %411 to i64 - %413 = getelementptr inbounds nuw i16, ptr @filter, i64 %412 - %414 = load i16, ptr %413, align 2, !tbaa !6 - %415 = icmp eq i16 %414, %407 - br i1 %415, label %427, label %416 - -416: ; preds = %398 - call void @__checkpoint(ptr @checkpoint_name.8) - %417 = mul i16 %407, 33 - %418 = add i16 %417, 69 - %419 = lshr i16 %407, 8 - %420 = add i16 %418, %419 - %421 = xor i16 %420, %410 - %422 = and i16 %421, 255 - %423 = zext nneg i16 %422 to i64 - %424 = getelementptr inbounds nuw i16, ptr @filter, i64 %423 - %425 = load i16, ptr %424, align 2, !tbaa !6 - %426 = icmp eq i16 %425, %407 - br i1 %426, label %427, label %430 - -427: ; preds = %416, %398 - call void @__checkpoint(ptr @checkpoint_name.9) - %428 = load volatile i32, ptr %1, align 4, !tbaa !10 - %429 = add i32 %428, 1 - store volatile i32 %429, ptr %1, align 4, !tbaa !10 - br label %430 - -430: ; preds = %427, %416 - %431 = mul i16 %402, 17 - %432 = add i16 %431, 17 - %433 = lshr i16 %432, 8 - %434 = and i16 %432, 255 - %435 = mul nuw nsw i16 %434, 33 - %436 = add nuw nsw i16 %433, 27205 - %437 = add nuw i16 %436, %435 - %438 = mul i16 %432, 33 - %439 = add i16 %438, 69 - %440 = add i16 %439, %433 - %441 = and i16 %440, 255 - %442 = zext nneg i16 %441 to i64 - %443 = getelementptr inbounds nuw i16, ptr @filter, i64 %442 - %444 = load i16, ptr %443, align 2, !tbaa !6 - %445 = icmp eq i16 %444, %437 - br i1 %445, label %457, label %446 - -446: ; preds = %430 - %447 = mul i16 %437, 33 - %448 = add i16 %447, 69 - %449 = lshr i16 %437, 8 - %450 = add i16 %448, %449 - %451 = xor i16 %450, %440 - %452 = and i16 %451, 255 - %453 = zext nneg i16 %452 to i64 - %454 = getelementptr inbounds nuw i16, ptr @filter, i64 %453 - %455 = load i16, ptr %454, align 2, !tbaa !6 - %456 = icmp eq i16 %455, %437 - br i1 %456, label %457, label %460 - -457: ; preds = %446, %430 - %458 = load volatile i32, ptr %1, align 4, !tbaa !10 - %459 = add i32 %458, 1 - store volatile i32 %459, ptr %1, align 4, !tbaa !10 - br label %460 - -460: ; preds = %457, %446 - %461 = mul i16 %432, 17 - %462 = add i16 %461, 17 - %463 = lshr i16 %462, 8 - %464 = and i16 %462, 255 - %465 = mul nuw nsw i16 %464, 33 - %466 = add nuw nsw i16 %463, 27205 - %467 = add nuw i16 %466, %465 - %468 = mul i16 %462, 33 - %469 = add i16 %468, 69 - %470 = add i16 %469, %463 - %471 = and i16 %470, 255 - %472 = zext nneg i16 %471 to i64 - %473 = getelementptr inbounds nuw i16, ptr @filter, i64 %472 - %474 = load i16, ptr %473, align 2, !tbaa !6 - %475 = icmp eq i16 %474, %467 - br i1 %475, label %487, label %476 - -476: ; preds = %460 - call void @__checkpoint(ptr @checkpoint_name.10) - %477 = mul i16 %467, 33 - %478 = add i16 %477, 69 - %479 = lshr i16 %467, 8 - %480 = add i16 %478, %479 - %481 = xor i16 %480, %470 - %482 = and i16 %481, 255 - %483 = zext nneg i16 %482 to i64 - %484 = getelementptr inbounds nuw i16, ptr @filter, i64 %483 - %485 = load i16, ptr %484, align 2, !tbaa !6 - %486 = icmp eq i16 %485, %467 - br i1 %486, label %487, label %490 - -487: ; preds = %476, %460 - call void @__checkpoint(ptr @checkpoint_name.11) - %488 = load volatile i32, ptr %1, align 4, !tbaa !10 - %489 = add i32 %488, 1 - store volatile i32 %489, ptr %1, align 4, !tbaa !10 - br label %490 - -490: ; preds = %487, %476 - %491 = mul i16 %462, 17 - %492 = add i16 %491, 17 - %493 = lshr i16 %492, 8 - %494 = and i16 %492, 255 - %495 = mul nuw nsw i16 %494, 33 - %496 = add nuw nsw i16 %493, 27205 - %497 = add nuw i16 %496, %495 - %498 = mul i16 %492, 33 - %499 = add i16 %498, 69 - %500 = add i16 %499, %493 - %501 = and i16 %500, 255 - %502 = zext nneg i16 %501 to i64 - %503 = getelementptr inbounds nuw i16, ptr @filter, i64 %502 - %504 = load i16, ptr %503, align 2, !tbaa !6 - %505 = icmp eq i16 %504, %497 - br i1 %505, label %517, label %506 - -506: ; preds = %490 - %507 = mul i16 %497, 33 - %508 = add i16 %507, 69 - %509 = lshr i16 %497, 8 - %510 = add i16 %508, %509 - %511 = xor i16 %510, %500 - %512 = and i16 %511, 255 - %513 = zext nneg i16 %512 to i64 - %514 = getelementptr inbounds nuw i16, ptr @filter, i64 %513 - %515 = load i16, ptr %514, align 2, !tbaa !6 - %516 = icmp eq i16 %515, %497 - br i1 %516, label %517, label %520 - -517: ; preds = %506, %490 - %518 = load volatile i32, ptr %1, align 4, !tbaa !10 - %519 = add i32 %518, 1 - store volatile i32 %519, ptr %1, align 4, !tbaa !10 - br label %520 - -520: ; preds = %517, %506 - %521 = add nuw nsw i32 %399, 4 - %522 = icmp eq i32 %521, 128 - br i1 %522, label %397, label %398, !llvm.loop !17 -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #2 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #3 - -declare void @__checkpoint(ptr) - -attributes #0 = { mustprogress nofree norecurse nosync nounwind ssp willreturn memory(none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { nofree norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"short", !8, i64 0} -!8 = !{!"omnipotent char", !9, i64 0} -!9 = !{!"Simple C/C++ TBAA"} -!10 = !{!11, !11, i64 0} -!11 = !{!"int", !8, i64 0} -!12 = distinct !{!12, !13} -!13 = !{!"llvm.loop.mustprogress"} -!14 = distinct !{!14, !13, !15} -!15 = !{!"llvm.loop.unroll.disable"} -!16 = distinct !{!16, !13, !15} -!17 = distinct !{!17, !13, !15} diff --git a/benchmarks/intermittent/rsa_checkpointed.ll b/benchmarks/intermittent/rsa_checkpointed.ll deleted file mode 100644 index 1fde48e..0000000 --- a/benchmarks/intermittent/rsa_checkpointed.ll +++ /dev/null @@ -1,621 +0,0 @@ -; ModuleID = 'test/intermittent/rsa.ll' -source_filename = "test/intermittent/rsa.c" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" -target triple = "arm64-apple-macosx26.0.0" - -%struct.pubkey_t = type { [16 x i8], i16 } - -@g_cyphertext_len = local_unnamed_addr global i32 0, align 4 -@P1DIR = internal global i8 0, align 1 -@P4DIR = internal global i8 0, align 1 -@PLAINTEXT = internal unnamed_addr constant [12 x i8] c".RRRSSSAAA.\00", align 1 -@g_base = global [32 x i16] zeroinitializer, align 2 -@g_block = global [32 x i16] zeroinitializer, align 2 -@pubkey = internal unnamed_addr constant %struct.pubkey_t { [16 x i8] c"A\A1\BC\AC\A3.\A9\81\A9\B7]\D7e$R\EA", i16 3 }, align 2 -@g_A = local_unnamed_addr global [16 x i16] zeroinitializer, align 2 -@g_B = local_unnamed_addr global [16 x i16] zeroinitializer, align 2 -@g_cyphertext = local_unnamed_addr global [16 x i16] zeroinitializer, align 2 -@g_product = local_unnamed_addr global [32 x i16] zeroinitializer, align 2 -@checkpoint_name = private unnamed_addr constant [4 x i8] c"bb3\00", align 1 -@checkpoint_name.1 = private unnamed_addr constant [4 x i8] c"bb8\00", align 1 -@checkpoint_name.2 = private unnamed_addr constant [5 x i8] c"bb12\00", align 1 -@checkpoint_name.3 = private unnamed_addr constant [5 x i8] c"bb14\00", align 1 -@checkpoint_name.4 = private unnamed_addr constant [5 x i8] c"bb18\00", align 1 -@checkpoint_name.5 = private unnamed_addr constant [5 x i8] c"bb19\00", align 1 -@checkpoint_name.6 = private unnamed_addr constant [4 x i8] c"bb4\00", align 1 -@checkpoint_name.7 = private unnamed_addr constant [4 x i8] c"bb6\00", align 1 -@checkpoint_name.8 = private unnamed_addr constant [5 x i8] c"bb16\00", align 1 -@checkpoint_name.9 = private unnamed_addr constant [5 x i8] c"bb18\00", align 1 -@checkpoint_name.10 = private unnamed_addr constant [5 x i8] c"bb23\00", align 1 -@checkpoint_name.11 = private unnamed_addr constant [5 x i8] c"bb26\00", align 1 -@checkpoint_name.12 = private unnamed_addr constant [5 x i8] c"bb31\00", align 1 -@checkpoint_name.13 = private unnamed_addr constant [5 x i8] c"bb37\00", align 1 -@checkpoint_name.14 = private unnamed_addr constant [5 x i8] c"bb39\00", align 1 -@checkpoint_name.15 = private unnamed_addr constant [5 x i8] c"bb46\00", align 1 -@checkpoint_name.16 = private unnamed_addr constant [5 x i8] c"bb47\00", align 1 - -; Function Attrs: nofree norecurse nounwind ssp uwtable(sync) -define noundef i32 @main() local_unnamed_addr #0 { - %1 = alloca [8 x i8], align 1 - %2 = load volatile i8, ptr @P1DIR, align 1, !tbaa !6 - %3 = or i8 %2, 1 - store volatile i8 %3, ptr @P1DIR, align 1, !tbaa !6 - %4 = load volatile i8, ptr @P4DIR, align 1, !tbaa !6 - %5 = or i8 %4, 2 - store volatile i8 %5, ptr @P4DIR, align 1, !tbaa !6 - br label %6 - -6: ; preds = %13, %0 - %7 = phi i64 [ 0, %0 ], [ %16, %13 ] - %8 = icmp samesign ult i64 %7, 11 - br i1 %8, label %9, label %13 - -9: ; preds = %6 - %10 = getelementptr inbounds nuw [12 x i8], ptr @PLAINTEXT, i64 0, i64 %7 - %11 = load i8, ptr %10, align 1, !tbaa !6 - %12 = zext i8 %11 to i16 - br label %13 - -13: ; preds = %9, %6 - %14 = phi i16 [ %12, %9 ], [ 255, %6 ] - call void @__checkpoint(ptr @checkpoint_name) - %15 = getelementptr inbounds nuw [32 x i16], ptr @g_base, i64 0, i64 %7 - store i16 %14, ptr %15, align 2, !tbaa !9 - %16 = add nuw nsw i64 %7, 1 - %17 = icmp eq i64 %16, 15 - br i1 %17, label %18, label %6, !llvm.loop !11 - -18: ; preds = %13 - store i16 1, ptr getelementptr inbounds nuw (i8, ptr @g_base, i64 30), align 2, !tbaa !9 - store i16 1, ptr @g_block, align 2, !tbaa !9 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(30) getelementptr inbounds nuw (i8, ptr @g_block, i64 2), i8 0, i64 30, i1 false), !tbaa !9 - br label %19 - -19: ; preds = %27, %18 - %20 = phi i32 [ 3, %18 ], [ %23, %27 ] - %21 = and i32 %20, 1 - %22 = icmp eq i32 %21, 0 - %23 = lshr i32 %20, 1 - br i1 %22, label %25, label %24 - -24: ; preds = %19 - tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(32) @g_A, ptr noundef nonnull align 2 dereferenceable(32) @g_base, i64 32, i1 false), !tbaa !9 - tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(32) @g_B, ptr noundef nonnull align 2 dereferenceable(32) @g_block, i64 32, i1 false), !tbaa !9 - tail call fastcc void @mult_mod_operation(ptr noundef nonnull @g_block) - br label %25 - -25: ; preds = %24, %19 - %26 = icmp eq i32 %20, 1 - br i1 %26, label %29, label %27 - -27: ; preds = %25 - call void @__checkpoint(ptr @checkpoint_name.1) - tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(32) @g_A, ptr noundef nonnull align 2 dereferenceable(32) @g_base, i64 32, i1 false), !tbaa !9 - tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(32) @g_B, ptr noundef nonnull align 2 dereferenceable(32) @g_base, i64 32, i1 false), !tbaa !9 - tail call fastcc void @mult_mod_operation(ptr noundef nonnull @g_base) - %28 = icmp eq i32 %20, 0 - br i1 %28, label %29, label %19, !llvm.loop !14 - -29: ; preds = %27, %25 - %30 = load i32, ptr @g_cyphertext_len, align 4, !tbaa !15 - %31 = add i32 %30, 16 - %32 = icmp ult i32 %31, 17 - br i1 %32, label %33, label %47 - -33: ; preds = %29 - %34 = icmp ugt i32 %30, -16 - br i1 %34, label %48, label %35 - -35: ; preds = %33 - %36 = add i32 %30, 16 - br label %37 - -37: ; preds = %37, %35 - %38 = phi i64 [ 0, %35 ], [ %45, %37 ] - call void @__checkpoint(ptr @checkpoint_name.2) - %39 = trunc i64 %38 to i32 - %40 = add i32 %30, %39 - %41 = getelementptr inbounds nuw [32 x i16], ptr @g_block, i64 0, i64 %38 - %42 = load <8 x i16>, ptr %41, align 2, !tbaa !9 - %43 = zext i32 %40 to i64 - %44 = getelementptr inbounds nuw [16 x i16], ptr @g_cyphertext, i64 0, i64 %43 - store <8 x i16> %42, ptr %44, align 2, !tbaa !9 - %45 = add nuw i64 %38, 8 - %46 = icmp eq i64 %45, 16 - br i1 %46, label %58, label %37, !llvm.loop !17 - -47: ; preds = %29 - call void @llvm.lifetime.start.p0(ptr %1) - br label %61 - -48: ; preds = %48, %33 - %49 = phi i64 [ %56, %48 ], [ 0, %33 ] - %50 = phi i32 [ %53, %48 ], [ %30, %33 ] - call void @__checkpoint(ptr @checkpoint_name.3) - %51 = getelementptr inbounds nuw [32 x i16], ptr @g_block, i64 0, i64 %49 - %52 = load i16, ptr %51, align 2, !tbaa !9 - %53 = add i32 %50, 1 - %54 = zext i32 %50 to i64 - %55 = getelementptr inbounds nuw [16 x i16], ptr @g_cyphertext, i64 0, i64 %54 - store i16 %52, ptr %55, align 2, !tbaa !9 - %56 = add nuw nsw i64 %49, 1 - %57 = icmp eq i64 %56, 16 - br i1 %57, label %58, label %48, !llvm.loop !20 - -58: ; preds = %48, %37 - %59 = phi i32 [ %53, %48 ], [ %36, %37 ] - store i32 %59, ptr @g_cyphertext_len, align 4, !tbaa !15 - call void @llvm.lifetime.start.p0(ptr %1) - %60 = icmp eq i32 %59, 0 - br i1 %60, label %64, label %61 - -61: ; preds = %58, %47 - %62 = phi i32 [ %30, %47 ], [ %59, %58 ] - %63 = zext i32 %62 to i64 - br label %65 - -64: ; preds = %83, %58 - call void @llvm.lifetime.end.p0(ptr %1) - ret i32 0 - -65: ; preds = %83, %61 - %66 = phi i64 [ 0, %61 ], [ %74, %83 ] - %67 = phi i32 [ 0, %61 ], [ %84, %83 ] - call void @__checkpoint(ptr @checkpoint_name.4) - %68 = getelementptr inbounds nuw [16 x i16], ptr @g_cyphertext, i64 0, i64 %66 - %69 = load i16, ptr %68, align 2, !tbaa !9 - %70 = trunc i16 %69 to i8 - %71 = add nsw i32 %67, 1 - %72 = sext i32 %67 to i64 - %73 = getelementptr inbounds [8 x i8], ptr %1, i64 0, i64 %72 - store volatile i8 %70, ptr %73, align 1, !tbaa !6 - %74 = add nuw nsw i64 %66, 1 - %75 = and i64 %74, 7 - %76 = icmp eq i64 %75, 0 - br i1 %76, label %77, label %83 - -77: ; preds = %77, %65 - %78 = phi i64 [ %81, %77 ], [ 0, %65 ] - call void @__checkpoint(ptr @checkpoint_name.5) - %79 = getelementptr inbounds nuw [8 x i8], ptr %1, i64 0, i64 %78 - %80 = load volatile i8, ptr %79, align 1, !tbaa !6 - %81 = add nuw nsw i64 %78, 1 - %82 = icmp eq i64 %81, 8 - br i1 %82, label %83, label %77, !llvm.loop !21 - -83: ; preds = %77, %65 - %84 = phi i32 [ %71, %65 ], [ 0, %77 ] - %85 = icmp eq i64 %74, %63 - br i1 %85, label %64, label %65, !llvm.loop !22 -} - -; Function Attrs: inlinehint nofree norecurse nosync nounwind ssp memory(readwrite, argmem: write, inaccessiblemem: none) uwtable(sync) -define internal fastcc void @mult_mod_operation(ptr noundef writeonly captures(none) %0) unnamed_addr #1 { - %2 = ptrtoint ptr %0 to i64 - %3 = alloca [32 x i16], align 2 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(64) @g_product, i8 0, i64 64, i1 false), !tbaa !9 - br label %4 - -4: ; preds = %32, %1 - %5 = phi i64 [ 0, %1 ], [ %37, %32 ] - %6 = phi i16 [ 0, %1 ], [ %34, %32 ] - br label %7 - -7: ; preds = %27, %4 - %8 = phi i64 [ 0, %4 ], [ %30, %27 ] - %9 = phi i16 [ 0, %4 ], [ %29, %27 ] - %10 = phi i16 [ %6, %4 ], [ %28, %27 ] - %11 = sub nsw i64 %5, %8 - %12 = icmp ult i64 %11, 16 - br i1 %12, label %13, label %27 - -13: ; preds = %7 - %14 = getelementptr inbounds nuw i16, ptr @g_A, i64 %11 - %15 = load i16, ptr %14, align 2, !tbaa !9 - %16 = getelementptr inbounds nuw i16, ptr @g_B, i64 %8 - %17 = load i16, ptr %16, align 2, !tbaa !9 - %18 = zext i16 %15 to i32 - %19 = zext i16 %17 to i32 - %20 = mul nuw i32 %19, %18 - %21 = trunc i32 %20 to i16 - %22 = and i16 %21, 255 - %23 = add i16 %22, %10 - %24 = lshr i32 %20, 8 - %25 = trunc i32 %24 to i16 - %26 = add i16 %9, %25 - br label %27 - -27: ; preds = %13, %7 - %28 = phi i16 [ %23, %13 ], [ %10, %7 ] - %29 = phi i16 [ %26, %13 ], [ %9, %7 ] - call void @__checkpoint(ptr @checkpoint_name.6) - %30 = add nuw nsw i64 %8, 1 - %31 = icmp eq i64 %30, 16 - br i1 %31, label %32, label %7, !llvm.loop !23 - -32: ; preds = %27 - %33 = lshr i16 %28, 8 - %34 = add i16 %33, %29 - %35 = and i16 %28, 255 - %36 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %5 - store i16 %35, ptr %36, align 2, !tbaa !9 - %37 = add nuw nsw i64 %5, 1 - %38 = icmp eq i64 %37, 32 - br i1 %38, label %39, label %4, !llvm.loop !24 - -39: ; preds = %39, %32 - %40 = phi i64 [ %41, %39 ], [ 32, %32 ] - call void @__checkpoint(ptr @checkpoint_name.7) - %41 = add nsw i64 %40, -1 - %42 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %41 - %43 = load i16, ptr %42, align 2, !tbaa !9 - %44 = icmp eq i16 %43, 0 - %45 = icmp samesign ugt i64 %40, 1 - %46 = and i1 %45, %44 - br i1 %46, label %39, label %47, !llvm.loop !25 - -47: ; preds = %39 - br i1 %44, label %50, label %48 - -48: ; preds = %47 - %49 = trunc nuw nsw i64 %41 to i32 - br label %222 - -50: ; preds = %47 - tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(32) %0, i8 0, i64 32, i1 false), !tbaa !9 - br label %245 - -51: ; preds = %227, %222 - br i1 %225, label %56, label %52 - -52: ; preds = %68, %53, %51 - br label %76 - -53: ; preds = %72 - %54 = add nsw i32 %57, -1 - %55 = icmp sgt i32 %57, 0 - br i1 %55, label %56, label %52, !llvm.loop !26 - -56: ; preds = %53, %51 - %57 = phi i32 [ %54, %53 ], [ %223, %51 ] - %58 = zext nneg i32 %57 to i64 - %59 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %58 - %60 = load i16, ptr %59, align 2, !tbaa !9 - %61 = sub i32 %57, %224 - %62 = icmp ult i32 %61, 16 - br i1 %62, label %63, label %68 - -63: ; preds = %56 - %64 = zext nneg i32 %61 to i64 - %65 = getelementptr inbounds nuw [16 x i8], ptr @pubkey, i64 0, i64 %64 - %66 = load i8, ptr %65, align 1, !tbaa !6 - %67 = zext i8 %66 to i32 - br label %68 - -68: ; preds = %63, %56 - %69 = phi i32 [ %67, %63 ], [ 0, %56 ] - %70 = zext i16 %60 to i32 - %71 = icmp samesign ult i32 %69, %70 - br i1 %71, label %52, label %72 - -72: ; preds = %68 - call void @__checkpoint(ptr @checkpoint_name.8) - %73 = icmp samesign ugt i32 %69, %70 - br i1 %73, label %74, label %53 - -74: ; preds = %72 - %75 = icmp eq i32 %223, 15 - br i1 %75, label %228, label %97 - -76: ; preds = %76, %52 - %77 = phi i64 [ %95, %76 ], [ 0, %52 ] - %78 = phi i32 [ %92, %76 ], [ 0, %52 ] - call void @__checkpoint(ptr @checkpoint_name.9) - %79 = trunc i64 %77 to i32 - %80 = add i32 %224, %79 - %81 = zext i32 %80 to i64 - %82 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %81 - %83 = load i16, ptr %82, align 2, !tbaa !9 - %84 = getelementptr inbounds nuw [16 x i8], ptr @pubkey, i64 0, i64 %77 - %85 = load i8, ptr %84, align 1, !tbaa !6 - %86 = zext i8 %85 to i32 - %87 = add nuw nsw i32 %78, %86 - %88 = zext i16 %83 to i32 - %89 = icmp samesign ugt i32 %87, %88 - %90 = add i16 %83, 256 - %91 = select i1 %89, i16 %90, i16 %83 - %92 = zext i1 %89 to i32 - %93 = trunc nuw nsw i32 %87 to i16 - %94 = sub i16 %91, %93 - store i16 %94, ptr %82, align 2, !tbaa !9 - %95 = add nuw nsw i64 %77, 1 - %96 = icmp eq i64 %95, 16 - br i1 %96, label %227, label %76, !llvm.loop !27 - -97: ; preds = %74 - %98 = zext nneg i32 %223 to i64 - %99 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %98 - %100 = load i16, ptr %99, align 2, !tbaa !9 - %101 = add nsw i32 %223, -1 - %102 = sext i32 %101 to i64 - %103 = getelementptr inbounds [32 x i16], ptr @g_product, i64 0, i64 %102 - %104 = load i16, ptr %103, align 2, !tbaa !9 - %105 = add nsw i32 %223, -2 - %106 = sext i32 %105 to i64 - %107 = getelementptr inbounds [32 x i16], ptr @g_product, i64 0, i64 %106 - %108 = load i16, ptr %107, align 2, !tbaa !9 - %109 = zext i16 %100 to i32 - %110 = icmp eq i16 %100, 234 - br i1 %110, label %111, label %113 - -111: ; preds = %97 - %112 = zext i16 %104 to i32 - br label %120 - -113: ; preds = %97 - %114 = shl nuw nsw i32 %109, 8 - %115 = zext i16 %104 to i32 - %116 = add nuw nsw i32 %114, %115 - %117 = udiv i32 %116, 234 - %118 = trunc i32 %117 to i16 - %119 = add i16 %118, 1 - br label %120 - -120: ; preds = %113, %111 - %121 = phi i32 [ %112, %111 ], [ %115, %113 ] - %122 = phi i16 [ 256, %111 ], [ %119, %113 ] - %123 = shl nuw i32 %109, 16 - %124 = shl nuw nsw i32 %121, 8 - %125 = add i32 %124, %123 - %126 = zext i16 %108 to i32 - %127 = add i32 %125, %126 - br label %128 - -128: ; preds = %128, %120 - %129 = phi i16 [ %122, %120 ], [ %130, %128 ] - call void @__checkpoint(ptr @checkpoint_name.10) - %130 = add i16 %129, -1 - %131 = zext i16 %130 to i32 - %132 = mul nuw i32 %131, 59986 - %133 = icmp ugt i32 %132, %127 - br i1 %133, label %128, label %134, !llvm.loop !28 - -134: ; preds = %128 - call void @llvm.lifetime.start.p0(ptr %3) - call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(64) %3, i8 0, i64 64, i1 false), !tbaa !9 - %135 = add nsw i32 %223, -16 - %136 = icmp slt i32 %223, 48 - br i1 %136, label %137, label %160 - -137: ; preds = %134 - %138 = sext i32 %135 to i64 - br label %139 - -139: ; preds = %152, %137 - %140 = phi i64 [ %138, %137 ], [ %157, %152 ] - %141 = phi i16 [ 0, %137 ], [ %154, %152 ] - call void @__checkpoint(ptr @checkpoint_name.11) - %142 = trunc nsw i64 %140 to i32 - %143 = icmp ugt i32 %223, %142 - br i1 %143, label %144, label %152 - -144: ; preds = %139 - %145 = sub i32 %142, %135 - %146 = zext i32 %145 to i64 - %147 = getelementptr inbounds nuw [16 x i8], ptr @pubkey, i64 0, i64 %146 - %148 = load i8, ptr %147, align 1, !tbaa !6 - %149 = zext i8 %148 to i16 - %150 = mul i16 %130, %149 - %151 = add i16 %150, %141 - br label %152 - -152: ; preds = %144, %139 - %153 = phi i16 [ %151, %144 ], [ %141, %139 ] - %154 = lshr i16 %153, 8 - %155 = and i16 %153, 255 - %156 = getelementptr inbounds [32 x i16], ptr %3, i64 0, i64 %140 - store i16 %155, ptr %156, align 2, !tbaa !9 - %157 = add nsw i64 %140, 1 - %158 = and i64 %157, 4294967295 - %159 = icmp eq i64 %158, 32 - br i1 %159, label %160, label %139, !llvm.loop !29 - -160: ; preds = %152, %134 - br label %164 - -161: ; preds = %172 - %162 = add nsw i32 %165, -1 - %163 = icmp eq i32 %165, 0 - br i1 %163, label %199, label %164, !llvm.loop !30 - -164: ; preds = %161, %160 - %165 = phi i32 [ %162, %161 ], [ 31, %160 ] - call void @__checkpoint(ptr @checkpoint_name.12) - %166 = zext nneg i32 %165 to i64 - %167 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %166 - %168 = load i16, ptr %167, align 2, !tbaa !9 - %169 = getelementptr inbounds nuw [32 x i16], ptr %3, i64 0, i64 %166 - %170 = load i16, ptr %169, align 2, !tbaa !9 - %171 = icmp ugt i16 %168, %170 - br i1 %171, label %199, label %172 - -172: ; preds = %164 - %173 = icmp ult i16 %168, %170 - br i1 %173, label %174, label %161 - -174: ; preds = %172 - br i1 %136, label %175, label %199 - -175: ; preds = %174 - %176 = sext i32 %135 to i64 - br label %177 - -177: ; preds = %188, %175 - %178 = phi i64 [ %176, %175 ], [ %196, %188 ] - %179 = phi i16 [ 0, %175 ], [ %194, %188 ] - %180 = trunc nsw i64 %178 to i32 - %181 = icmp ugt i32 %223, %180 - br i1 %181, label %182, label %188 - -182: ; preds = %177 - %183 = sub i32 %180, %135 - %184 = zext i32 %183 to i64 - %185 = getelementptr inbounds nuw [16 x i8], ptr @pubkey, i64 0, i64 %184 - %186 = load i8, ptr %185, align 1, !tbaa !6 - %187 = zext i8 %186 to i16 - br label %188 - -188: ; preds = %182, %177 - %189 = phi i16 [ %187, %182 ], [ 0, %177 ] - call void @__checkpoint(ptr @checkpoint_name.13) - %190 = getelementptr inbounds [32 x i16], ptr @g_product, i64 0, i64 %178 - %191 = load i16, ptr %190, align 2, !tbaa !9 - %192 = add nuw nsw i16 %189, %179 - %193 = add i16 %192, %191 - %194 = lshr i16 %193, 8 - %195 = and i16 %193, 255 - store i16 %195, ptr %190, align 2, !tbaa !9 - %196 = add nsw i64 %178, 1 - %197 = and i64 %196, 4294967295 - %198 = icmp eq i64 %197, 32 - br i1 %198, label %199, label %177, !llvm.loop !31 - -199: ; preds = %188, %174, %164, %161 - %200 = zext i32 %135 to i64 - br label %201 - -201: ; preds = %217, %199 - %202 = phi i64 [ 0, %199 ], [ %219, %217 ] - %203 = phi i32 [ 0, %199 ], [ %218, %217 ] - call void @__checkpoint(ptr @checkpoint_name.14) - %204 = icmp samesign ult i64 %202, %200 - br i1 %204, label %217, label %205 - -205: ; preds = %201 - %206 = getelementptr inbounds nuw [32 x i16], ptr %3, i64 0, i64 %202 - %207 = load i16, ptr %206, align 2, !tbaa !9 - %208 = trunc nuw nsw i32 %203 to i16 - %209 = add i16 %207, %208 - %210 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %202 - %211 = load i16, ptr %210, align 2, !tbaa !9 - %212 = icmp ult i16 %211, %209 - %213 = add i16 %211, 256 - %214 = select i1 %212, i16 %213, i16 %211 - %215 = zext i1 %212 to i32 - %216 = sub i16 %214, %209 - store i16 %216, ptr %210, align 2, !tbaa !9 - br label %217 - -217: ; preds = %205, %201 - %218 = phi i32 [ %215, %205 ], [ %203, %201 ] - %219 = add nuw nsw i64 %202, 1 - %220 = icmp eq i64 %219, 32 - br i1 %220, label %221, label %201, !llvm.loop !32 - -221: ; preds = %217 - call void @llvm.lifetime.end.p0(ptr %3) - br label %222 - -222: ; preds = %221, %48 - %223 = phi i32 [ %101, %221 ], [ %49, %48 ] - %224 = add nsw i32 %223, -15 - %225 = icmp sgt i32 %223, -1 - %226 = icmp eq i32 %224, 0 - br label %51 - -227: ; preds = %76 - br i1 %226, label %228, label %51 - -228: ; preds = %227, %74 - %229 = sub i64 %2, ptrtoint (ptr @g_product to i64) - %230 = icmp ult i64 %229, 32 - br i1 %230, label %238, label %231 - -231: ; preds = %231, %228 - %232 = phi i64 [ %236, %231 ], [ 0, %228 ] - call void @__checkpoint(ptr @checkpoint_name.15) - %233 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %232 - %234 = load <8 x i16>, ptr %233, align 2, !tbaa !9 - %235 = getelementptr inbounds nuw i16, ptr %0, i64 %232 - store <8 x i16> %234, ptr %235, align 2, !tbaa !9 - %236 = add nuw i64 %232, 8 - %237 = icmp eq i64 %236, 16 - br i1 %237, label %245, label %231, !llvm.loop !33 - -238: ; preds = %238, %228 - %239 = phi i64 [ %243, %238 ], [ 0, %228 ] - call void @__checkpoint(ptr @checkpoint_name.16) - %240 = getelementptr inbounds nuw [32 x i16], ptr @g_product, i64 0, i64 %239 - %241 = load i16, ptr %240, align 2, !tbaa !9 - %242 = getelementptr inbounds nuw i16, ptr %0, i64 %239 - store i16 %241, ptr %242, align 2, !tbaa !9 - %243 = add nuw nsw i64 %239, 1 - %244 = icmp eq i64 %243, 16 - br i1 %244, label %245, label %238, !llvm.loop !34 - -245: ; preds = %238, %231, %50 - ret void -} - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #2 - -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #3 - -declare void @llvm.lifetime.start.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 - -declare void @llvm.lifetime.end.i64(i64) - -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -declare void @llvm.lifetime.end.p0(ptr captures(none)) #4 - -declare void @__checkpoint(ptr) - -attributes #0 = { nofree norecurse nounwind ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #1 = { inlinehint nofree norecurse nosync nounwind ssp memory(readwrite, argmem: write, inaccessiblemem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+ccpp,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) } -attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } - -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.ident = !{!5} - -!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 2]} -!1 = !{i32 1, !"wchar_size", i32 4} -!2 = !{i32 8, !"PIC Level", i32 2} -!3 = !{i32 7, !"uwtable", i32 1} -!4 = !{i32 7, !"frame-pointer", i32 1} -!5 = !{!"Homebrew clang version 21.1.1"} -!6 = !{!7, !7, i64 0} -!7 = !{!"omnipotent char", !8, i64 0} -!8 = !{!"Simple C/C++ TBAA"} -!9 = !{!10, !10, i64 0} -!10 = !{!"short", !7, i64 0} -!11 = distinct !{!11, !12, !13} -!12 = !{!"llvm.loop.mustprogress"} -!13 = !{!"llvm.loop.unroll.disable"} -!14 = distinct !{!14, !12, !13} -!15 = !{!16, !16, i64 0} -!16 = !{!"int", !7, i64 0} -!17 = distinct !{!17, !12, !13, !18, !19} -!18 = !{!"llvm.loop.isvectorized", i32 1} -!19 = !{!"llvm.loop.unroll.runtime.disable"} -!20 = distinct !{!20, !12, !13, !18} -!21 = distinct !{!21, !12, !13} -!22 = distinct !{!22, !12, !13} -!23 = distinct !{!23, !12, !13} -!24 = distinct !{!24, !12, !13} -!25 = distinct !{!25, !12, !13} -!26 = distinct !{!26, !12, !13} -!27 = distinct !{!27, !12, !13} -!28 = distinct !{!28, !12, !13} -!29 = distinct !{!29, !12, !13} -!30 = distinct !{!30, !12, !13} -!31 = distinct !{!31, !12, !13} -!32 = distinct !{!32, !12, !13} -!33 = distinct !{!33, !12, !13, !18, !19} -!34 = distinct !{!34, !12, !13, !18}