[PATCH] D117110: [InstCombine] try to fold binop with phi operands
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 14 11:25:07 PST 2022
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1297
+ if (!Phi0 || !Phi1 || !Phi0->hasOneUse() || !Phi1->hasOneUse() ||
+ Phi0->getNumOperands() != 2 || Phi1->getNumOperands() != 2)
+ return nullptr;
----------------
Technically, this is wrong.
1. for switch predecessor, we could have more than a single incoming edges
2. This check is backwards. It's not really that it must have exactly two predecessors,
but more that there must be at most a single predecessor with non-constant input value,
otherwise we'd increase instruction count. And for constant incoming values we'll constant-fold.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117110/new/
https://reviews.llvm.org/D117110
More information about the llvm-commits
mailing list