RESOLVED FIXED 122688
FTL OSR exit should perform zero extension on values smaller than 64-bit
https://bugs.webkit.org/show_bug.cgi?id=122688
Summary FTL OSR exit should perform zero extension on values smaller than 64-bit
Filip Pizlo
Reported 2013-10-11 21:40:26 PDT
In the DFG we usually make the simplistic assumption that a 32-bit value in a 64-bit register will have zeros on the high bits. In the few cases where the high bits are non-zero, the DFG sort of tells us this explicitly. But when working with llvm.webkit.stackmap, it doesn't work that way. Consider we might emit LLVM IR like: %2 = trunc i64 %1 to i32 stuff %2 call @llvm.webkit.stackmap(...., %2) LLVM may never actually emit a truncation instruction of any kind. And that's great - in many cases it won't be needed, like if %2 is a 32-bit op that ignores the high bits anyway. Hence LLVM may tell us that %2 is in the register that still had the value from before truncation, and that register may have garbage in the high bits. This means that on our end, if we want a 32-bit value and we want that value to be zero-extended, we should zero-extend it ourselves. This is pretty easy and should be cheap, so we should just do it and not make it a requirement that LLVM does it on its end.
Attachments
the patch (3.85 KB, patch)
2013-10-11 21:43 PDT, Filip Pizlo
no flags
the patch (3.86 KB, patch)
2013-10-11 21:45 PDT, Filip Pizlo
barraclough: review+
Filip Pizlo
Comment 1 2013-10-11 21:43:25 PDT
Created attachment 214049 [details] the patch
Filip Pizlo
Comment 2 2013-10-11 21:45:16 PDT
Created attachment 214050 [details] the patch Fix changelog.
Nadav Rotem
Comment 3 2013-10-11 22:02:29 PDT
Do you need to do anything about Int52s ?
Filip Pizlo
Comment 4 2013-10-11 22:13:27 PDT
(In reply to comment #3) > Do you need to do anything about Int52s ? In LLVM IR, int52's are always expressed as i64's. So it would be weird if we had to do anything. For example if we have an int52 end up in a stackmap it will be like "stackmap(i64 %myInt52)". Sure, %myInt52 will either have 12 low zero bits or 12 high sign extension bits, but since I'm claiming to be passing an i64, LLVM ought to preserve those since anything else would probably be a violation of IR rules.
Filip Pizlo
Comment 5 2013-10-13 13:44:17 PDT
Note You need to log in before you can comment on or make changes to this bug.