Home | History | Annotate | Download | only in LoadCombine
      1 ; RUN: opt -basicaa -load-combine -instcombine -S < %s | FileCheck %s
      2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      3 target triple = "x86_64-unknown-linux-gnu"
      4 
      5 define i64 @test1(i32* nocapture readonly noalias %a, i32* nocapture readonly noalias %b) {
      6 ; CHECK-LABEL: @test1
      7 
      8 ; CHECK: load i64, i64*
      9 ; CHECK: ret i64
     10 
     11   %load1 = load i32, i32* %a, align 4
     12   %conv = zext i32 %load1 to i64
     13   %arrayidx1 = getelementptr inbounds i32, i32* %a, i64 1
     14   store i32 %load1, i32* %b, align 4
     15   %load2 = load i32, i32* %arrayidx1, align 4
     16   %conv2 = zext i32 %load2 to i64
     17   %shl = shl nuw i64 %conv2, 32
     18   %add = or i64 %shl, %conv
     19   ret i64 %add
     20 }
     21 
     22 define i64 @test2(i32* nocapture readonly %a, i32* nocapture readonly %b) {
     23 ; CHECK-LABEL: @test2
     24 
     25 ; CHECK: load i32, i32*
     26 ; CHECK: load i32, i32*
     27 ; CHECK: ret i64
     28 
     29   %load1 = load i32, i32* %a, align 4
     30   %conv = zext i32 %load1 to i64
     31   %arrayidx1 = getelementptr inbounds i32, i32* %a, i64 1
     32   store i32 %load1, i32* %b, align 4
     33   %load2 = load i32, i32* %arrayidx1, align 4
     34   %conv2 = zext i32 %load2 to i64
     35   %shl = shl nuw i64 %conv2, 32
     36   %add = or i64 %shl, %conv
     37   ret i64 %add
     38 }
     39 
     40