mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Make TypeBasedAliasAnalysis default to doing nothing, with a command-line
option to enable it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116722 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
acf50f5136
commit
01b58f637c
@ -32,8 +32,12 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Metadata.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
using namespace llvm;
|
||||
|
||||
// For testing purposes, enable TBAA only via a special option.
|
||||
static cl::opt<bool> EnableTBAA("enable-tbaa");
|
||||
|
||||
namespace {
|
||||
/// TBAANode - This is a simple wrapper around an MDNode which provides a
|
||||
/// higher-level interface by hiding the details of how alias analysis
|
||||
@ -122,6 +126,9 @@ TypeBasedAliasAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AliasAnalysis::AliasResult
|
||||
TypeBasedAliasAnalysis::alias(const Location &LocA,
|
||||
const Location &LocB) {
|
||||
if (!EnableTBAA)
|
||||
return AliasAnalysis::alias(LocA, LocB);
|
||||
|
||||
// Get the attached MDNodes. If either value lacks a tbaa MDNode, we must
|
||||
// be conservative.
|
||||
const MDNode *AM = LocA.TBAATag;
|
||||
@ -168,6 +175,9 @@ TypeBasedAliasAnalysis::alias(const Location &LocA,
|
||||
}
|
||||
|
||||
bool TypeBasedAliasAnalysis::pointsToConstantMemory(const Location &Loc) {
|
||||
if (!EnableTBAA)
|
||||
return AliasAnalysis::pointsToConstantMemory(Loc);
|
||||
|
||||
const MDNode *M = Loc.TBAATag;
|
||||
if (!M) return false;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: opt < %s -basicaa -tbaa -gvn -S | FileCheck %s
|
||||
; RUN: opt < %s -enable-tbaa -basicaa -tbaa -gvn -S | FileCheck %s
|
||||
|
||||
; CHECK: @test0_yes
|
||||
; CHECK: add i8 %x, %x
|
||||
|
Loading…
Reference in New Issue
Block a user