[PATCH] D53650: [FPEnv] Last BinaryOperator::isFNeg(...) to m_FNeg(...) changes

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 25 08:14:35 PDT 2018


spatel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/FastISel.cpp:1697
 bool FastISel::selectFNeg(const User *I) {
   unsigned OpReg = getRegForValue(BinaryOperator::getFNegArgument(I));
   if (!OpReg)
----------------
cameron.mcinally wrote:
> spatel wrote:
> > Use match() here, so we can get rid of getFNegArgument() too?
> This would have been a weird use of match(...), i.e. ignoring the return value, so I refactored the code to pull the match(...) into selectFNeg(...). This is also a little weird, but seems ok. Thoughts or alternatives?
This seems fine to me (definitely better than having 2 match() calls).


================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1616-1617
+    Value *X;
+    if (match(OpI, m_FNeg(m_Value(X)))) {
+      Value *InnerTrunc = Builder.CreateFPTrunc(X, Ty);
       return BinaryOperator::CreateFNegFMF(InnerTrunc, OpI);
----------------
Did the test that I added fail with this diff?


Repository:
  rL LLVM

https://reviews.llvm.org/D53650





More information about the llvm-commits mailing list