[PATCH] D99853: [InstSimplify] Teach isUndefValue to understand const vector with both undef & poison

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 3 22:10:11 PDT 2021


aqjune added inline comments.


================
Comment at: llvm/include/llvm/Analysis/InstructionSimplify.h:146
+        auto *EV = C->getAggregateElement(i);
+        if (!EV || !isa<UndefValue>(EV))
+          return false;
----------------
Dropping null checks caused assertion failures from the following tests:
```
  LLVM :: Transforms/InstCombine/icmp-vec-inseltpoison.ll
  LLVM :: Transforms/InstCombine/icmp-vec.ll
  LLVM :: Transforms/InstCombine/select.ll
  LLVM :: Transforms/InstCombine/sub.ll
  LLVM :: Transforms/InstCombine/vec_shuffle-inseltpoison.ll
  LLVM :: Transforms/InstCombine/vec_shuffle.ll
  LLVM :: Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
  LLVM :: Transforms/InstSimplify/pr33957.ll
```
I investigated a few of them and they were mainly due to ConstExpr having vector types.
But I have no idea whether adding `!isa<ConstantExpr>(C)` is enough to drop the null check... :/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99853



More information about the llvm-commits mailing list