Skip to content

-D analyzer-optimize breaks binary operations on hl.I64 #12031

Open
@Speedphoenix

Description

@Speedphoenix

When inlining a greater-than-32 bitwise shift on an hl.I64, -D analyzer-optimize seems to do a mod 32 on it?

as in this code:

inline function inlinef(v: hl.I64) {
	var str = "";
	str += (v >> 32);
	return str;
}
function noInlinef(v: hl.I64) {
	var str = "";
	str += (v >> 32);
	return str;
}
var base: hl.I64 = 22; // 0b10110
trace("base", base);
trace("inlined", inlinef(base));
trace("noInline", noInlinef(base));

var manual1 = "" + (base >> 33);
trace("shift33", manual1);
var manual2 = "" + (base >> 34);
trace("shift34", manual2);

should ouput

base, 22
inlined, 0
noInline, 0
manual33, 0
manual34, 0

but with -D analyzer-optimize
you get

base, 22
inlined, 22
noInline, 0
shift33, 11
shift34, 5

The dump without analyser-optimize:

var noInlinef = function(v:hl.I64) {
	var str = "";
	str += Std.string(v >> 32);
	return str;
};
var base = 22;
haxe.Log.trace("base", { [...] customParams : [base]});
var str = "";
haxe.Log.trace("inlined", { [...] customParams : [str += Std.string(base >> 32)]});
haxe.Log.trace("noInline", { [...] customParams : [noInlinef(base)]});
var manual1 = "" + Std.string(base >> 33);
haxe.Log.trace("shift33", { [...] customParams : [manual1]});
var manual2 = "" + Std.string(base >> 34);
haxe.Log.trace("shift34", { [...] customParams : [manual2]});

with analyser-optimize:

var noInlinef = function(v:hl.I64) {
	var str = "";
	str = "" + Std.string(v >> 32);
	return str;
};
var base = 22;
haxe.Log.trace("base", { [...] customParams : [base]});
haxe.Log.trace("inlined", { [...] customParams : ["22"]});
haxe.Log.trace("noInline", { [...] customParams : [noInlinef(base)]});
haxe.Log.trace("shift33", { [...] customParams : ["11"]});
haxe.Log.trace("shift34", { [...] customParams : ["5"]});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions