llvm-6502/test/Transforms/LICM
Philip Reames 1714ad67bd Refine the notion of MayThrow in LICM to include a header specific version
In LICM, we have a check for an instruction which is guaranteed to execute and thus can't introduce any new faults if moved to the preheader. To handle a function which might unconditionally throw when first called, we check for any potentially throwing call in the loop and give up.

This is unfortunate when the potentially throwing condition is down a rare path. It prevents essentially all LICM of potentially faulting instructions where the faulting condition is checked outside the loop. It also greatly diminishes the utility of loop unswitching since control dependent instructions - which are now likely in the loops header block - will not be lifted by subsequent LICM runs.

define void @nothrow_header(i64 %x, i64 %y, i1 %cond) {
; CHECK-LABEL: nothrow_header
; CHECK-LABEL: entry
; CHECK: %div = udiv i64 %x, %y
; CHECK-LABEL: loop
; CHECK: call void @use(i64 %div)
entry:
  br label %loop
loop: ; preds = %entry, %for.inc
  %div = udiv i64 %x, %y
  br i1 %cond, label %loop-if, label %exit
loop-if:
  call void @use(i64 %div)
  br label %loop
exit:
  ret void
}

The current patch really only helps with non-memory instructions (i.e. divs, etc..) since the maythrow call down the rare path will be considered to alias an otherwise hoistable load.  The one exception is that it does kick in for loads which are known to be invariant without regard to other possible stores, i.e. those marked with either !invarant.load metadata of tbaa 'is constant memory' metadata.

Differential Revision: http://reviews.llvm.org/D6725



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224965 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 23:00:57 +00:00
..
2003-02-26-LoopExitNotDominated.ll
2003-02-27-NestedLoopExitBlocks.ll
2003-02-27-PreheaderExitNodeUpdate.ll
2003-02-27-PreheaderProblem.ll
2003-02-27-StoreSinkPHIs.ll
2003-02-28-PromoteDifferentType.ll
2003-05-02-LoadHoist.ll
2003-12-11-SinkingToPHI.ll
2004-09-14-AliasAnalysisInvalidate.ll
2004-11-17-UndefIndexCrash.ll
2006-09-12-DeadUserOfSunkInstr.ll
2007-05-22-VolatileSink.ll
2007-07-30-AliasSet.ll
2007-09-17-PromoteValue.ll
2007-09-24-PromoteNullValue.ll
2007-10-01-PromoteSafeValue.ll
2008-05-20-AliasSetVAArg.ll
2008-07-22-LoadGlobalConstant.ll
2009-12-10-LICM-Indbr-Crash.ll
2011-04-06-HoistMissedASTUpdate.ll
2011-04-06-PromoteResultOfPromotion.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2011-04-09-RAUW-AST.ll
2011-07-06-Alignment.ll
2014-09-10-doFinalizationAssert.ll
atomics.ll
basictest.ll
crash.ll
debug-value.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
extra-copies.ll
hoist-bitcast-load.ll
hoist-deref-load.ll
hoist-invariant-load.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
hoisting.ll
lcssa-ssa-promoter.ll
no-preheader-test.ll
PR19798.ll
PR21582.ll AliasSetTracker: UnknownInsts should contribute to the refcount 2014-11-19 09:41:05 +00:00
preheader-safe.ll Refine the notion of MayThrow in LICM to include a header specific version 2014-12-29 23:00:57 +00:00
Preserve-LCSSA.ll
promote-order.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
scalar_promote.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
scalar-promote-memmodel.ll
sinking.ll [LICM] Avoind store sinking if no preheader is available 2014-12-02 14:22:34 +00:00
speculate.ll Analysis: Make isSafeToSpeculativelyExecute fire less for divides 2014-11-04 23:49:08 +00:00
volatile-alias.ll