On the website of the 2017 World Championship in the part about tournament format (Internet Archive) we can read that:
The final ranking will follow the following procedure:
- Higher position in the group,
- Higher number of points,
- Better goal difference,
- Higher number of goals scored for,
- Better seeding number
So in fact the two bottom ranked teams in the final ranking will be the two teams who finished last in their respective groups.
Since the above quote is from the official website of the tournament, this probably can be considered official information.
In fact if we look at final ranking at 2015 IIHF World Championship, we can see that Denmark was ranked ahead of Austria, despite Denmark having only 4 points from the group stage and Austria having 5 points. Austria finished 8th in their group, so they were ranked after Denmark who finished in the 7th place in group B. (From the information on tournament website, it seems that 2015 tournament was played in the same format as the most recent championships.)
It might be worth adding that the host(s) of the next championship are usually exempt from relegation. The exact rules seems to be changing, mostly depending on whether there are two hosts or single one. For example, 2017 tournament website explicitly states that: "The 2018 IIHF Ice Hockey World Championship will consist of 16 teams including the team of the organizing member national association, thus Denmark cannot be among the two relegated teams." In 2016 the rules were: "If the co-hosts for the 2017 IIHF Ice Hockey World Championship (Germany and France) end up in positions 7 and 8 in Group B during the 2016 IIHF Ice Hockey World Championship, only one team will be relegated – the 8th-ranked team of Group A – and only the winner of the 2016 IIHF Ice Hockey World Championship Division I Group A will be promoted."
The 2009 tournament was the last time this rule was applied. However, in 2009 the tournamnet format was different from the current one.