Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifier Pass #4700

Closed
wants to merge 528 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
528 commits
Select commit Hold shift + click to select a range
91cd06b
ASR->LLVM: handle association to PointerNullConstant by creating just…
gxyd Sep 12, 2024
e1524c2
Merge pull request #4785 from gxyd/associate_07_fix
certik Sep 12, 2024
42f919a
chore: merge specific commits from `array_op_refac` branch
kmr-srbh Sep 14, 2024
e6d1ae6
tests: comment out failing test `subroutines_12.f90`
kmr-srbh Sep 14, 2024
6702e4c
Merge pull request #4796 from kmr-srbh/simplifier_pass
certik Sep 14, 2024
4a4730c
Merge branch 'main' into simplifier_pass
gxyd Sep 15, 2024
0d5fc77
Merge pull request #4800 from gxyd/merge_main_into_simplifier_pass
gxyd Sep 15, 2024
0ab0932
Merge branch 'main' into simplifier_pass
kmr-srbh Sep 15, 2024
c96570d
Merge pull request #4805 from kmr-srbh/simplifier_pass
kmr-srbh Sep 15, 2024
cba652f
uncomment passing test case on macOS
gxyd Sep 16, 2024
497f046
Merge pull request #4810 from gxyd/uncomment_passing_associate_13
gxyd Sep 16, 2024
6745a0b
convert initialization to assignment in the same scope as initilization
gxyd Sep 16, 2024
ca2e926
uncomment passing tests
gxyd Sep 16, 2024
8f6a345
simplifier pass: use `m_value` for replacing Var, when available
gxyd Sep 16, 2024
9750e99
Merge pull request #4812 from gxyd/uncomment_passing_tests
gxyd Sep 17, 2024
3e20bf2
fix: do ASR verification conditionally for `ASR::ExternalSymbol` in `…
kmr-srbh Sep 17, 2024
68cbfef
tests: enable testing with `--realloc-lhs` flag
kmr-srbh Sep 17, 2024
d642f0c
Merge pull request #4819 from kmr-srbh/bypass-asr-verify-external-sym…
gxyd Sep 17, 2024
c31d2a5
tests: enable testing `parameter_13`
kmr-srbh Sep 17, 2024
714dfea
tests: update output value to test
kmr-srbh Sep 17, 2024
0b6f5cf
Merge pull request #4822 from kmr-srbh/enable-parameter-13
kmr-srbh Sep 17, 2024
c35f61b
Merge pull request #4813 from gxyd/enum_02_fix
gxyd Sep 18, 2024
0e6ea40
Merge pull request #4811 from gxyd/subroutines_12_fix
gxyd Sep 18, 2024
005a772
Merge pull request #4820 from kmr-srbh/enable-intrinsics-311
gxyd Sep 18, 2024
3d47a16
fix: handle logical arrays inside `WHERE` clause
kmr-srbh Sep 18, 2024
9055ed1
tests: enable functional tests
kmr-srbh Sep 18, 2024
6bad338
Merge pull request #4829 from kmr-srbh/where-pass-with-simplifier
Pranavchiku Sep 18, 2024
bce2a86
chore: do stricter type checking for arrays of ttype `Logical_t`
kmr-srbh Sep 18, 2024
e9e9d68
tests: enable functional tests
kmr-srbh Sep 18, 2024
bac7552
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Sep 19, 2024
2380dfa
Merge pull request #4839 from gxyd/merge_main_into_simplifier_pass
gxyd Sep 19, 2024
38a8145
ci: uncomment minpack tests
Pranavchiku Sep 19, 2024
ad18df6
Merge pull request #4841 from Pranavchiku/ci-uncomment
Pranavchiku Sep 19, 2024
7a16eaa
simplifier pass CI: uncomment passing CI job (#4827)
gxyd Sep 19, 2024
fa52145
Fix reshape bug
Shaikh-Ubaid Sep 22, 2024
f002fcb
Uncomment supporting test case
Shaikh-Ubaid Sep 22, 2024
366b1a1
Merge pull request #4877 from Shaikh-Ubaid/fix_simp_pass_param
certik Sep 22, 2024
978af0d
Merge branch 'main' into simplifier_pass
gxyd Sep 23, 2024
64ebe53
Merge pull request #4883 from gxyd/merge_main_into_simplifier_pass
gxyd Sep 23, 2024
d5e102d
uncomment passing test case `modules_58.f90`
gxyd Sep 23, 2024
232f72c
Merge pull request #4884 from gxyd/modules_58
gxyd Sep 23, 2024
8674dc2
assign temporary variable for assignment
gxyd Sep 23, 2024
022456b
refactor code
gxyd Sep 23, 2024
fe1669a
uncomment passing test case
gxyd Sep 23, 2024
e1d3863
Merge branch 'main' into simplifier_pass
gxyd Sep 24, 2024
1b49e92
Merge pull request #4893 from gxyd/merge_main_into_simplifier_pass
gxyd Sep 24, 2024
4b7f63a
Merge branch 'simplifier_pass' into fix_arrays_op_18
gxyd Sep 25, 2024
affb643
Merge pull request #4887 from gxyd/fix_arrays_op_18
gxyd Sep 25, 2024
c2100cb
fix: convert parameterized StructConstructor or an ArrayConstructor t…
gxyd Sep 25, 2024
1e7d997
add note and ensure to not convert to assignment ArrayConstructor wit…
gxyd Sep 25, 2024
13a0bd5
refactor condition to convert parameter variable initialization to as…
gxyd Sep 26, 2024
7a11d01
Merge pull request #4908 from gxyd/fix_nbody
Pranavchiku Sep 30, 2024
ff06bad
Merge branch 'main' into simplifier_pass
gxyd Sep 30, 2024
cf9c7bb
Merge pull request #4940 from gxyd/merge_main_into_simplifier_pass
gxyd Sep 30, 2024
df12fb6
wip
czgdp1807 Oct 3, 2024
ed3a153
done
czgdp1807 Oct 3, 2024
108b713
wip
czgdp1807 Oct 3, 2024
32bba24
Merge pull request #4965 from gxyd/cherry_pick_matmul_01_fix
gxyd Oct 3, 2024
cf34329
Merge main into simplifier pass (#4968)
gxyd Oct 3, 2024
55364ac
CI: try uncomment CI job to see if LLVM tests succeed or not (#4969)
gxyd Oct 3, 2024
2ed00fc
ci: uncomment 3rd party tests that work
Pranavchiku Oct 3, 2024
2ad5b44
Merge pull request #4972 from Pranavchiku/ci-setup
Pranavchiku Oct 3, 2024
489422f
uncomment passing integration tests (#4977)
gxyd Oct 4, 2024
4e3ddd0
fix: replace `ArrayBroadcast` in `where` pass (#4911)
kmr-srbh Oct 4, 2024
ed35306
simplifier pass: cherry pick fix for template_04 (#4966)
gxyd Oct 4, 2024
8d0e600
chore: use simplifier pass with --fast and reorder passes
Pranavchiku Oct 5, 2024
3cc7a23
test: add and register
Pranavchiku Oct 5, 2024
42a5f05
chore: run implied_do_loops pass to support tuple printing
Pranavchiku Oct 5, 2024
5ad447b
ci: enable SNAP
Pranavchiku Oct 5, 2024
d7af988
test: comment three tests
Pranavchiku Oct 5, 2024
e5e7806
test: comment out intrinsics_288
Pranavchiku Oct 5, 2024
76afe44
Merge pull request #4984 from Pranavchiku/simplifier-fast
Pranavchiku Oct 6, 2024
7fec91e
Merge pull request #4986 from Pranavchiku/snap-failure
Pranavchiku Oct 6, 2024
94fd2fd
chore: run implied_do_loops past with --fast
Pranavchiku Oct 6, 2024
627265d
ci: enable SNAP with --fast
Pranavchiku Oct 6, 2024
a4d9fae
Merge pull request #4991 from Pranavchiku/snap-fast
Pranavchiku Oct 6, 2024
26017ac
enh: handle logical_not
Pranavchiku Oct 6, 2024
6a09c03
test: add and register
Pranavchiku Oct 6, 2024
3250496
Merge pull request #4993 from Pranavchiku/stdlib-mre-1
Pranavchiku Oct 6, 2024
ebc643f
chore: do not link target if value is string section and not an array
Pranavchiku Oct 6, 2024
ce455ec
test: add and register
Pranavchiku Oct 6, 2024
de40d9a
enh: consequent fixes
Pranavchiku Oct 6, 2024
18b5b56
test: add and register
Pranavchiku Oct 6, 2024
25ea3a8
test: remove fortran label from string_39
Pranavchiku Oct 6, 2024
7cda06c
enh: simplifier pass
Pranavchiku Oct 6, 2024
0080fd3
Merge pull request #4998 from Pranavchiku/stdlib-mre-2
Pranavchiku Oct 6, 2024
9c41196
introduce 'nollvm17orhigher' label for tests (#5002)
gxyd Oct 7, 2024
fc701af
Merge branch 'main' into simplifier_pass
gxyd Oct 7, 2024
d2e6602
Merge pull request #5004 from gxyd/merge_main_into_simplifier_pass
certik Oct 7, 2024
ca01ae7
force replace a FunctionCall when original target and --realloc-lhs i…
gxyd Oct 8, 2024
6a2c5ee
dummy CI changes
gxyd Oct 8, 2024
76bf08a
minor change
gxyd Oct 8, 2024
a4ff7b1
add test case
gxyd Oct 8, 2024
cc2175a
remove llvm version
gxyd Oct 8, 2024
2aba9b4
CI: partially uncomment passing dftatom compilation CI job
gxyd Oct 8, 2024
3365bbd
Merge pull request #5010 from gxyd/ci_changes
certik Oct 8, 2024
bdadd18
Merge branch 'simplifier_pass' into fix_mre_dftatom
certik Oct 8, 2024
333e423
Merge branch 'main' into simplifier_pass
gxyd Oct 8, 2024
5fe404a
CI: comment out possibly failing CI jobs
gxyd Oct 8, 2024
74cb36a
CI: fix spacing/indentation problem
gxyd Oct 8, 2024
e2597f6
CI: restore dummy CI job for now
gxyd Oct 8, 2024
b03fe40
Merge pull request #5015 from gxyd/merge_main_into_simplifier_pass
certik Oct 8, 2024
382bec8
Revert "add test case"
gxyd Oct 9, 2024
dcf5c5c
Merge branch 'simplifier_pass' into fix_mre_dftatom
gxyd Oct 9, 2024
9a11e24
Merge pull request #5009 from gxyd/fix_mre_dftatom
gxyd Oct 9, 2024
efd8406
chore: don't create temporary for StructInstanceMember as call argument
gxyd Oct 9, 2024
5fa0ea4
CI simplifier pass: Update CI (#5020)
gxyd Oct 9, 2024
f0d47b1
Merge branch 'simplifier_pass' into fix_runtime_dftatom
gxyd Oct 9, 2024
e2de428
CI: uncomment passing dftatom CI job
gxyd Oct 9, 2024
01d377a
Merge pull request #5021 from gxyd/fix_runtime_dftatom
gxyd Oct 10, 2024
3358f42
test: update array13 to not use init_expr pass
Pranavchiku Oct 10, 2024
29d675e
test: update references
Pranavchiku Oct 10, 2024
3a99468
ci: uncomment docs build
Pranavchiku Oct 10, 2024
b59b710
fix: do not create an assignment if variable is scalar
Pranavchiku Oct 10, 2024
59a8893
chore: pass check of value if it storage type is save and have value
Pranavchiku Oct 10, 2024
a88126d
test: remove fortran label from matrix_02_matmul
Pranavchiku Oct 10, 2024
dd20bf1
Merge pull request #5027 from Pranavchiku/simplifier-reference
certik Oct 10, 2024
6edd69b
Merge pull request #5028 from Pranavchiku/ci-docs
certik Oct 10, 2024
4451169
chore: reorder openmp pass to compile all openmp codeS
Pranavchiku Oct 11, 2024
180a079
XX: comment value test to get omp tests working
Pranavchiku Oct 11, 2024
b9e5f44
ci: uncomment CI tests that pass
Pranavchiku Oct 11, 2024
065add7
test: update references
Pranavchiku Oct 11, 2024
78055b4
test: comment openmp cases which segfault on linux
Pranavchiku Oct 11, 2024
a6f9bc7
ci: remove windows 2019 build
Pranavchiku Oct 11, 2024
2e3a155
chore: apply suggestion from code review
Pranavchiku Oct 12, 2024
280cfff
Merge pull request #5032 from Pranavchiku/ci-uncomment-2
Pranavchiku Oct 12, 2024
e7b0210
ci: update to run tests with LLVM 17 and higher
kmr-srbh Oct 13, 2024
7e0742a
dev: keep the `nollvm17orhigher` label
kmr-srbh Oct 13, 2024
5b8f164
Merge pull request #5038 from kmr-srbh/update-ci-for-llvm17-tests
Pranavchiku Oct 13, 2024
1cc2fdc
tests: delete tests which are merged into main (#5041)
gxyd Oct 14, 2024
35ec80b
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 14, 2024
d2cd4b5
Merge pull request #5042 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 14, 2024
8eacec3
CI: try uncommenting the CI job (#5044)
gxyd Oct 14, 2024
0586456
CI: update the CI job for fastGPT (#5043)
gxyd Oct 14, 2024
0cf9bdf
CI: uncomment test without LLVM backend (#5045)
gxyd Oct 14, 2024
5e22013
CI: uncomment windows CI job to see if it passes (#5048)
gxyd Oct 14, 2024
caae0af
chore: set allocation size for intrinsic elemental function "INT" (#5…
gxyd Oct 15, 2024
300480e
done
czgdp1807 Oct 4, 2024
75dd3ee
wip
czgdp1807 Oct 11, 2024
5167837
wip
czgdp1807 Oct 11, 2024
d5ccc44
done
czgdp1807 Oct 15, 2024
cdefbce
don't test 'where_04' with LLVM backend for now
gxyd Oct 16, 2024
b9c262a
rename variables to see if the error persists
gxyd Oct 16, 2024
1740a49
update reference tests
gxyd Oct 16, 2024
e636c77
initialize 'current_expr=nullptr' in asdl_cpp.py
gxyd Oct 16, 2024
5ef2897
Merge pull request #5064 from gxyd/where_tests
gxyd Oct 16, 2024
35e8667
chore: replace intrinsic elemental function with temporary when retur…
gxyd Oct 16, 2024
674518f
Fix array op tests for WASM
advikkabra Oct 17, 2024
91d744e
fix return type of elemental functions with any one array argument
gxyd Oct 17, 2024
4a64f81
minor change
gxyd Oct 17, 2024
3d62ecc
uncomment stdlib CI job and fix return type of generic procedure
gxyd Oct 17, 2024
4ab872d
update reference tests
gxyd Oct 17, 2024
60cce45
update stdlib repository link, as it uses workarounds
gxyd Oct 17, 2024
23d250c
Merge pull request #5077 from gxyd/fix_return_type_elemental
gxyd Oct 17, 2024
d15e888
ci: enable ctest on stdlib
Pranavchiku Oct 17, 2024
e02f24e
Merge pull request #5078 from Pranavchiku/ci-stdlib-ctest
Pranavchiku Oct 17, 2024
06ec553
Enable WASM at CI
advikkabra Oct 17, 2024
ba61901
Merge pull request #5076 from advikkabra/simplifier_pass_1
Pranavchiku Oct 17, 2024
fcf1807
test: remove c, c_nopragma label from matmul_01
Pranavchiku Oct 17, 2024
e53fa90
ci: enable test c/c++ backend
Pranavchiku Oct 17, 2024
e1dae0d
ci: use node-18.20.3-64bit for emsdk
Pranavchiku Oct 17, 2024
5a79854
ci: remove --experimental-wasm-bigint from test WASM
Pranavchiku Oct 18, 2024
cf966ad
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 18, 2024
e56efbb
Merge pull request #5079 from Pranavchiku/ci-c
Pranavchiku Oct 18, 2024
f9b7b09
update reference tests and comment out MRE of stdlib
gxyd Oct 18, 2024
d5e3037
ci: mark tests that do not work with FAST
Pranavchiku Oct 17, 2024
fd2f50e
ci: sync CI with main
Pranavchiku Oct 18, 2024
9bc65a2
test: add NOFAST and comment test that do not work
Pranavchiku Oct 18, 2024
8f0b8b8
Merge pull request #5085 from Pranavchiku/ci-fast
Pranavchiku Oct 18, 2024
8e30b7f
Merge pull request #5084 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 18, 2024
5128e9c
chore: create temporary for 'c = transpose(c)' kind of assignment
gxyd Oct 18, 2024
ab30f84
CI: get rid of workaround
gxyd Oct 18, 2024
670f69e
chore: remove stray file `a.f90`
kmr-srbh Oct 18, 2024
f600344
Merge pull request #5086 from gxyd/temporary_for_transpose
Pranavchiku Oct 18, 2024
a440c7c
enh: enable init_expr pass
Pranavchiku Oct 18, 2024
3c92571
test: revert workaround from parameter_13
Pranavchiku Oct 18, 2024
7d99f97
test: update reference
Pranavchiku Oct 18, 2024
50717e5
Merge pull request #5089 from Pranavchiku/init_expr
Pranavchiku Oct 18, 2024
459a766
tests: enable functional integration tests (#5088)
kmr-srbh Oct 18, 2024
ecc05ed
Fixes simplification issues with RealBinOp
czgdp1807 Oct 19, 2024
be030cd
Merge pull request #5098 from czgdp1807/realloc_lhs_fix
gxyd Oct 20, 2024
a47b24b
present experimental-simpilfier flag (default as true)
assem2002 Oct 19, 2024
0282c24
Merge branch 'main' into simplifier_pass
gxyd Oct 21, 2024
1ab70ab
Merge pull request #5101 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 21, 2024
6da5b6a
asr verify: uncomment ASR verify check (#5102)
gxyd Oct 21, 2024
9b13377
uncomment workaround from simplifier_pass branch
gxyd Oct 21, 2024
0812bc7
no need to use `make_Variable_t_util`
gxyd Oct 21, 2024
3b833fc
Merge pull request #5105 from gxyd/undo_changes
gxyd Oct 21, 2024
023bf79
Merge branch 'main' into simplifier_pass
gxyd Oct 21, 2024
80d3e50
Merge pull request #5108 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 21, 2024
f37cb1e
register all the elemental intrinsics in set_allocation_size
HarshitaKalani Oct 21, 2024
ddaa337
Merge pull request #5112 from HarshitaKalani/set_allocation_size_01
HarshitaKalani Oct 21, 2024
305d14c
Merge branch 'main' into simplifier_pass
gxyd Oct 22, 2024
39f5b62
undo deletion of integration test case from CMakeLists.txt
gxyd Oct 22, 2024
f04a0fe
Remove ArrayBroadcast node in simplifier pass
czgdp1807 Oct 20, 2024
cba45c1
Registered arrays_55
czgdp1807 Oct 20, 2024
de062c0
Registered additional test
czgdp1807 Oct 20, 2024
69e3282
DEV: Select only variables same as target rank
czgdp1807 Oct 22, 2024
9326e4f
TEST: Updated reference tests
czgdp1807 Oct 22, 2024
2ec83cd
Merge pull request #5099 from czgdp1807/simplifier_pass
czgdp1807 Oct 23, 2024
7a901c6
Merge pull request #5123 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 23, 2024
f74c62f
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 23, 2024
0012e2d
comment out "experimental simplifier" sections from CI job
gxyd Oct 23, 2024
e57870f
Merge pull request #5131 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 23, 2024
292acf4
undo commented out 'Abs' argument check (#5132)
gxyd Oct 23, 2024
b6d61d1
Merge branch 'main' into simplifier_pass
gxyd Oct 23, 2024
b656661
Merge pull request #5135 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 23, 2024
a4b98b1
Merge pull request #5134 from gxyd/comment_exper_simplifier
certik Oct 23, 2024
198e72a
remove label no LLVM 17 or higher label
gxyd Oct 24, 2024
30d0870
Merge pull request #5145 from gxyd/remove_nollvm17
gxyd Oct 24, 2024
58b1ec9
DEV: Remove replace_IntegerBinOp and visit_IntegerBinOp
czgdp1807 Oct 24, 2024
27d79a4
DEV: Fix BinOp simplification
czgdp1807 Oct 24, 2024
bbbc276
TEST: Updated reference tests
czgdp1807 Oct 24, 2024
31d95cb
Merge pull request #5153 from czgdp1807/remove_binop
czgdp1807 Oct 24, 2024
7050362
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 24, 2024
d08f2f4
undo removal of "array_op"
gxyd Oct 24, 2024
5d63a83
Merge branch 'simplifier_pass' into merge_main_into_simplifier_pass
czgdp1807 Oct 24, 2024
41d56bb
uncomment pass integration tests
gxyd Oct 24, 2024
d43dc46
test 'array_op_simplifier' pass in simplifier_pass branch instead of …
gxyd Oct 25, 2024
1a6f776
sync reference files (with 'array_op') with *main* branch
gxyd Oct 25, 2024
9b5aef5
Merge pull request #5155 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 25, 2024
815b3a8
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 25, 2024
b9ae16d
set `use_experimental_simplifier` constant to true in simplifier_pass…
gxyd Oct 25, 2024
85bc2c8
Merge pull request #5163 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 25, 2024
d83da7e
Merge branch 'main' into merge_main_into_simplifier_pass
gxyd Oct 25, 2024
f907f8f
undo tab changes
gxyd Oct 25, 2024
9c88ccc
Merge pull request #5164 from gxyd/merge_main_into_simplifier_pass
gxyd Oct 25, 2024
00cfc89
sync back 'subroutine_from_function.cpp' with main
gxyd Oct 25, 2024
19a0fc3
Merge pull request #5169 from gxyd/sync_subroutine_from_function
gxyd Oct 25, 2024
07dae0b
Merge pull request #5166 from gxyd/undo_tab
gxyd Oct 25, 2024
1e0aa7a
chore: add a global pass_simplifier variable
Pranavchiku Oct 24, 2024
28c55f0
sync: intrinsic_array_function_registry, intrinsic_function.cpp/.h
Pranavchiku Oct 24, 2024
01c24ef
test: add NO_EXPERIMENTAL_SIMPLIFIER to failing tests
Pranavchiku Oct 24, 2024
5324586
refactor: use `ASRUtils::use_experimental_simplifier`
kmr-srbh Oct 25, 2024
9c73ded
comment out unusued argument
gxyd Oct 25, 2024
51da548
chore: sync `where` pass with main
kmr-srbh Oct 23, 2024
04a129e
chore: add correct changes from `main`
kmr-srbh Oct 25, 2024
b2ac21b
chore: sync `asr_verify` with main
kmr-srbh Oct 23, 2024
0b46584
chore: always visit the BaseWalkVisitor for `ArraySize`
kmr-srbh Oct 25, 2024
6dfceb0
chore: refactor unnecessary ASR verification
kmr-srbh Oct 25, 2024
bd746c7
chore: add missing variable declaration and remove duplicate function…
kmr-srbh Oct 26, 2024
3e3a317
chore: minor refactor
kmr-srbh Oct 26, 2024
45a3841
Merge pull request #5172 from kmr-srbh/merge-main-simplifier
certik Oct 26, 2024
ccc5d88
chore: resolve merge conflicts
kmr-srbh Oct 27, 2024
7c67acd
Merge pull request #5177 from kmr-srbh/resolve-conflicts-simplifier
certik Oct 27, 2024
d701650
chore: bring back changes from `main` using `use_experimental_simplif…
kmr-srbh Oct 27, 2024
ca8c732
chore: shorten diff between `main` and `simplifier_pass`
kmr-srbh Oct 27, 2024
87baf33
Merge pull request #5178 from kmr-srbh/minor-changes-intrinsic-array-…
certik Oct 27, 2024
edb05f8
Merge pull request #5180 from kmr-srbh/remove-unnecessary-whitespace
certik Oct 27, 2024
c988ff8
Merge branch 'main' into pr4700_conflicts
certik Oct 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1468,3 +1468,32 @@ jobs:
env:
SSH_PRIVATE_KEY_DOCS: ${{ secrets.SSH_PRIVATE_KEY_DOCS }}


# build-and-push-image:
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# env:
# REGISTRY: ghcr.io
# USER: lfortran
# PROJECT: lfortran
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Log in to the Container registry
# if: ${{ github.event_name == 'push' }}
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ env.USER }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# context: .
# push: ${{ github.event_name == 'push' }}
# tags: ${{ env.REGISTRY }}/${{ env.USER }}/${{ env.PROJECT }}:latest
40 changes: 0 additions & 40 deletions .github/workflows/upload_docker_build.yml

This file was deleted.

10 changes: 10 additions & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,10 @@ RUN(NAME intrinsics_315 LABELS llvm llvm_wasm llvm_wasm_emcc) # out_of_range
RUN(NAME intrinsics_316 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran) # max, min
RUN(NAME intrinsics_317 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran) # get_command_argument
RUN(NAME intrinsics_318 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc) # cpu_time
RUN(NAME intrinsics_319 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc) # system_clock
RUN(NAME intrinsics_320 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran) # len_trim
RUN(NAME intrinsics_321 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran) # trim
RUN(NAME intrinsics_322 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc fortran) # index

RUN(NAME la_constants LABELS gfortran llvm llvm_wasm llvm_wasm_emcc NOFAST) # LAPACK constants

Expand Down Expand Up @@ -1810,3 +1814,9 @@ RUN(NAME func_parameter_type_02 LABELS gfortran) # function passed in other argu
RUN(NAME logical_not_01 LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
# TODO: we should eventually save the below program's ASR as well
RUN(NAME elemental_function_scalar_array_arg LABELS gfortran llvm llvm_wasm llvm_wasm_emcc)
# TOD: below is an MRE extracted from stdlib, it currently fails
# we need to fix it
# RUN(NAME generic_interface_function_call_of_function_call LABELS gfortran llvm llvm_wasm llvm_wasm_emcc
# EXTRA_ARGS --realloc-lhs)
RUN(NAME elemental_function_overloaded_compare LABELS gfortran llvm llvm_wasm llvm_wasm_emcc
EXTRA_ARGS --realloc-lhs)
55 changes: 55 additions & 0 deletions integration_tests/elemental_function_overloaded_compare.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
! program extracted as MRE from https://github.com/fortran-lang/stdlib
! there is missing implementation of functions/subroutines like
! check_logical, eq_string_char, new_string_from_integer_int32 etc.
! but as that's not need to be able to compile and run the MRE,
! that's being skipped for now, actually we tried having their implementation
! as well, but the program failed to run (take that as a TODO)
module mod_elemental_function_overloaded_compare
use iso_fortran_env, only: int32
implicit none
!> String type holding an arbitrary sequence of characters.

interface operator(==)
module procedure :: eq_string_char
end interface operator(==)

type :: string_type
sequence
private
character(len=:), allocatable :: raw
end type string_type

contains

subroutine check_logical(expression)
logical, intent(in) :: expression
if (.not. expression) then
print *, "Condition not fulfilled"
end if
end subroutine check_logical

elemental function eq_string_char(lhs, rhs) result(is_eq)
type(string_type), intent(in) :: lhs
character(len=*), intent(in) :: rhs
logical :: is_eq
end function eq_string_char

elemental module function new_string_from_integer_int32(val) result(new)
integer(int32), intent(in) :: val
type(string_type) :: new
end function new_string_from_integer_int32

subroutine test_constructor()
character(len=128) :: flc

write(flc, '(i0)') -1026191
call check_logical(new_string_from_integer_int32(-1026191) == trim(flc))
end subroutine test_constructor

end module mod_elemental_function_overloaded_compare

program test_elemental_function_overloaded_compare
use mod_elemental_function_overloaded_compare
implicit none
call test_constructor()
end program
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module stdlib_linalg
implicit none

! Define the generic interface 'diag'
interface diag
procedure :: diag_iint16_mat ! Handles matrix to vector
procedure :: diag_iint16_vec ! Handles vector to matrix
end interface

contains

! Function to extract the diagonal of a matrix
module function diag_iint16_mat(A) result(res)
integer(4), intent(in) :: A(:,:)
integer(4) :: res(minval(shape(A)))
integer :: i

do i = 1, minval(shape(A))
res(i) = A(i, i)
end do
end function diag_iint16_mat

! Function to create a diagonal matrix from a vector
module function diag_iint16_vec(v) result(res)
integer(4), intent(in) :: v(:)
integer(4) :: res(size(v), size(v))
integer :: i, j

! Initialize the result matrix to zero
res = 0

! Assign the vector elements to the diagonal of the matrix
do i = 1, size(v)
res(i, i) = v(i)
end do
end function diag_iint16_vec

! Test subroutine to demonstrate diag(diag(a))
subroutine test_diag_int16()
integer, parameter :: n = 4
integer(4) :: a(n, n), d(n**2)
integer(4) :: e(n, n)
integer :: j

! Initialize the array 'd' with values from 1 to n^2
do j = 1, n**2
d(j) = j
end do

! Reshape 'd' into an n x n matrix 'a'
a = reshape(d, [n, n])

! Apply diag twice: first to extract the diagonal vector,
! then to create a diagonal matrix
e = diag(diag(a))

! Optional: Print the results for verification
print *, "Matrix a:"
do j = 1, n
print *, a(j, :)
end do

print *, "Diagonal of a:"
print *, diag(a)
if (any(diag(a) /= [1, 6, 11, 16])) error stop

print *, "diag(diag(a)):"
print *, e(1, :)
if (any(e(1, :) /= [1, 0, 0, 0])) error stop
print *, e(2, :)
if (any(e(2, :) /= [0, 6, 0, 0])) error stop
print *, e(3, :)
if (any(e(3, :) /= [0, 0, 11, 0])) error stop
print *, e(4, :)
if (any(e(4, :) /= [0, 0, 0, 16])) error stop
end subroutine test_diag_int16

end module stdlib_linalg

program main
use stdlib_linalg
implicit none

call test_diag_int16()
end program main
8 changes: 8 additions & 0 deletions integration_tests/intrinsics_233.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
program intrinsics_233
implicit none
real :: x
real :: z = -1.0
real :: y(3)
x = -1.0
x = sqrt(x)
Expand All @@ -18,4 +19,11 @@ program intrinsics_233
print*, y(3)
print *, isnan(y(3))
if (isnan(y(3)) .neqv. .true.) error stop

!tests for compile time argument
print *, isnan(1.0)
if (isnan(1.0) .neqv. .false.) error stop
print *, isnan(sqrt(z))
if (isnan(sqrt(z)) .neqv. .true.) error stop

end program
19 changes: 13 additions & 6 deletions integration_tests/intrinsics_275.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ program intrinsics_275
integer, parameter :: i2 = and(-1, 5)
integer, parameter :: i3 = and(-4_8, 2_8)
integer(8), parameter :: i4 = and(-2_8, 5_8)
! logical, parameter :: l1 = and(.true., .false.) ! Does not work yet! #4380
! logical :: true = .true., false = .false.
logical, parameter :: l1 = and(.true., .false.)
logical, parameter :: l2 = and(.true., .true.)
logical :: true = .true., false = .false.

print *, i1
if (i1 /= 0) error stop
Expand All @@ -19,11 +20,17 @@ program intrinsics_275
if (i3 /= 0) error stop
print *, i4
if (i4 /= 4) error stop
! print *, l1
! if (l1 .neqv. .false.) error stop

! print *, and(true, false)
! if (and(true, false) .neqv. .false.) error stop
! logical argument testing
print *, l1
if (l1 .neqv. .false.) error stop
print *, l2
if (l2 .neqv. .true.) error stop
print *, and(true, false)
if (and(true, false) .neqv. .false.) error stop
print *, and(true, true)
if (and(true, true) .neqv. .true.) error stop

print*, and(5, 8)
if (and(5, 8) /= 0) error stop
print*, and(-1, 5)
Expand Down
27 changes: 27 additions & 0 deletions integration_tests/intrinsics_288.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ program intrinsics_288
real, dimension(3, 2) :: result2
logical, dimension(2, 3) :: result3
complex, dimension(3, 2) :: result4
integer :: a = 1
integer, dimension(2) :: result5
character :: ch = 'b'
character, dimension(2) :: result6
logical :: lo = .true.
logical, dimension(2) :: result7
real :: rl = 1.0
real, dimension(2) :: result8

result = spread(source, dim=2, ncopies=2)
print *, result
if (result(1, 1) /= 1 .or. result(1, 2) /= 1 .or. result(2, 1) /= 2 .or. &
Expand Down Expand Up @@ -50,4 +59,22 @@ program intrinsics_288
if (result4(1, 1) /= (1, 2) .or. result4(1, 2) /= (1, 2) .or. result4(2, 1) /= (2, 3) .or. &
result4(2, 2) /= (2, 3) .or. result4(3, 1) /= (3, 4) .or. result4(3, 2) /= (3, 4)) error stop
print *, spread(source5, 1, 3) ! Wrong output with LFortran

! tests for Scalar Sources
result5 = SPREAD(a, 1, 2)
print *, result5
if (result5(1) /= 1 .or. result5(2) /= 1 ) error stop

result6 = SPREAD(ch, 1, 2)
print *, result6
if (result6(1) /= 'b' .or. result6(2) /= 'b' ) error stop

result7 = SPREAD(lo, 1, 2)
print *, result7
if ( (result7(1) .neqv. .true.) .or. (result7(2) .neqv. .true.) ) error stop

result8 = SPREAD(rl, 1, 2)
print *, result8
if ( abs(result8(1) - 1.0) > 1e-6 .or. abs(result8(2) - 1.0) > 1e-6 ) error stop

end program
7 changes: 7 additions & 0 deletions integration_tests/intrinsics_322.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
program intrinsics_322
character(3) :: cx(2)
cx(1) = "woo"
cx(2) = "oba"
print *, index(cx, "a")
if (any(index(cx, "a") /= [0, 3])) error stop
end program
8 changes: 4 additions & 4 deletions src/lfortran/semantics/ast_common_visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
{"lge", {IntrinsicSignature({"string_A", "string_B"}, 2, 2)}},
{"lle", {IntrinsicSignature({"string_A", "string_B"}, 2, 2)}},
{"iand", {IntrinsicSignature({"i", "j"}, 2, 2)}},
{"and", {IntrinsicSignature({"i", "j"}, 2, 2)}},
{"ior", {IntrinsicSignature({"i", "j"}, 2, 2)}},
{"ieor", {IntrinsicSignature({"i", "j"}, 2, 2)}},
{"ibclr", {IntrinsicSignature({"i", "pos"}, 2, 2)}},
Expand Down Expand Up @@ -924,7 +925,6 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
{"ddim", {"dim", {"real8", "real8"}}},
{"amod", {"mod", {"real4", "real4"}}},
{"dmod", {"mod", {"real8", "real8"}}},
{"and", {"iand", {"any", "any"}}},
{"or", {"ior", {"any", "any"}}},
{"xor", {"ieor", {"any", "any"}}},
};
Expand Down Expand Up @@ -5758,12 +5758,12 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
}

void scalar_kind_arg(std::string &name, Vec<ASR::expr_t*> &args) {
std::vector<std::string> optional_kind_arg = {"logical", "storage_size", "anint", "nint", "aint", "floor",
"ceiling", "aimag", "maskl", "maskr", "ichar", "char", "achar", "real"};
std::vector<std::string> optional_kind_arg = {"logical", "storage_size", "anint", "nint", "aint", "floor",
"ceiling", "aimag", "maskl", "maskr", "ichar", "char", "achar", "real", "int"};
if (std::find(optional_kind_arg.begin(), optional_kind_arg.end(), name) != optional_kind_arg.end()) {
if (args[1]) {
if (ASRUtils::is_array(ASRUtils::expr_type(args[1]))) {
throw SemanticError("Expected scalar argument for " + name + " intrinsic", args[1]->base.loc);
throw SemanticError("kind argument of `" + name + "` intrinsic must be a scalar", args[1]->base.loc);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/lfortran/semantics/comptime_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ struct IntrinsicProcedures {
// in intrinsic_function_transformation()
// So we shouldn't even encounter them here
{"newunit", {m_custom, &not_implemented, false}},
{"present", {m_builtin, &not_implemented, false}},

// IEEE Arithmetic
{"ieee_value", {m_ieee_arithmetic, &not_implemented, false}},
Expand Down
Loading
Loading