blob: 7c5700b42954898a90f99cb8de48a58043daf72c [file] [log] [blame]
David Majnemer31195992016-06-19 06:14:56 +00001; RUN: opt -basicaa -load-combine -S < %s | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5define i32 @Load_NegGep(i32* %i){
6 %1 = getelementptr inbounds i32, i32* %i, i64 -1
7 %2 = load i32, i32* %1, align 4
8 %3 = load i32, i32* %i, align 4
9 %4 = add nsw i32 %3, %2
10 ret i32 %4
11; CHECK-LABEL: @Load_NegGep(
12; CHECK: %[[load:.*]] = load i64
13; CHECK: %[[combine_extract_lo:.*]] = trunc i64 %[[load]] to i32
14; CHECK: %[[combine_extract_shift:.*]] = lshr i64 %[[load]], 32
15; CHECK: %[[combine_extract_hi:.*]] = trunc i64 %[[combine_extract_shift]] to i32
16; CHECK: %[[add:.*]] = add nsw i32 %[[combine_extract_hi]], %[[combine_extract_lo]]
17}
18
19