Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect IF block merge #5

Open
ferib opened this issue Mar 6, 2021 · 3 comments
Open

incorrect IF block merge #5

ferib opened this issue Mar 6, 2021 · 3 comments
Labels
Decompiler Decompiler
Milestone

Comments

@ferib
Copy link
Owner

ferib commented Mar 6, 2021

IF merge failed here

  local function unknown1(var0, var1, var2)
  local var3 = var1["x"]
  local var4 = var1["y"]
  local var5 = var1["z"]
  local var6 = var2["x"]
  var6 = var6 - var3
  local var7 = var2["y"]
  var7 = var7 - var4
  local var8 = var2["z"]
  var8 = var8 - var5
  local var29 = var1["x"]
  if var6 ~= 0 or var7 ~= 0 and  var23 == var29 and  var8 ~= 0 then var9 = var0["x"]

var23 == var29 should not change var3 to var23 because it was not used in its code block.

@ferib ferib added the Decompiler Decompiler label Mar 6, 2021
@ferib
Copy link
Owner Author

ferib commented Mar 6, 2021

Same result for TEST and TESTSET

var113 = var11 ^ 2
if var1 == nil or not var113 then var3 = 1
end
local sqTolerance = tolerance ~= nil and tolerance^2 or 1

@ferib
Copy link
Owner Author

ferib commented Mar 13, 2021

Should be fixed in #13, Still needs testing.
PR will remain until testers have confirmed.

@ferib
Copy link
Owner Author

ferib commented Mar 13, 2021

local function unknown1(var0, var1, var2)
	local var3 = var1["x"]
	local var4 = var1["y"]
	local var5 = var1["z"]
	local var6 = var2["x"]
	var6 = var6 - var3
	local var7 = var2["y"]
	var7 = var7 - var4
	local var8 = var2["z"]
	var8 = var8 - var5
	local var9 = var1["x"]
	if var6 ~= 0 or var7 ~= 0 and  var3 == var29 and  var8 ~= 0 then

Looks like local var9 = var1["x"] is no longer modified to local var29 nor is it copied to var29 = var9.

@ferib ferib added this to the v2 milestone Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Decompiler Decompiler
Projects
None yet
Development

No branches or pull requests

1 participant