[PATCH] D107102: [WebAssembly] Add new pass to lower int/ptr conversions of reftypes
    Thomas Lively via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Aug  2 05:47:59 PDT 2021
    
    
  
tlively accepted this revision.
tlively added a comment.
This revision is now accepted and ready to land.
Nice! LGTM with those cleanups applied.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp:63
+    PtrToIntInst *PTI = dyn_cast<PtrToIntInst>(&*I);
+    IntToPtrInst *ITP = PTI ? 0 : dyn_cast<IntToPtrInst>(&*I);
+    if (!(PTI && (WebAssemblyTargetLowering::isFuncrefType(
----------------
`dyn_cast` should be pretty cheap, so I think it would be ok to just unconditionally do this second `dyn_cast` as well.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp:64-67
+    if (!(PTI && (WebAssemblyTargetLowering::isFuncrefType(
+                      PTI->getPointerOperand()->getType()) ||
+                  WebAssemblyTargetLowering::isExternrefType(
+                      PTI->getPointerOperand()->getType()))) &&
----------------
It's probably worth making a `isRefType` helper that checks both of these conditions.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107102/new/
https://reviews.llvm.org/D107102
    
    
More information about the llvm-commits
mailing list