[PATCH] D46380: [InstSimplify] Adding safety checks for 'shl', 'ashr' and 'lshr'

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 20 18:19:16 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3486
+    return true;
+  const Instruction *I = dyn_cast_or_null<Instruction>(OBO);
+  if (!I)
----------------
dyn_cast_or_null allows OBO to be null, but it was dereferenced on the line above. If PEO can't be null, then this should just be dyn_cast.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3514
+    return true;
+  const Instruction *I = dyn_cast_or_null<Instruction>(PEO);
+  if (!I)
----------------
dyn_cast_or_null allows PEO to be null, but it was dereferenced on the line above. If PEO can't be null, then this should just be dyn_cast.


https://reviews.llvm.org/D46380





More information about the llvm-commits mailing list