[PATCH] D91726: [LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 29 23:23:58 PST 2020


lebedev.ri added a comment.

In D91726#2474387 <https://reviews.llvm.org/D91726#2474387>, @pcc wrote:

> It looks like this patch caused an assertion failure:
>
>   $ cat test.ii
>   # 1 "" 3
>   typedef int a;
>   typedef unsigned b;
>   struct c {
>     template <typename d> c(d e) : f(e) {}
>     int f;
>   };
>   struct g {
>     template <typename h, typename ad> g(h e, ad) : ae(e), af(0) {}
>     c ae;
>     c af;
>   };
>   template <typename ag, typename i> auto ah(ag e, i) { return g(e, 0); }
>   class j {
>   public:
>     void k();
>   };
>   class l;
>   class m {
>   public:
>     m(int, l, int);
>   };
>   class l {
>   public:
>     l(int, int);
>   };
>   class n {
>     bool o();
>     int ax;
>   };
>   template <typename> using ay = m;
>   template <typename, typename> using bc = l;
>   class p {
>   public:
>     int *m_fn3();
>     a q();
>   };
>   class r {
>   public:
>     r(int)
>         : bh(0, bc<int, int>(int(), bi), bi), bj(int(), bi), bk(int(), bi),
>           bl(int(), bi) {
>       p bn;
>       int *base = bn.m_fn3();
>       a bo = base == nullptr ?: bn.q();
>       if (bo)
>         for (auto bp = ah(bo, 0); __builtin_expect(bp.ae.f >= bp.af.f, false);)
>           j().k();
>     }
>     int bi;
>     ay<bc<int, int>> bh;
>     bc<int, int> bj;
>     bc<b, bool> bk;
>     bc<b, int> bl;
>   };
>   bool n::o() { r bq(ax); }
>   $ ~/l2/ra/bin/clang -O2 test.ii
>   clang: ../llvm/include/llvm/IR/Instructions.h:2767: llvm::Value *llvm::PHINode::getIncomingValueForBlock(const llvm::BasicBlock *) const: Assertion `Idx >= 0 && "Invalid basic block argument!"' failed.

Thank you for the reproducer, i'll take a look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91726



More information about the llvm-commits mailing list