microsoft / llvm-mctoll

llvm-mctoll
Other
816 stars 125 forks source link

[X86-64] Fix memory referencing idiv instructions #117

Closed martin-fink closed 3 years ago

martin-fink commented 3 years ago

Memory referencing instructions like

idiv [rcx]

would be translated as if they were

idiv rcx

i.e. using the address stored in rcx as the divisor, and not performing the memory load. This PR fixes that

bharadwajy commented 3 years ago

Thanks!

With this change, code in raiseDivideInstr(...) that loads from stack is rendered redundant and out-of-place. It should be deleted. Consider including the attached diff on top of this PR. 117-suggested.txt

martin-fink commented 3 years ago

I've applied your diff, thanks!

bharadwajy commented 3 years ago

Thanks! Pulled to master.