[PATCH] D40604: [GlobalISel][IRTranslator] Fix crash during translation of zero sized loads and stores

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 10:08:55 PST 2017


aemerson added inline comments.


================
Comment at: lib/CodeGen/GlobalISel/IRTranslator.cpp:340-341
 
+  if (DL->getTypeStoreSize(LI.getType()) == 0)
+    return true;
+
----------------
dsanders wrote:
> aemerson wrote:
> > dsanders wrote:
> > > I'm not sure this is correct for the load. If the load result has a use then I'd expect -verify-machineinstrs to complain about a missing def. I think we need to emit an IMPLICIT_DEF.
> > That would require getting an LLT for a zero size type to create a vreg and running into the initial cause of the crash.
> > 
> > Also, is there anything meaningful you can do with the load result? You can't bitcast it to anything (I think?) and storing it won't result in a store being generated, so no instructions are emitted for the verifier.
> You can return them and pass them to functions but that's the only cases I can think of. If we eliminate those uses too then it will LGTM
Yep, returns don't handle this properly either, so I'll fix those too.


Repository:
  rL LLVM

https://reviews.llvm.org/D40604





More information about the llvm-commits mailing list