llvm/test/Transforms/GVN/hoist-pr28933.ll
Daniel Berlin 828990c2fc Fix PR 28933
Summary:
This fixes PR 28933 by making sure GVNHoist does not try to recreate memory
accesses when it has not actually moved them.

Reviewers: sebpop

Subscribers: llvm-commits, george.burgess.iv

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:32:43 +00:00

22 lines
838 B
LLVM

; RUN: opt -S -gvn-hoist -verify-memoryssa < %s | FileCheck %s
; Check that we end up with one load and one store, in the right order
; CHECK-LABEL: define void @test_it(
; CHECK: store
; CHECK-NEXT: load
; CHECK-NOT: store
; CHECK-NOT: load
%rec894.0.1.2.3.12 = type { i16 }
@a = external global %rec894.0.1.2.3.12
define void @test_it() {
bb2:
store i16 undef, i16* getelementptr inbounds (%rec894.0.1.2.3.12, %rec894.0.1.2.3.12* @a, i16 0, i32 0), align 1
%_tmp61 = load i16, i16* getelementptr inbounds (%rec894.0.1.2.3.12, %rec894.0.1.2.3.12* @a, i16 0, i32 0), align 1
store i16 undef, i16* getelementptr inbounds (%rec894.0.1.2.3.12, %rec894.0.1.2.3.12* @a, i16 0, i32 0), align 1
%_tmp92 = load i16, i16* getelementptr inbounds (%rec894.0.1.2.3.12, %rec894.0.1.2.3.12* @a, i16 0, i32 0), align 1
ret void
}