Skip to content

Commit

Permalink
More testing.
Browse files Browse the repository at this point in the history
bluescarni committed Aug 3, 2024
1 parent b03accb commit f39fcb0
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/llvm_state.cpp
Original file line number Diff line number Diff line change
@@ -1815,6 +1815,12 @@ llvm_multi_state::llvm_multi_state(std::vector<llvm_state> states)

// Settings in all states must be consistent.
auto states_differ = [](const llvm_state &s1, const llvm_state &s2) {
// NOTE: bit of paranoia here.
assert(s1.m_jitter->m_lljit->getDataLayout() == s2.m_jitter->m_lljit->getDataLayout());
assert(s1.m_jitter->get_target_triple() == s2.m_jitter->get_target_triple());
assert(s1.m_jitter->get_target_cpu() == s2.m_jitter->get_target_cpu());
assert(s1.m_jitter->get_target_features() == s2.m_jitter->get_target_features());

if (s1.get_opt_level() != s2.get_opt_level()) {
return true;
}
12 changes: 6 additions & 6 deletions test/llvm_multi_state.cpp
Original file line number Diff line number Diff line change
@@ -324,12 +324,12 @@ TEST_CASE("cfunc")
|| s2.get_ir().substr(0, 100) == ms.get_ir()[1].substr(0, 100)
|| s2.get_ir().substr(0, 100) == ms.get_ir()[2].substr(0, 100)));

REQUIRE((s1.get_bc().substr(0, 50) == ms.get_bc()[0].substr(0, 50)
|| s1.get_bc().substr(0, 50) == ms.get_bc()[1].substr(0, 50)
|| s1.get_bc().substr(0, 50) == ms.get_bc()[2].substr(0, 50)));
REQUIRE((s2.get_bc().substr(0, 50) == ms.get_bc()[0].substr(0, 50)
|| s2.get_bc().substr(0, 50) == ms.get_bc()[1].substr(0, 50)
|| s2.get_bc().substr(0, 50) == ms.get_bc()[2].substr(0, 50)));
REQUIRE((s1.get_bc().substr(0, 25) == ms.get_bc()[0].substr(0, 25)
|| s1.get_bc().substr(0, 25) == ms.get_bc()[1].substr(0, 25)
|| s1.get_bc().substr(0, 25) == ms.get_bc()[2].substr(0, 25)));
REQUIRE((s2.get_bc().substr(0, 25) == ms.get_bc()[0].substr(0, 25)
|| s2.get_bc().substr(0, 25) == ms.get_bc()[1].substr(0, 25)
|| s2.get_bc().substr(0, 25) == ms.get_bc()[2].substr(0, 25)));

auto *cf1_ptr
= reinterpret_cast<void (*)(double *, const double *, const double *, const double *)>(ms.jit_lookup("f1"));

0 comments on commit f39fcb0

Please sign in to comment.