llvm-project/llvm/test/Transforms/LoopVectorize/AArch64
George Burgess IV a20352e13e [LoopVectorize] Don't preserve nsw/nuw flags on shrunken ops.
If we're shrinking a binary operation, it may be the case that the new
operations wraps where the old didn't. If this happens, the behavior
should be well-defined. So, we can't always carry wrapping flags with us
when we shrink operations.

If we do, we get incorrect optimizations in cases like:

void foo(const unsigned char *from, unsigned char *to, int n) {
  for (int i = 0; i < n; i++)
    to[i] = from[i] - 128;
}

which gets optimized to:

void foo(const unsigned char *from, unsigned char *to, int n) {
  for (int i = 0; i < n; i++)
    to[i] = from[i] | 128;
}

Because:
- InstCombine turned `sub i32 %from.i, 128` into
  `add nuw nsw i32 %from.i, 128`.
- LoopVectorize vectorized the add to be `add nuw nsw <16 x i8>` with a
  vector full of `i8 128`s
- InstCombine took advantage of the fact that the newly-shrunken add
  "couldn't wrap", and changed the `add` to an `or`.

InstCombine seems happy to figure out whether we can add nuw/nsw on its
own, so I just decided to drop the flags. There are already a number of
places in LoopVectorize where we rely on InstCombine to clean up.

llvm-svn: 305053
2017-06-09 03:56:15 +00:00
..
aarch64-predication.ll [LV] Make test case more robust 2017-04-05 14:34:13 +00:00
aarch64-unroll.ll
arbitrary-induction-step.ll [LV] Unify vector and scalar maps 2016-08-24 18:23:17 +00:00
arm64-unroll.ll
backedge-overflow.ll Re-commit [SCEV] Introduce a guarded backedge taken count and use it in LAA and LV 2016-04-08 14:29:09 +00:00
deterministic-type-shrinkage.ll
gather-cost.ll Second attempt at r285517. 2016-10-31 13:17:31 +00:00
induction-trunc.ll Reapply "[LV] Extend trunc optimization to all IVs with constant integer steps" 2017-02-14 16:28:32 +00:00
interleaved-vs-scalar.ll [Loop Vectorizer] Cost-based decision for vectorization form of memory instruction. 2017-02-08 19:25:23 +00:00
interleaved_cost.ll [TargetTransformInfo] getIntrinsicInstrCost() scalarization estimation improved 2017-03-14 06:35:36 +00:00
lit.local.cfg
loop-vectorization-factors.ll [LoopVectorize] Don't preserve nsw/nuw flags on shrunken ops. 2017-06-09 03:56:15 +00:00
max-vf-for-interleaved.ll [LAA] Rename forwarding conflict detection option (NFC) 2016-05-16 17:00:56 +00:00
no_vector_instructions.ll [LV] Reapply r303763 with fix for PR33193 2017-05-30 19:55:57 +00:00
pr31900.ll [LoopVectorize] Added address space check when analysing interleaved accesses 2017-02-22 18:37:36 +00:00
pr33053.ll Re-commit r302678, fixing PR33053. 2017-05-16 21:29:22 +00:00
predication_costs.ll Reapply "[LV] Enable vectorization of loops with conditional stores by default" 2016-12-16 19:12:02 +00:00
reduction-small-size.ll Re-commit r302678, fixing PR33053. 2017-05-16 21:29:22 +00:00
sdiv-pow2.ll
smallest-and-widest-types.ll [LV] Considier non-consecutive but vectorizable accesses for VF selection 2017-03-02 13:55:05 +00:00
type-shrinkage-insertelt.ll