mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 01:43:57 +00:00
Fix PR3754: don't mark functions that wrap MallocInst with
the readnone. Since MallocInst is scheduled for deletion it doesn't seem worth doing anything more subtle, such as having mayWriteToMemory return true for MallocInst. llvm-svn: 71077
This commit is contained in:
parent
cc6f71e64c
commit
b71ad70b4e
@ -152,6 +152,11 @@ bool FunctionAttrs::AddReadAttrs(const std::vector<CallGraphNode *> &SCC) {
|
||||
if (I->mayWriteToMemory())
|
||||
// Writes memory. Just give up.
|
||||
return false;
|
||||
|
||||
if (isa<MallocInst>(I))
|
||||
// MallocInst claims not to write memory! PR3754.
|
||||
return false;
|
||||
|
||||
// If this instruction may read memory, remember that.
|
||||
ReadsMemory |= I->mayReadFromMemory();
|
||||
}
|
||||
|
7
test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll
Normal file
7
test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll
Normal file
@ -0,0 +1,7 @@
|
||||
; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep read
|
||||
; PR3754
|
||||
|
||||
define i8* @m(i32 %size) {
|
||||
%tmp = malloc i8, i32 %size ; <i8*> [#uses=1]
|
||||
ret i8* %tmp
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user