[PATCH] D154725: [SimplifyLibCalls] Fold strcmp for short string literals

Maksim Kita via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 07:18:54 PDT 2023


kitaisreal added a comment.

In D154725#4483022 <https://reviews.llvm.org/D154725#4483022>, @nikic wrote:

> Right, InstCombine is control-flow preserving transform. We don't really have a great place to put such a transform right now, so SimplifyCFG is probably your best bet.

I checked `SimplifyCFG` and if I decide to put transform into this pass, it seems that implementation will look complex and unexpected. It will require to get `TargetLibraryInfo` in `SimplifyCFGPass` and pass it to `simplifyCFG` function in `Local.h`, but this function is called from a lot of places, and it will be unexpected if this function can optimize library calls.
There is `PartiallyInlineLibCallsPass` that currently optimizes `sqrt` function and changes CFG, but it is registered in `CodeGenPassBuilder` and applied during codegen, but I expect that our optimization need to be registered in `PassBuilderPipelines` and applied during common IR optimizations.
Can we move this `PartiallyInlineLibCallsPass` to common IR optimizations, so we can extend it ? Or maybe it is better to create separate pass ?


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

https://reviews.llvm.org/D154725



More information about the llvm-commits mailing list