llvm-6502/lib
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
..
Analysis ValueTracking: Small cleanup in ComputeNumSignBits 2014-12-26 09:20:17 +00:00
AsmParser
Bitcode Fix Visual C++ error "'llvm::make_unique' : ambiguous call to overloaded function". 2014-12-18 10:03:35 +00:00
CodeGen Refactor duplicated code. 2014-12-29 15:18:31 +00:00
DebugInfo [DebugInfo] Move all DWARF headers to the public include directory. 2014-12-19 18:26:33 +00:00
ExecutionEngine [C API] Expose LLVMGetGlobalValueAddress and LLVMGetFunctionAddress. 2014-12-22 18:53:11 +00:00
IR Masked Load/Store - Changed the order of parameters in intrinsics. 2014-12-25 07:49:20 +00:00
IRReader
LineEditor
Linker Finish removing DestroySource. 2014-12-23 19:16:45 +00:00
LTO LTO: Lazy-load LTOModule in local contexts 2014-12-17 22:05:42 +00:00
MC Refactor duplicated code. 2014-12-29 15:18:31 +00:00
Object Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers. 2014-12-23 22:56:39 +00:00
Option
ProfileData
Support Remove unnecessary StringRef->std::string conversion. 2014-12-29 20:59:02 +00:00
TableGen
Target [Hexagon] Adding allocframe, post-increment circular immediate stores, post-increment circular register stores, and bit reversed post-increment stores. 2014-12-29 21:33:45 +00:00
Transforms Refine the notion of MayThrow in LICM to include a header specific version 2014-12-29 23:00:57 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile