-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
It seems like anywhere that a loop appears makes dead code elimination not happen. Given this Hilti code:
module Test {
import hilti;
function void f() {
local x = 5;
return;
while (True) {}
hilti::print(x);
}
f();
}
The output f is:
$ HILTI_OPTIMIZER_ENABLE_CFG=1 hiltic -p test.hlt
function void f() {
local uint<64> x = 5;
return;
while ( True ) {
}
hilti::print(x, True);
}
and replacing the while with if optimizes it correctly (with an extra block but meh):
$ HILTI_OPTIMIZER_ENABLE_CFG=1 hiltic -p test.hlt
function void f() {
return;
{
}
}
Doesn't seem like this should be high priority, but it technically causes missed optimizations, for example if that store in x is expensive. I don't think it'll pop up much. I'm also not sure why it happens, though, so it might be more.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo