[PATCH] D54001: [ValueTracking] determine sign of 0.0 from select when matching min/max FP

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 07:50:19 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:4762-4773
+    if (match(FalseVal, m_PosZeroFP()) && !match(TrueVal, m_NegZeroFP())) {
+      if (match(CmpLHS, m_NegZeroFP()))
+        CmpLHS = FalseVal;
+      if (match(CmpRHS, m_NegZeroFP()))
+        CmpRHS = FalseVal;
+    }
+    if (match(FalseVal, m_NegZeroFP()) && !match(TrueVal, m_PosZeroFP())) {
----------------
arsenm wrote:
> This looks big. Can you avoid repeating the same thing for the true and false cases?
Yes, it's a bit ugly. There really are 8 variations to test for from I see, but we can do better by matching with m_AnyZeroFP.
Unfortunately, I left out a potential vector mishap with undefs here, so I need to check for that.


https://reviews.llvm.org/D54001





More information about the llvm-commits mailing list