[llvm] r206093 - Reenable use of TBAA during CodeGen

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue Apr 15 06:12:48 PDT 2014


Thanks!

Hal Finkel <hfinkel at anl.gov> writes:
> Author: hfinkel
> Date: Fri Apr 11 20:26:00 2014
> New Revision: 206093
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206093&view=rev
> Log:
> 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.
>
> Modified:
>     llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
>     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>     llvm/trunk/test/CodeGen/PowerPC/aa-tbaa.ll
>     llvm/trunk/test/CodeGen/SystemZ/alias-01.ll
>
> Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=206093&r1=206092&r2=206093&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
> +++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Fri Apr 11 20:26:00 2014
> @@ -45,14 +45,8 @@ static cl::opt<bool> EnableAASchedMI("en
>      cl::ZeroOrMore, cl::init(false),
>      cl::desc("Enable use of AA during MI GAD construction"));
>
> -// FIXME: Enable the use of TBAA. There are two known issues preventing this:
> -//   1. Stack coloring does not update TBAA when merging allocas
> -//   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.
>  static cl::opt<bool> UseTBAA("use-tbaa-in-sched-mi", cl::Hidden,
> -    cl::init(false), cl::desc("Enable use of TBAA during MI GAD construction"));
> +    cl::init(true), cl::desc("Enable use of TBAA during MI GAD construction"));
>
>  ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &mf,
>                                       const MachineLoopInfo &mli,
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=206093&r1=206092&r2=206093&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Apr 11 20:26:00 2014
> @@ -56,14 +56,8 @@ namespace {
>      CombinerGlobalAA("combiner-global-alias-analysis", cl::Hidden,
>                 cl::desc("Enable DAG combiner's use of IR alias analysis"));
>
> -// FIXME: Enable the use of TBAA. There are two known issues preventing this:
> -//   1. Stack coloring does not update TBAA when merging allocas
> -//   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.
>    static cl::opt<bool>
> -    UseTBAA("combiner-use-tbaa", cl::Hidden, cl::init(false),
> +    UseTBAA("combiner-use-tbaa", cl::Hidden, cl::init(true),
>                 cl::desc("Enable DAG combiner's use of TBAA"));
>
>  #ifndef NDEBUG
>
> Modified: llvm/trunk/test/CodeGen/PowerPC/aa-tbaa.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/aa-tbaa.ll?rev=206093&r1=206092&r2=206093&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/PowerPC/aa-tbaa.ll (original)
> +++ llvm/trunk/test/CodeGen/PowerPC/aa-tbaa.ll Fri Apr 11 20:26:00 2014
> @@ -1,4 +1,4 @@
> -; RUN: llc -enable-misched -misched=shuffle -enable-aa-sched-mi -post-RA-scheduler=0 -mcpu=ppc64 < %s | FileCheck %s
> +; 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
>
>  ; REQUIRES: asserts
>  ; -misched=shuffle is NDEBUG only!
>
> Modified: llvm/trunk/test/CodeGen/SystemZ/alias-01.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/alias-01.ll?rev=206093&r1=206092&r2=206093&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/SystemZ/alias-01.ll (original)
> +++ llvm/trunk/test/CodeGen/SystemZ/alias-01.ll Fri Apr 11 20:26:00 2014
> @@ -2,9 +2,6 @@
>  ;
>  ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
>
> -; The use of TBAA in CodeGen has been temporarily disabled pending correctness fixes.
> -; XFAIL: *
> -
>  ; Check that there are no spills.
>  define void @f1(<16 x i32> *%src1, <16 x float> *%dest) {
>  ; CHECK-LABEL: f1:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list