[PATCH] D108903: [llvm-reduce] Add reduce operands pass

Samuel Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 16:13:13 PDT 2021


swamulism added a comment.

In D108903#2988173 <https://reviews.llvm.org/D108903#2988173>, @lebedev.ri wrote:

> Also no, that can be separated - place it before `Constant::getNullValue()` / base it on that function,
> and change `Constant::getNullValue()` to first assert that said new function says there is such a constant.
>
> But, i'm still not sold on `null` everywhere. E.g. div-by-zero is ub, `gep inbounds` of `null` w/ non-zero offset is null, etc.

I was thinking to change getNullValue to return nullptr when there is no null value instead of crashing.
Then make hasNullValue to something like the following so the code only needs to be updated in one place.

  bool Constant::hasNullValue(Type *Ty) {
    return getNullValue(Ty) == nullptr;
  }

Also for the null vs undef discussion, llvm-reduce should not reduce using this delta pass if it doesn't pass the interestingness test.
Is the worry that this pass will make the the reduction worse (longer or harder to read)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108903



More information about the llvm-commits mailing list