[PATCH] D115914: [InstCombine] Fold two PHI operands of `or` conditionally.

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 7 09:54:38 PST 2022


aeubanks added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1339
+
+  if (couldSimplifyInBasicBlock(I, PN0_VAL0, PN1_VAL0, PN0_BB0) &&
+      couldSimplifyInBasicBlock(I, PN0_VAL1, PN1_VAL1, PN1_BB1)) {
----------------
aeubanks wrote:
> aeubanks wrote:
> > early return is nicer
> I think even if we only simplify one of the two values it's worth it, don't need to constrict to this to requiring both values to be simplified. can be a TODO though
sorry, we should only do this if the phi block dominates the block where we don't simplify the value to avoid adding an instruction for another code path that doesn't reach the phi block


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115914



More information about the llvm-commits mailing list