[PATCH] D85765: [InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 13:01:21 PDT 2020


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/test/CodeGen/arm-mve-intrinsics/dup.c:246
+// CHECK-NEXT:    [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x half> [[DOTSPLAT]], <8 x half> undef
+// CHECK-NEXT:    ret <8 x half> [[TMP2]]
 //
----------------
Does the lowering for these intrinsics need to be adjusted in some way? This looks a bit odd and is possibly not what was intended with this fold gone. @dmgreen 


================
Comment at: llvm/lib/IR/ConstantFold.cpp:804
+  if (isa<UndefValue>(V1) && NotPoison(V2)) return V2;
+  if (isa<UndefValue>(V2) && NotPoison(V1)) return V1;
+
----------------
craig.topper wrote:
> nikic wrote:
> > Why does this not use isGuaranteedNotToBeUndefOrPoison?
> I don't think IR library can depend on the Analysis library.
Oh, right, that makes sense. We'll probably want to extract this at some later point in time.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85765/new/

https://reviews.llvm.org/D85765



More information about the llvm-commits mailing list