<commit_before>// RUN: clang %s -g -emit-llvm -O0 -o - -S | FileCheck %s

#include <enerc.h>

int *gpp;
APPROX int *gpa;

int main() {
    // CHECK: %x = alloca i32, align 4, !quals !0
    int x;
    // CHECK: %y = alloca i32, align 4, !quals !1
    APPROX int y;

    // CHECK: store i32 2, i32* %x, align 4, !quals !0
    x = 2;
    // CHECK: store i32 3, i32* %y, align 4, !quals !1
    y = 3;

    // CHECK: %0 = load i32* %y, align 4, !quals !1
    // CHECK: store i32 %0, i32* %i, align 4, !quals !1
    APPROX int i = y;

    // CHECK: %1 = load i32* %x, align 4, !quals !0
    // CHECK: store i32 %1, i32* %j, align 4, !quals !0
    int j = x;

    // CHECK: %2 = load i32* %x, align 4, !quals !0
    // CHECK: store i32 %2, i32* %i, align 4, !quals !1
    i = x;

    // CHECK: %3 = load i32* %x, align 4, !quals !0
    // CHECK: %4 = load i32* %y, align 4, !quals !1
    // CHECK: %add = add nsw i32 %4, %3, !quals !1
    // CHECK: store i32 %add, i32* %y, align 4, !quals !1
    y += x;

    // CHECK: %arrayidx = getelementptr inbounds [5 x i32]* %a, i32 0, i64 2, !quals !2
    APPROX int a[5];
    y = a[2];

    // CHECK: %f = getelementptr inbounds %struct.anon* %s, i32 0, i32 0, !quals !2
    struct {
        APPROX int f;
    } s;
    y = s.f;

    // CHECK: %7 = load i32** @gpp, align 8, !quals !0
    // CHECK: %arrayidx1 = getelementptr inbounds i32* %7, i64 0, !quals !0
    // CHECK: store i32 5, i32* %arrayidx1, align 4, !quals !0
    gpp[0] = 5;
    // CHECK: %8 = load i32** @gpa, align 8, !quals !2
    // CHECK: %arrayidx2 = getelementptr inbounds i32* %8, i64 0, !quals !2
    // CHECK: store i32 7, i32* %arrayidx2, align 4, !quals !1
    gpa[0] = 7;

    return x;
}

// CHECK: !0 = metadata !{i32 0}
// CHECK: !1 = metadata !{i32 1}
// CHECK: !2 = metadata !{i32 2}<commit_msg>More flexible codegen test<commit_after>// RUN: clang %s -emit-llvm -O0 -o - -S | FileCheck %s

#include <enerc.h>

int *gpp;
APPROX int *gpa;

int main() {
    // CHECK: %x = alloca i32, align {{[0-9]+}}, !quals [[PRECISE:![0-9]+]]
    int x;
    // CHECK: %y = alloca i32, align {{[0-9]+}}, !quals [[APPROX:![0-9]+]]
    APPROX int y;

    // CHECK: store i32 2, i32* %x, align 4, !quals [[PRECISE]]
    x = 2;
    // CHECK: store i32 3, i32* %y, align 4, !quals [[APPROX]]
    y = 3;

    // CHECK: %0 = load i32* %y, align 4, !quals [[APPROX]]
    // CHECK: store i32 %0, i32* %i, align 4, !quals [[APPROX]]
    APPROX int i = y;

    // CHECK: %1 = load i32* %x, align 4, !quals [[PRECISE]]
    // CHECK: store i32 %1, i32* %j, align 4, !quals [[PRECISE]]
    int j = x;

    // CHECK: %2 = load i32* %x, align 4, !quals [[PRECISE]]
    // CHECK: store i32 %2, i32* %i, align 4, !quals [[APPROX]]
    i = x;

    // CHECK: %3 = load i32* %x, align 4, !quals [[PRECISE]]
    // CHECK: %4 = load i32* %y, align 4, !quals [[APPROX]]
    // CHECK: %add = add nsw i32 %4, %3, !quals [[APPROX]]
    // CHECK: store i32 %add, i32* %y, align 4, !quals [[APPROX]]
    y += x;

    // CHECK: %arrayidx = getelementptr inbounds [5 x i32]* %a, i32 0, i64 2, !quals [[APPROX_P:![0-9]+]]
    APPROX int a[5];
    y = a[2];

    // CHECK: %f = getelementptr inbounds %struct.anon* %s, i32 0, i32 0, !quals [[APPROX_P]]
    struct {
        APPROX int f;
    } s;
    y = s.f;

    // CHECK: %7 = load i32** @gpp, align 8, !quals [[PRECISE]]
    // CHECK: %arrayidx1 = getelementptr inbounds i32* %7, i64 0, !quals [[PRECISE]]
    // CHECK: store i32 5, i32* %arrayidx1, align 4, !quals [[PRECISE]]
    gpp[0] = 5;
    // CHECK: %8 = load i32** @gpa, align 8, !quals [[APPROX_P]]
    // CHECK: %arrayidx2 = getelementptr inbounds i32* %8, i64 0, !quals [[APPROX_P]]
    // CHECK: store i32 7, i32* %arrayidx2, align 4, !quals [[APPROX]]
    gpa[0] = 7;

    return x;
}

// CHECK-DAG: [[PRECISE]] = metadata !{i32 0}
// CHECK-DAG: [[APPROX]] = metadata !{i32 1}
// CHECK-DAG: [[APPROX_P]] = metadata !{i32 2}
{'fraction_non_alphanumeric': 0.19820971867007672, 'fraction_numerical': 0.07698209718670077, 'mean_word_length': 2.348458904109589, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5406615', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1707, 'n_words': 575}