[PATCH] D37894: [Lint] Avoid failed assertion by fetching the proper pointer type

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 09:42:32 PDT 2017


arsenm added inline comments.


================
Comment at: lib/Analysis/Lint.cpp:684-693
+      // Fetch the proper IntPtrTy. V/CE might be of non-pointer type so we
+      // can't always call getIntPtrType() on its return type.
+      Type *PtrOpTy = nullptr;
+      if (CE->getOpcode() == Instruction::PtrToInt)
+        PtrOpTy = CE->getOperand(0)->getType();
+      else if (CE->getOpcode() == Instruction::IntToPtr)
+        PtrOpTy = CE->getType();
----------------
This is a convoluted way to go about this. This looks like some weird API artifact from before the DataLayout was mandatory. We should change isNoopCast to take the DataLayout instead (it looks like the instruction method version already does this)


https://reviews.llvm.org/D37894





More information about the llvm-commits mailing list