[PATCH] D145890: [InstCombine] Generate better code for std::bit_floor from libstdc++

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 12:57:31 PDT 2023


goldstein.w.n accepted this revision.
goldstein.w.n added a comment.
This revision is now accepted and ready to land.

LGTM.

I'm not a maintainer so please way a few days to push to give others a chance
to look it over.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3302
+//
+// The caller must guarantee that X is nonzero.
+static Instruction *foldBitFloorNonzero(Value *N, Value *X,
----------------
One more note:

`X` doesn't actually need to be nonzero. Either `X` nonzero OR `ctlz` with zero->poison (second arg is true):
https://alive2.llvm.org/ce/z/gDJ_yT

Can you just add that is a todo?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145890



More information about the llvm-commits mailing list