[PATCH] D130448: [Reassociate][NFC] Use an appropriate `dyn_cast` for `BinaryOperator`
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 03:44:22 PDT 2022
RKSimon added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:157
static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
- auto *I = dyn_cast<Instruction>(V);
- if (I && I->hasOneUse() && I->getOpcode() == Opcode)
- if (!isa<FPMathOperator>(I) || hasFPAssociativeFlags(I))
- return cast<BinaryOperator>(I);
+ BinaryOperator *BO = dyn_cast<BinaryOperator>(V);
+ if (BO && BO->hasOneUse() && BO->getOpcode() == Opcode)
----------------
(style) use auto *
================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:166
unsigned Opcode2) {
- auto *I = dyn_cast<Instruction>(V);
- if (I && I->hasOneUse() &&
- (I->getOpcode() == Opcode1 || I->getOpcode() == Opcode2))
- if (!isa<FPMathOperator>(I) || hasFPAssociativeFlags(I))
- return cast<BinaryOperator>(I);
+ BinaryOperator *BO = dyn_cast<BinaryOperator>(V);
+ if (BO && BO->hasOneUse() &&
----------------
(style) use auto *
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130448/new/
https://reviews.llvm.org/D130448
More information about the llvm-commits
mailing list