diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-06-08 19:47:25 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-06-08 19:47:25 +0000 |
commit | 5e370850d451bf78c1f393ec9e3cdabb2a050b40 (patch) | |
tree | c2f991e74850eac47f37eaa0aae63c052c272d22 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 3271d3704a5dc3b5079f5ae1aba24e4c55c3908d (diff) | |
download | bcm5719-llvm-5e370850d451bf78c1f393ec9e3cdabb2a050b40.tar.gz bcm5719-llvm-5e370850d451bf78c1f393ec9e3cdabb2a050b40.zip |
[CGP] don't expand a memcmp with nobuiltin attribute
This matches the behavior used in the SDAG when expanding memcmp.
For reference, we're intentionally treating the earlier fortified call transforms differently after:
https://bugs.llvm.org/show_bug.cgi?id=23093
https://reviews.llvm.org/rL233776
One motivation for not transforming nobuiltin calls is that it can interfere with sanitizers:
https://reviews.llvm.org/D19781
https://reviews.llvm.org/D19801
Differential Revision: https://reviews.llvm.org/D34043
llvm-svn: 305007
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index b9e0e2198e1..708b45810e5 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2406,12 +2406,10 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool& ModifiedDT) { } LibFunc Func; - if (TLInfo->getLibFunc(*CI->getCalledFunction(), Func) && - Func == LibFunc_memcmp) { - if (expandMemCmp(CI, TTI, TLI, DL)) { - ModifiedDT = true; - return true; - } + if (TLInfo->getLibFunc(ImmutableCallSite(CI), Func) && + Func == LibFunc_memcmp && expandMemCmp(CI, TTI, TLI, DL)) { + ModifiedDT = true; + return true; } return false; } |