TargetLibraryInfo: Stop guessing wchar_t size
authorMatthias Braun <matze@braunis.de>
Tue, 26 Sep 2017 02:36:57 +0000 (02:36 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 26 Sep 2017 02:36:57 +0000 (02:36 +0000)
commitcc603ee3d563ca2ae27fb7bf439602a415a91268
tree873d87913405069b5f3754cdb59945e761753820
parentf2c83670f712c67b419fdb03f848e2cfb4e4c918
TargetLibraryInfo: Stop guessing wchar_t size

Usually the frontend communicates the size of wchar_t via metadata and
we can optimize wcslen (and possibly other calls in the future). In
cases without the wchar_size metadata we would previously try to guess
the correct size based on the target triple; however this is fragile to
keep up to date and may miss users manually changing the size via flags.
Better be safe and stop guessing and optimizing if the frontend didn't
communicate the size.

Differential Revision: https://reviews.llvm.org/D38106

llvm-svn: 314185
llvm/include/llvm/Analysis/TargetLibraryInfo.h
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/wcslen-1.ll
llvm/test/Transforms/InstCombine/wcslen-2.ll
llvm/test/Transforms/InstCombine/wcslen-4.ll [new file with mode: 0644]