llvm.org GIT mirror llvm / 397cd32
Disable the use of TBAA when using AA in CodeGen There are currently two issues, of which I currently know, that prevent TBAA from being correctly usable in CodeGen: 1. Stack coloring does not update TBAA when merging allocas. This is easy enough to fix, but is not the largest problem. 2. CGP inserts ptrtoint/inttoptr pairs when sinking address computations. Because BasicAA does not handle inttoptr, we'll often miss basic type punning idioms that we need to catch so we don't miscompile real-world code (like LLVM). I don't yet have a small test case for this, but this fixes self hosting a non-asserts build of LLVM on PPC64 when using -enable-aa-sched-mi and -misched=shuffle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200093 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 6 years ago
3 changed file(s) with 32 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
4444 cl::ZeroOrMore, cl::init(false),
4545 cl::desc("Enable use of AA during MI GAD construction"));
4646
47 // FIXME: Enable the use of TBAA. There are two known issues preventing this:
48 // 1. Stack coloring does not update TBAA when merging allocas
49 // 2. CGP inserts ptrtoint/inttoptr pairs when sinking address computations.
50 // Because BasicAA does not handle inttoptr, we'll often miss basic type
51 // punning idioms that we need to catch so we don't miscompile real-world
52 // code.
53 static cl::opt UseTBAA("use-tbaa-in-sched-mi", cl::Hidden,
54 cl::init(false), cl::desc("Enable use of TBAA during MI GAD construction"));
55
4756 ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &mf,
4857 const MachineLoopInfo &mli,
4958 const MachineDominatorTree &mdt,
555564
556565 AliasAnalysis::AliasResult AAResult = AA->alias(
557566 AliasAnalysis::Location(MMOa->getValue(), Overlapa,
558 MMOa->getTBAAInfo()),
567 UseTBAA ? MMOa->getTBAAInfo() : 0),
559568 AliasAnalysis::Location(MMOb->getValue(), Overlapb,
560 MMOb->getTBAAInfo()));
569 UseTBAA ? MMOb->getTBAAInfo() : 0));
561570
562571 return (AAResult != AliasAnalysis::NoAlias);
563572 }
5454 static cl::opt
5555 CombinerGlobalAA("combiner-global-alias-analysis", cl::Hidden,
5656 cl::desc("Enable DAG combiner's use of IR alias analysis"));
57
58 // FIXME: Enable the use of TBAA. There are two known issues preventing this:
59 // 1. Stack coloring does not update TBAA when merging allocas
60 // 2. CGP inserts ptrtoint/inttoptr pairs when sinking address computations.
61 // Because BasicAA does not handle inttoptr, we'll often miss basic type
62 // punning idioms that we need to catch so we don't miscompile real-world
63 // code.
64 static cl::opt
65 UseTBAA("combiner-use-tbaa", cl::Hidden, cl::init(false),
66 cl::desc("Enable DAG combiner's use of TBAA"));
5767
5868 #ifndef NDEBUG
5969 static cl::opt
1107811088 int64_t Overlap1 = Size1 + SrcValueOffset1 - MinOffset;
1107911089 int64_t Overlap2 = Size2 + SrcValueOffset2 - MinOffset;
1108011090 AliasAnalysis::AliasResult AAResult =
11081 AA.alias(AliasAnalysis::Location(SrcValue1, Overlap1, TBAAInfo1),
11082 AliasAnalysis::Location(SrcValue2, Overlap2, TBAAInfo2));
11091 AA.alias(AliasAnalysis::Location(SrcValue1, Overlap1,
11092 UseTBAA ? TBAAInfo1 : 0),
11093 AliasAnalysis::Location(SrcValue2, Overlap2,
11094 UseTBAA ? TBAAInfo2 : 0));
1108311095 if (AAResult == AliasAnalysis::NoAlias)
1108411096 return false;
1108511097 }
552552 if (!V)
553553 continue;
554554
555 // FIXME: In order to enable the use of TBAA when using AA in CodeGen,
556 // we'll also need to update the TBAA nodes in MMOs with values
557 // derived from the merged allocas. When doing this, we'll need to use
558 // the same variant of GetUnderlyingObjects that is used by the
559 // instruction scheduler (that can look through ptrtoint/inttoptr
560 // pairs).
561
555562 // We've replaced IR-level uses of the remapped allocas, so we only
556563 // need to replace direct uses here.
557564 if (!isa(V))