[PATCH] D52324: [ValueTracking] Allow select patterns to work on vectors in more places

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 10:44:12 PDT 2018


tlively added inline comments.


================
Comment at: unittests/Analysis/ValueTrackingTest.cpp:163
+  // pattern.
+  expectPattern({SPF_FMINNUM, SPNB_RETURNS_NAN, false});
+}
----------------
aheejin wrote:
> How is the third argument `Ordered` determined?
By the comparison operator. For example, here `ule` is unordered.


================
Comment at: unittests/Analysis/ValueTrackingTest.cpp:193
+  expectPattern({SPF_UNKNOWN, SPNB_NA, false});
+}
+
----------------
aheejin wrote:
> Can we have a few more test cases? I understand here you omitted very basic ones and put only a bit tricky cases that arises from the fact we are dealing with vectors, but having basic ones wouldn't hurt and help understanding. Such as, 1. ordered comparison that results in `SPNB_RETURNS_OTHER` 2. unordered comparison in which the right hand side is all NaNs 
I added a test for ordered comparison returning other, but having a vector of all NaNs currently results in `SPF_UNKNOWN, SPNB_NA`, because this is actually something that can be constant folded, rather than being a min or max. I also tried testing with `undef`s in vector lanes but the same thing happened. I'm not sure if failing to pattern match in the presence of `undef`s was an intentional decision, so I'm inclined not to change it.


Repository:
  rL LLVM

https://reviews.llvm.org/D52324





More information about the llvm-commits mailing list