[PATCH] D63445: [Reassociate] Handle unary FNeg in the Reassociate pass

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 19:52:33 PDT 2019


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:1974
 
   // User must be a binary operator with one or more uses.
   Instruction *User = I->user_back();
----------------
Update comment


================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:1987
   // not valid: (-Constant * y) - x  -> x + (Constant * y)
   if (!User->isCommutative() && User->getOperand(1) != I)
     return nullptr;
----------------
If User is a unary FNeg, I assume isCommutative would be false and this getOperand call will access an operand that doesn't exist.


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

https://reviews.llvm.org/D63445





More information about the llvm-commits mailing list