mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Make AliasSetTracker TBAA-aware, enabling TBAA-enabled LICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116743 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/IntrinsicInst.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/AliasSetTracker.h"
|
||||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
@@ -187,9 +188,10 @@ namespace {
|
||||
/// pointerInvalidatedByLoop - Return true if the body of this loop may
|
||||
/// store into the memory location pointed to by V.
|
||||
///
|
||||
bool pointerInvalidatedByLoop(Value *V, unsigned Size) {
|
||||
bool pointerInvalidatedByLoop(Value *V, unsigned Size,
|
||||
const MDNode *TBAAInfo) {
|
||||
// Check to see if any of the basic blocks in CurLoop invalidate *V.
|
||||
return CurAST->getAliasSetForPointer(V, Size).isMod();
|
||||
return CurAST->getAliasSetForPointer(V, Size, TBAAInfo).isMod();
|
||||
}
|
||||
|
||||
bool canSinkOrHoistInst(Instruction &I);
|
||||
@@ -402,7 +404,8 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
|
||||
unsigned Size = 0;
|
||||
if (LI->getType()->isSized())
|
||||
Size = AA->getTypeStoreSize(LI->getType());
|
||||
return !pointerInvalidatedByLoop(LI->getOperand(0), Size);
|
||||
return !pointerInvalidatedByLoop(LI->getOperand(0), Size,
|
||||
LI->getMetadata(LLVMContext::MD_tbaa));
|
||||
} else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
|
||||
// Handle obvious cases efficiently.
|
||||
AliasAnalysis::ModRefBehavior Behavior = AA->getModRefBehavior(CI);
|
||||
|
Reference in New Issue
Block a user