[PATCH] D88806: [SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 02:59:14 PDT 2020


simon_tatham added a comment.

Hi @lebedev.ri , it looks as if this commit is causing an assertion failure compiling the following example code.

  void bar(void), baz(unsigned);
  
  void foo(char *d, char *s, unsigned n) {
    if ((((unsigned)d | (unsigned)s) & 3) == 0) {
      bar();
    } else {
      unsigned tmp = (unsigned)d - (unsigned)s;
      while (n > tmp) {
        baz(tmp);
        n -= tmp;
      }
    }
  }

Compiling this with

  clang --target=arm-arm-none-eabi -Os -mthumb -march=armv6s-m -S -o - repro.c

causes an assertion failure:

  clang: /data/statham/llvm-project/llvm/lib/Analysis/IVDescriptors.cpp:913: llvm::InductionDescriptor::InductionDescriptor(llvm::Value*, llvm::InductionDescriptor::InductionKind, const llvm::SCEV*, llvm::BinaryOperator*, llvm::SmallVectorImpl<llvm::Instruction*>*): Assertion `(IK == IK_FpInduction || Step->getType()->isIntegerTy()) && "StepValue is not an integer"' failed.

Bisection suggests that this commit introduced it, and reverting this commit causes that code to compile succesfully. Any thoughts?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88806



More information about the llvm-commits mailing list