[PATCH] D81758: [WebAssembly] Handle unstackified TEE dest in ExplicitLocals
    Heejin Ahn via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Jun 12 12:41:52 PDT 2020
    
    
  
aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: llvm-commits, sunfish, hiraditya, jgravelle-google, sbc100.
Herald added a project: LLVM.
When created in RegStackify pass, TEE has two detinations, where operand
0 is stackified and operand 1 is not. But it is possible that operand 0
is unstackified in fixUnwindMismatches function in CFGStackify pass when
a nested try-catch-end is introduced. In this case, LOCAL_TEE has lost
its purpose, so we generate LOCAL_TEE as planned when op0 remains
stackified, and generate LOCAL_SET instead if op0 got unstackified.
For example,
1. In RegStackify. (r0 is stackified and r1 is not)
  r0, r1 = tee defreg
  ... use r0 ...
  ... use r1 ...
2. In CFGStackify, r0 may get unstackified
3. In ExplicitLocals,
3-a. If r0 remains stackified, use local.tee as planned:
  r0 = local.tee N defreg
  ...
  ... use r0 ... (from stackified r0)
  ...
  local.get N
  ... use r1 ... (from local.get N)
3-b. If r0 got unstackified, use local.set instead:
  local.set N defrag
  ...
  local.get N
  ... use r0 ... (from local.get N)
  local.get N
  ... use r1 ... (from local.get N)
Repository:
  rG LLVM Github Monorepo
https://reviews.llvm.org/D81758
Files:
  llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
  llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81758.270495.patch
Type: text/x-patch
Size: 13302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200612/b81aea5c/attachment.bin>
    
    
More information about the llvm-commits
mailing list