[PATCH] D45490: [ADT] - Add llvm::make_mapped_range

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 09:07:17 PDT 2018


grimar added inline comments.


================
Comment at: include/llvm/ADT/STLExtras.h:208
 private:
-  FuncTy F;
+  Optional<FuncTy> F;
 };
----------------
arichardson wrote:
> Will using Optional here make lld slower with D45166 and a Release+Assertions build?
> Can the compiler optimize away all the Optional assertions? Maybe using `[F](ItTy It) { llvm_unreachable("end() derefeneced"); return F(It); }` is easier to optimize?
I do not think LLD can be slower because of using `Optional` or even something slower than that here.
Speaking about D45166, the number of elements in loops where this is used is always small (we are iterating over linker script tree nodes there).

FWIW, `filter_iterator` also use `Optional`.

Also, I think David is right and it would not work.


https://reviews.llvm.org/D45490





More information about the llvm-commits mailing list