1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/lib
Philip Reames 10eda0ad7d 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

llvm-svn: 224965
2014-12-29 23:00:57 +00:00
..
Analysis ValueTracking: Small cleanup in ComputeNumSignBits 2014-12-26 09:20:17 +00:00
AsmParser IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
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 Remove unused variable. NFC. 2014-11-06 23:16:57 +00:00
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 Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData llvm-cov: Sink some reporting logic into CoverageMapping 2014-11-14 01:50:32 +00:00
Support Remove unnecessary StringRef->std::string conversion. 2014-12-29 20:59:02 +00:00
TableGen Clean up static analyzer warnings. 2014-12-12 21:48:03 +00:00
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