Skip to content

Commit 0ef27a3

Browse files
committed
Merge commit '8045498a37b070e668b73a303f1a0316b9c2a7ba' into doug/init-hugr-llvm-subtree
2 parents 377b19a + 8045498 commit 0ef27a3

File tree

6 files changed

+59
-86
lines changed

6 files changed

+59
-86
lines changed

hugr-llvm/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.6.1](https://github.com/CQCL/hugr-llvm/compare/v0.6.0...v0.6.1) - 2024-10-23
10+
11+
### Bug Fixes
12+
13+
- don't normalise half turns ([#137](https://github.com/CQCL/hugr-llvm/pull/137))
14+
915
## [0.6.0](https://github.com/CQCL/hugr-llvm/compare/v0.5.1...v0.6.0) - 2024-10-21
1016

1117
### Bug Fixes

hugr-llvm/DEVELOPMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ We use `rustfmt` to enforce a consistent coding style. The CI will fail if the c
4646
To format your code, run:
4747

4848
```bash
49-
cargo format
49+
cargo fmt
5050
```
5151

5252
We also use various linters to catch common mistakes and enforce best practices. To run these, see [our CI config](./.github/workflows/ci-rs.yml). TODO Provide a better way, contributions welcome.
@@ -66,7 +66,7 @@ cargo install cargo-llvm-cov
6666
Then run the tests, see [our CI config](/.github/workflows/ci-rs.yml).
6767

6868
```bash
69-
just coverage
69+
cargo llvm-cov --lcov --output-path lcov.info
7070
```
7171

7272
This will generate a coverage file that can be opened with your favourite coverage viewer. In VSCode, you can use

hugr-llvm/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ At present only `llvm14-0` is supported but we expect to introduce supported ver
1818

1919
See the [llvm-sys][] crate for details on how to use your preferred llvm installation.
2020

21-
For an example lowering [guppy][] programs to LLVM see [tests/guppy.rs](./tests/guppy.rs)
22-
2321
## Recent Changes
2422

2523
See [CHANGELOG](CHANGELOG.md) for a list of changes. The minimum supported rust
@@ -39,4 +37,3 @@ This project is licensed under Apache License, Version 2.0 ([LICENCE](LICENCE) o
3937
[inkwell]: https://thedan64.github.io/inkwell/inkwell/index.html
4038
[llvm-sys]: https://crates.io/crates/llvm-sys
4139
[llvm]: https://llvm.org/
42-
[guppy]: https://github.com/CQCL/guppylang

hugr-llvm/scripts/generate_guppy_hugrs.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

hugr-llvm/src/extension/snapshots/[email protected]

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,45 @@ entry_block: ; preds = %alloca_block
2929
unreachable
3030

3131
9: ; preds = %entry_block
32-
%10 = fdiv double %0, 2.000000e+00
33-
%11 = call double @llvm.floor.f64(double %10)
34-
%12 = fsub double %10, %11
35-
%13 = fmul double %12, 2.000000e+00
36-
%14 = fcmp oeq double %13, 0x7FF0000000000000
37-
%15 = fcmp oeq double %13, 0xFFF0000000000000
38-
%16 = fcmp uno double %13, 0.000000e+00
39-
%17 = or i1 %14, %15
40-
%18 = or i1 %17, %16
41-
%19 = xor i1 %18, true
42-
%20 = insertvalue { double } undef, double %13, 0
43-
%21 = insertvalue { i32, {}, { double } } { i32 1, {} poison, { double } poison }, { double } %20, 2
44-
%22 = select i1 %19, { i32, {}, { double } } %21, { i32, {}, { double } } { i32 0, {} undef, { double } poison }
45-
%23 = extractvalue { i32, {}, { double } } %22, 0
46-
switch i32 %23, label %24 [
47-
i32 1, label %26
32+
%10 = fcmp oeq double %0, 0x7FF0000000000000
33+
%11 = fcmp oeq double %0, 0xFFF0000000000000
34+
%12 = fcmp uno double %0, 0.000000e+00
35+
%13 = or i1 %10, %11
36+
%14 = or i1 %13, %12
37+
%15 = xor i1 %14, true
38+
%16 = insertvalue { double } undef, double %0, 0
39+
%17 = insertvalue { i32, {}, { double } } { i32 1, {} poison, { double } poison }, { double } %16, 2
40+
%18 = select i1 %15, { i32, {}, { double } } %17, { i32, {}, { double } } { i32 0, {} undef, { double } poison }
41+
%19 = extractvalue { i32, {}, { double } } %18, 0
42+
switch i32 %19, label %20 [
43+
i32 1, label %22
4844
]
4945

50-
24: ; preds = %9
51-
%25 = extractvalue { i32, {}, { double } } %22, 1
46+
20: ; preds = %9
47+
%21 = extractvalue { i32, {}, { double } } %18, 1
5248
br label %cond_7_case_0
5349

54-
26: ; preds = %9
55-
%27 = extractvalue { i32, {}, { double } } %22, 2
56-
%28 = extractvalue { double } %27, 0
50+
22: ; preds = %9
51+
%23 = extractvalue { i32, {}, { double } } %18, 2
52+
%24 = extractvalue { double } %23, 0
5753
br label %cond_7_case_1
5854

59-
cond_7_case_0: ; preds = %24
60-
%29 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 0
61-
%30 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 1
62-
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %29, i8* %30)
55+
cond_7_case_0: ; preds = %20
56+
%25 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 0
57+
%26 = extractvalue { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, 1
58+
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %25, i8* %26)
6359
call void @abort()
6460
br label %cond_exit_7
6561

66-
cond_7_case_1: ; preds = %26
62+
cond_7_case_1: ; preds = %22
6763
br label %cond_exit_7
6864

6965
cond_exit_7: ; preds = %cond_7_case_1, %cond_7_case_0
70-
%"0.0" = phi double [ 0.000000e+00, %cond_7_case_0 ], [ %28, %cond_7_case_1 ]
71-
%32 = fadd double %0, %"0.0"
66+
%"0.0" = phi double [ 0.000000e+00, %cond_7_case_0 ], [ %24, %cond_7_case_1 ]
67+
%28 = fadd double %0, %"0.0"
7268
ret void
7369
}
7470

7571
declare i32 @printf(i8*, ...)
7672

7773
declare void @abort()
78-
79-
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
80-
declare double @llvm.floor.f64(double) #0
81-
82-
attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }

hugr-llvm/src/extension/snapshots/hugr_llvm__extension__rotation__test__emit_all_ops@[email protected]

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,51 +44,47 @@ entry_block: ; preds = %alloca_block
4444
9: ; preds = %entry_block
4545
store double %"2_01", double* %"4_0", align 8
4646
%"4_02" = load double, double* %"4_0", align 8
47-
%10 = fdiv double %"4_02", 2.000000e+00
48-
%11 = call double @llvm.floor.f64(double %10)
49-
%12 = fsub double %10, %11
50-
%13 = fmul double %12, 2.000000e+00
51-
store double %13, double* %"5_0", align 8
47+
store double %"4_02", double* %"5_0", align 8
5248
%"5_03" = load double, double* %"5_0", align 8
53-
%14 = fcmp oeq double %"5_03", 0x7FF0000000000000
54-
%15 = fcmp oeq double %"5_03", 0xFFF0000000000000
55-
%16 = fcmp uno double %"5_03", 0.000000e+00
56-
%17 = or i1 %14, %15
57-
%18 = or i1 %17, %16
58-
%19 = xor i1 %18, true
59-
%20 = insertvalue { double } undef, double %"5_03", 0
60-
%21 = insertvalue { i32, {}, { double } } { i32 1, {} poison, { double } poison }, { double } %20, 2
61-
%22 = select i1 %19, { i32, {}, { double } } %21, { i32, {}, { double } } { i32 0, {} undef, { double } poison }
62-
store { i32, {}, { double } } %22, { i32, {}, { double } }* %"6_0", align 8
49+
%10 = fcmp oeq double %"5_03", 0x7FF0000000000000
50+
%11 = fcmp oeq double %"5_03", 0xFFF0000000000000
51+
%12 = fcmp uno double %"5_03", 0.000000e+00
52+
%13 = or i1 %10, %11
53+
%14 = or i1 %13, %12
54+
%15 = xor i1 %14, true
55+
%16 = insertvalue { double } undef, double %"5_03", 0
56+
%17 = insertvalue { i32, {}, { double } } { i32 1, {} poison, { double } poison }, { double } %16, 2
57+
%18 = select i1 %15, { i32, {}, { double } } %17, { i32, {}, { double } } { i32 0, {} undef, { double } poison }
58+
store { i32, {}, { double } } %18, { i32, {}, { double } }* %"6_0", align 8
6359
%"6_04" = load { i32, {}, { double } }, { i32, {}, { double } }* %"6_0", align 8
64-
%23 = extractvalue { i32, {}, { double } } %"6_04", 0
65-
switch i32 %23, label %24 [
66-
i32 1, label %26
60+
%19 = extractvalue { i32, {}, { double } } %"6_04", 0
61+
switch i32 %19, label %20 [
62+
i32 1, label %22
6763
]
6864

69-
24: ; preds = %9
70-
%25 = extractvalue { i32, {}, { double } } %"6_04", 1
65+
20: ; preds = %9
66+
%21 = extractvalue { i32, {}, { double } } %"6_04", 1
7167
br label %cond_7_case_0
7268

73-
26: ; preds = %9
74-
%27 = extractvalue { i32, {}, { double } } %"6_04", 2
75-
%28 = extractvalue { double } %27, 0
76-
store double %28, double* %"08", align 8
69+
22: ; preds = %9
70+
%23 = extractvalue { i32, {}, { double } } %"6_04", 2
71+
%24 = extractvalue { double } %23, 0
72+
store double %24, double* %"08", align 8
7773
br label %cond_7_case_1
7874

79-
cond_7_case_0: ; preds = %24
75+
cond_7_case_0: ; preds = %20
8076
store { i32, i8* } { i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @1, i32 0, i32 0) }, { i32, i8* }* %"12_0", align 8
8177
%"12_06" = load { i32, i8* }, { i32, i8* }* %"12_0", align 8
82-
%29 = extractvalue { i32, i8* } %"12_06", 0
83-
%30 = extractvalue { i32, i8* } %"12_06", 1
84-
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %29, i8* %30)
78+
%25 = extractvalue { i32, i8* } %"12_06", 0
79+
%26 = extractvalue { i32, i8* } %"12_06", 1
80+
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @prelude.panic_template.1, i32 0, i32 0), i32 %25, i8* %26)
8581
call void @abort()
8682
store double 0.000000e+00, double* %"13_0", align 8
8783
%"13_07" = load double, double* %"13_0", align 8
8884
store double %"13_07", double* %"0", align 8
8985
br label %cond_exit_7
9086

91-
cond_7_case_1: ; preds = %26
87+
cond_7_case_1: ; preds = %22
9288
%"09" = load double, double* %"08", align 8
9389
store double %"09", double* %"15_0", align 8
9490
%"15_010" = load double, double* %"15_0", align 8
@@ -100,16 +96,11 @@ cond_exit_7: ; preds = %cond_7_case_1, %con
10096
store double %"05", double* %"7_0", align 8
10197
%"4_011" = load double, double* %"4_0", align 8
10298
%"7_012" = load double, double* %"7_0", align 8
103-
%32 = fadd double %"4_011", %"7_012"
104-
store double %32, double* %"17_0", align 8
99+
%28 = fadd double %"4_011", %"7_012"
100+
store double %28, double* %"17_0", align 8
105101
ret void
106102
}
107103

108104
declare i32 @printf(i8*, ...)
109105

110106
declare void @abort()
111-
112-
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
113-
declare double @llvm.floor.f64(double) #0
114-
115-
attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }

0 commit comments

Comments
 (0)