mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
Reviewed by Eli Friedman. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "llvm/IntrinsicInst.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/MallocHelper.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/PredIteratorCache.h"
|
||||
@@ -233,6 +234,15 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isMalloc(Inst)) {
|
||||
Value *AccessPtr = MemPtr->getUnderlyingObject();
|
||||
|
||||
if (AccessPtr == Inst ||
|
||||
AA->alias(Inst, 1, AccessPtr, 1) == AliasAnalysis::MustAlias)
|
||||
return MemDepResult::getDef(Inst);
|
||||
continue;
|
||||
}
|
||||
|
||||
// See if this instruction (e.g. a call or vaarg) mod/ref's the pointer.
|
||||
switch (AA->getModRefInfo(Inst, MemPtr, MemSize)) {
|
||||
case AliasAnalysis::NoModRef:
|
||||
|
Reference in New Issue
Block a user