• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -consthoist < %s | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.9.0"
5
6%T = type { i32, i32, i32, i32 }
7
8define i32 @test1() nounwind {
9; CHECK-LABEL:  @test1
10; CHECK:        %const = bitcast i32 12345678 to i32
11; CHECK-NOT:    %base = inttoptr i32 12345678 to %T*
12; CHECK-NEXT:   %1 = inttoptr i32 %const to %T*
13; CHECK-NEXT:   %addr1 = getelementptr %T, %T* %1, i32 0, i32 1
14; CHECK-NEXT:   %addr2 = getelementptr %T, %T* %1, i32 0, i32 2
15; CHECK-NEXT:   %addr3 = getelementptr %T, %T* %1, i32 0, i32 3
16  %base = inttoptr i32 12345678 to %T*
17  %addr1 = getelementptr %T, %T* %base, i32 0, i32 1
18  %addr2 = getelementptr %T, %T* %base, i32 0, i32 2
19  %addr3 = getelementptr %T, %T* %base, i32 0, i32 3
20  ret i32 12345678
21}
22
23