]> granicus.if.org Git - llvm/commit
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)
commit77cad59acfa86366b877b8c7d4203a21bd635b36
treed9b8c43874f41e105a2cf00d3cd82fd6eb8231a7
parent20fef3d710e448f67fb42b739ad3efe33bb3791d
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314185 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/TargetLibraryInfo.h
lib/Analysis/TargetLibraryInfo.cpp
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/wcslen-1.ll
test/Transforms/InstCombine/wcslen-2.ll
test/Transforms/InstCombine/wcslen-4.ll [new file with mode: 0644]