Skip to content
Commit 488ec975 authored by Max Kazantsev's avatar Max Kazantsev
Browse files

Reapply "[GVN] Prevent LoadPRE from hoisting across instructions that don't...

Reapply "[GVN] Prevent LoadPRE from hoisting across instructions that don't pass control flow to successors"

This patch fixes the miscompile that happens when PRE hoists loads across guards and
other instructions that don't always pass control flow to their successors. PRE is now prohibited
to hoist across such instructions because there is no guarantee that the load standing after such
instruction is still valid before such instruction. For example, a load from under a guard may be
invalid before the guard in the following case:
  int array[LEN];
  ...
  guard(0 <= index && index < LEN);
  use(array[index]);

Differential Revision: https://reviews.llvm.org/D37460

llvm-svn: 316975
parent 39a8dbff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment