Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit e13b87c

Browse files
author
Hal Finkel
committed
Reenable use of TBAA during CodeGen
We had disabled use of TBAA during CodeGen (even when otherwise using AA) because the ptrtoint/inttoptr used by CGP for address sinking caused BasicAA to miss basic type punning that it should catch (and, thus, we'd fail to override TBAA when we should). However, when AA is in use during CodeGen, CGP now uses normal GEPs and bitcasts, instead of ptrtoint/inttoptr, when doing address sinking. As a result, BasicAA should be able to make us do the right thing in the face of type-punning, and it seems safe to enable use of TBAA again. self-hosting seems fine on PPC64/Linux on the P7, with TBAA enabled and -misched=shuffle. Note: We still don't update TBAA when merging stack slots, although because BasicAA should now catch all such cases, this is no longer a blocking issue. Nevertheless, I plan to commit code to deal with this properly in the near future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206093 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 24517d0 commit e13b87c

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

lib/CodeGen/ScheduleDAGInstrs.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ static cl::opt<bool> EnableAASchedMI("enable-aa-sched-mi", cl::Hidden,
4545
cl::ZeroOrMore, cl::init(false),
4646
cl::desc("Enable use of AA during MI GAD construction"));
4747

48-
// FIXME: Enable the use of TBAA. There are two known issues preventing this:
49-
// 1. Stack coloring does not update TBAA when merging allocas
50-
// 2. CGP inserts ptrtoint/inttoptr pairs when sinking address computations.
51-
// Because BasicAA does not handle inttoptr, we'll often miss basic type
52-
// punning idioms that we need to catch so we don't miscompile real-world
53-
// code.
5448
static cl::opt<bool> UseTBAA("use-tbaa-in-sched-mi", cl::Hidden,
55-
cl::init(false), cl::desc("Enable use of TBAA during MI GAD construction"));
49+
cl::init(true), cl::desc("Enable use of TBAA during MI GAD construction"));
5650

5751
ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &mf,
5852
const MachineLoopInfo &mli,

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,8 @@ namespace {
5656
CombinerGlobalAA("combiner-global-alias-analysis", cl::Hidden,
5757
cl::desc("Enable DAG combiner's use of IR alias analysis"));
5858

59-
// FIXME: Enable the use of TBAA. There are two known issues preventing this:
60-
// 1. Stack coloring does not update TBAA when merging allocas
61-
// 2. CGP inserts ptrtoint/inttoptr pairs when sinking address computations.
62-
// Because BasicAA does not handle inttoptr, we'll often miss basic type
63-
// punning idioms that we need to catch so we don't miscompile real-world
64-
// code.
6559
static cl::opt<bool>
66-
UseTBAA("combiner-use-tbaa", cl::Hidden, cl::init(false),
60+
UseTBAA("combiner-use-tbaa", cl::Hidden, cl::init(true),
6761
cl::desc("Enable DAG combiner's use of TBAA"));
6862

6963
#ifndef NDEBUG

test/CodeGen/PowerPC/aa-tbaa.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -enable-misched -misched=shuffle -enable-aa-sched-mi -post-RA-scheduler=0 -mcpu=ppc64 < %s | FileCheck %s
1+
; RUN: llc -enable-misched -misched=shuffle -enable-aa-sched-mi -use-tbaa-in-sched-mi=0 -post-RA-scheduler=0 -mcpu=ppc64 < %s | FileCheck %s
22

33
; REQUIRES: asserts
44
; -misched=shuffle is NDEBUG only!

test/CodeGen/SystemZ/alias-01.ll

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
;
33
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
44

5-
; The use of TBAA in CodeGen has been temporarily disabled pending correctness fixes.
6-
; XFAIL: *
7-
85
; Check that there are no spills.
96
define void @f1(<16 x i32> *%src1, <16 x float> *%dest) {
107
; CHECK-LABEL: f1:

0 commit comments

Comments
 (0)