[PATCH] D83752: [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison consider noundef and more operations

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 09:32:34 PDT 2020


nikic added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ValueTracking.h:610
+  /// If IgnorePadding is true, V's paddings are not inspected. If false,
+  /// the paddings should be frozen as well.
   bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
----------------
Why do we need this parameter? Padding only matters for the stored representation of a struct. For SSA struct values, the padding cannot be accessed.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4792
 
-  if (auto *I = dyn_cast<Instruction>(V)) {
-    switch (I->getOpcode()) {
-    case Instruction::GetElementPtr: {
-      auto *GEPI = dyn_cast<GetElementPtrInst>(I);
-      if (!GEPI->isInBounds() && llvm::all_of(GEPI->operands(), OpCheck))
+  if (auto *OverflowOp = dyn_cast<OverflowingBinaryOperator>(V)) {
+    if (!OverflowOp->hasNoSignedWrap() && !OverflowOp->hasNoUnsignedWrap() &&
----------------
Why are some of these checked outside the `dyn_cast<Operator>(V)` below?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83752





More information about the llvm-commits mailing list