[AlignFromAssume] Bailout w/non-constant alignments (pr51680)
authorPhilip Reames <listmail@philipreames.com>
Tue, 31 Aug 2021 16:17:36 +0000 (09:17 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 31 Aug 2021 16:20:52 +0000 (09:20 -0700)
commit9b45fd909ffa754acbb4e927bc2d55c7ab0d4e3f
treea6766020aa4a4bf829e71cd5984bb1895a4bfa51
parent8442967fe32453ada32913d1e0fdd97b19520df2
[AlignFromAssume] Bailout w/non-constant alignments (pr51680)

This is a bailout for pr51680.  This pass appears to assume that the alignment operand to an align tag on an assume bundle is constant.  This doesn't appear to be required anywhere, and clang happily generates non-constant alignments for cases such as this case taken from the bug report:

// clang -cc1 -triple powerpc64-- -S -O1 opal_pci-min.c
extern int a[];
long *b;
long c;
void *d(long, int *, int, long, long, long) __attribute__((__alloc_align__(6)));
void e() {
  b = d(c, a, 0, 0, 5, c);
  b[0] = 0;
}

This was exposed by a SCEV change which allowed a non-constant alignment to reach further into the pass' code.  We could generalize the pass, but for now, let's fix the crash.
llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
llvm/test/Transforms/AlignmentFromAssumptions/simple.ll