[sledge] Refine inlining heuristic to allow casts

Summary:
To avoid code explosion, the frontend emits move instructions for
expressions with more than one use. This diff relaxes this slightly by
allowing duplication of casts.

Reviewed By: bennostein

Differential Revision: D17856384

fbshipit-source-id: 6f6c496ef
master
Josh Berdine 5 years ago committed by Facebook Github Bot
parent d6d65a785a
commit 429fbddeda

@ -324,7 +324,14 @@ let should_inline : Llvm.llvalue -> bool =
match Llvm.use_begin llv with match Llvm.use_begin llv with
| Some use -> ( | Some use -> (
match Llvm.use_succ use with match Llvm.use_succ use with
| Some _ -> false (* do not inline if >= 2 uses *) | Some _ -> (
match Llvm.classify_value llv with
| Instruction
( Trunc | ZExt | SExt | FPToUI | FPToSI | UIToFP | SIToFP
| FPTrunc | FPExt | PtrToInt | IntToPtr | BitCast | AddrSpaceCast
) ->
true (* inline casts *)
| _ -> false (* do not inline if >= 2 uses *) )
| None -> true ) | None -> true )
| None -> true | None -> true

Loading…
Cancel
Save