[PATCH] D28241: [LICM] Untangle some of the logic in LICM canSinkOrHoistInst

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 14:29:52 PST 2017


trentxintong added a comment.

In https://reviews.llvm.org/D28241#634319, @mkuper wrote:

> I'm a bit confused about the distinction between "legal" and "safe". I'd assume them to mean the same thing.


By "legal" I mean the instructions in question is loop invariant, i.e. every iteration of the loop, same value is produced.

By "safe" I mean its safe to speculate the instruction, i.e. the compiler will not create a program that faults given a program that does not fault. In case of hoisting, we can guarantee so by either of the isSafeToSpeculativelyExecute or isGuaranteedToExecute.

I feel word choices can be improved.  "Legal" ==> "Loop Invariant"  and "Safe" ==> "Safe To Execute Unconditionally"


https://reviews.llvm.org/D28241





More information about the llvm-commits mailing list