[PATCH] D47908: [InstSimplify] add nuw %x, -1 -> -1 fold.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 07:59:18 PDT 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstSimplify/constantfold-add-nuw-allones-to-allones.ll:68
 ; CHECK-LABEL: @add_vec_undef(
-; CHECK-NEXT:    [[RET:%.*]] = add nuw <3 x i8> [[X:%.*]], <i8 -1, i8 undef, i8 -1>
-; CHECK-NEXT:    ret <3 x i8> [[RET]]
+; CHECK-NEXT:    ret <3 x i8> <i8 -1, i8 undef, i8 -1>
 ;
----------------
That's an interesting one. I think I conservatively returned a new, fully defined vector constant in all cases when I was enhancing the pattern matchers to account for undef elements. 

But this looks correct - add with an undef operand returns undef, so we can propagate the existing constant vector value.


Repository:
  rL LLVM

https://reviews.llvm.org/D47908





More information about the llvm-commits mailing list