OSDN Git Service

[MemoryBuiltins] Fix an issue with hasNoAliasAttr
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 9 Feb 2016 21:54:18 +0000 (21:54 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 9 Feb 2016 21:54:18 +0000 (21:54 +0000)
commite27b451510e416bbde9489c65e4a68837f36097a
treef69ae696c1b708b03918d0cdbbed9c76b3ef00c9
parent6d94591fc9d6c88a5e939104341f36e69b650d87
[MemoryBuiltins] Fix an issue with hasNoAliasAttr

Summary:
`hasNoAliasAttr` is buggy: it checks to see if the called function has
a `noalias` attribute, which is incorrect since functions are not even
allowed to have the `noalias` attribute.  The comment on its only
caller, `llvm::isNoAliasFn`, makes it pretty clear that the intention
to do the `noalias` check on the return value, and not the callee.

Unfortunately I couldn't find a way to test this upstream -- fixing
this does not change the observable behavior of any of the passes that
use this.  This is not very surprising, since `noalias` does not tell
anything about the contents of the allocated memory (so, e.g., you
still cannot fold loads).  I'll be happy to be proven wrong though.

Reviewers: chandlerc, reames

Subscribers: mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D17037

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260298 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/MemoryBuiltins.cpp