1; RUN: llc < %s | FileCheck %s
2
3; Test to make sure that if math that can roll over has been used we don't
4; use the potential overflow as the basis for an address calculation later by
5; sinking it into a different basic block.
6
7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-apple-macosx10.9.0"
9
10; Function Attrs: nounwind ssp uwtable
11define void @test_sink(i8* %arg1, i32 %arg2, i8 %arg3) #0 {
12  %tmp1 = add i32 -2147483648, %arg2
13  %tmp2 = add i32 -2147483648, %tmp1
14  %tmp3 = getelementptr i8* %arg1, i32 %arg2
15  br label %bb1
16
17bb1:
18  %tmp4 = getelementptr i8* %arg1, i32 %tmp2
19  store i8 %arg3, i8* %tmp4
20  ret void;
21}
22
23; CHECK-LABEL: test_sink:
24; CHECK:   movslq  %esi, [[TEMP:%[a-z0-9]+]]
25; CHECK:   movb    %dl, (%rdi,[[TEMP]])
26; CHECK:   retq
27