[PATCH] D74466: [mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 23:20:48 PST 2020


mehdi_amini added inline comments.


================
Comment at: mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp:389
+  structType = value.getType().dyn_cast<LLVM::LLVMType>();
+  assert(structType && "expected llvm type");
 }
----------------
Something does not line up here: you are using dyn_cast which is supposed to be expecting a possible nullptr as a result, but then you add adding an assert, which implies this is an impossible case...

If you are using the assert just to get a “nicer” crash, then the pattern should be asserting on “isa<>” and using cast<>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74466/new/

https://reviews.llvm.org/D74466





More information about the llvm-commits mailing list