Revert "[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic...
authorMartin Storsjö <martin@martin.st>
Wed, 4 Nov 2020 06:27:22 +0000 (08:27 +0200)
committerMartin Storsjö <martin@martin.st>
Wed, 4 Nov 2020 06:39:32 +0000 (08:39 +0200)
commit36cf1e7d0e0e8aaea1f33bfa12d7a285756b75ba
tree970b8f0834dcfb982cd9cdefc538c8ef0b622443
parent065047ab01b30ead4c7b618e57266482fb61d901
Revert "[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel shifts"

This reverts commit 59b22e495c15d2830f41381a327f5d6bf49ff416.

That commit broke building for ARM and AArch64, reproducible like this:

$ cat apedec-reduced.c
a;
b(e) {
  int c;
  unsigned d = f();
  c = d >> 32 - e;
  return c;
}
g() {
  int h = i();
  if (a)
    h = h << a | b(a);
  return h;
}
$ clang -target aarch64-linux-gnu -w -c -O3 apedec-reduced.c
clang: ../lib/Transforms/InstCombine/InstructionCombining.cpp:3656: bool llvm::InstCombinerImpl::run(): Assertion `DT.dominates(BB, UserParent) && "Dominance relation broken?"' failed.

Same thing for e.g. an armv7-linux-gnueabihf target.
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
llvm/test/Transforms/AggressiveInstCombine/funnel.ll
llvm/test/Transforms/AggressiveInstCombine/rotate.ll