[PATCH] D47983: [IR][PatternMatch] m_APInt(): allow undef elements.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 11:29:56 PDT 2018


spatel requested changes to this revision.
spatel added a comment.
This revision now requires changes to proceed.

On 2nd thought, I confused myself. :)
This patch is potentially dangerous - although it's hard to find cases where that danger propagates. 
As with the earlier undef matcher changes, we have to audit the users to make sure they are not incorrectly using the matcher to propagate a value with undefs where it's not safe.

Example:

  define <3 x i8> @f(<3 x i8> %x) {
    %x1 = or <3 x i8> %x, <i8 8, i8 8, i8 8>
    %r = urem <3 x i8> <i8 7, i8 undef, i8 7>, %x1
    ret <3 x i8> %r
  }

InstSimplify can't return <i8 7, i8 undef, i8 7> here because the return value of the middle element of that vector is not unbounded.


Repository:
  rL LLVM

https://reviews.llvm.org/D47983





More information about the llvm-commits mailing list