[PATCH] D105901: [InstCombine] Fold (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C, Idx, 0)) (PR50183)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 09:53:55 PDT 2021


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM w/minor comment



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2942
+    Type *ElementType = Gep->getResultElementType();
+    if (Gep->getNumOperands() == 2 && Gep->getPointerOperand() == Base &&
+        Gep->hasOneUse()) {
----------------
Please use early return to reduce nesting.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105901



More information about the llvm-commits mailing list