HaxeFoundation / HaxeFoundation/haxe

[analyzer] @:pure meta lost in CFG building

Open
#6,150 2 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
bug feature-analyzer
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

If we have the following:
```haxe
class Main {
@:pure inline static function f() trace("hi");

@:analyzer(full_debug)
static function main() {
f();
}
}
```

The inlined call to `f()` is not being eliminated even though it's `@:pure`, because the `TMeta` is lost when building control flow graph basic blocks:

```
While analyzing Main.main

function() {
@:pure `trace<535>("hi", {fileName : "Main.hx", lineNumber : 2, className : "Main", methodName : "f"});
}

function() {
@:pure `trace<535>("hi", {fileName : "Main.hx", lineNumber : 2, className : "Main", methodName : "f"});
}

function() {
`trace<535>("hi", {fileName : "Main.hx", lineNumber : 2, className : "Main", methodName : "f"});
}

function() {
`trace<535>("hi", {fileName : "Main.hx", lineNumber : 2, className : "Main", methodName : "f"});
}

function() {
`trace<535>("hi", {fileName : "Main.hx", lineNumber : 2, className : "Main", methodName : "f"});
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.