diff options
author | Sanjay Patel <spatel@rotateright.com> | 2020-07-14 10:02:50 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2020-07-14 10:04:24 -0400 |
commit | e6c016420c796ac038b15e1ba0557947bf11d507 (patch) | |
tree | dac525ca110169e57e46e22183b24a2da5a27158 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 9300de4d1cd151828ab2548c242d34d6ad9124d4 (diff) | |
download | llvm-e6c016420c796ac038b15e1ba0557947bf11d507.zip llvm-e6c016420c796ac038b15e1ba0557947bf11d507.tar.gz llvm-e6c016420c796ac038b15e1ba0557947bf11d507.tar.bz2 |
[ValueTracking] fix library to intrinsic mapping to respect 'nobuiltin' attribute
This is another problem raised in:
http://bugs.llvm.org/PR46627
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index ffa2037..43caaa6 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3133,21 +3133,14 @@ Intrinsic::ID llvm::getIntrinsicForCallSite(const CallBase &CB, if (F->isIntrinsic()) return F->getIntrinsicID(); - if (!TLI) - return Intrinsic::not_intrinsic; - + // We are going to infer semantics of a library function based on mapping it + // to an LLVM intrinsic. Check that the library function is available from + // this callbase and in this environment. LibFunc Func; - // We're going to make assumptions on the semantics of the functions, check - // that the target knows that it's available in this environment and it does - // not have local linkage. - if (!F || F->hasLocalLinkage() || !TLI->getLibFunc(*F, Func)) - return Intrinsic::not_intrinsic; - - if (!CB.onlyReadsMemory()) + if (F->hasLocalLinkage() || !TLI || !TLI->getLibFunc(CB, Func) || + !CB.onlyReadsMemory()) return Intrinsic::not_intrinsic; - // Otherwise check if we have a call to a function that can be turned into a - // vector intrinsic. switch (Func) { default: break; |