title: Understanding bitcast in LLVM IR
body: <p>I am trying to understand the LLVM IR generated from a C++ program</p>
  
  <pre><code>int add(int *x);
  int func()
  {
          int T;
          T=25;
          return add(&amp;T);    
  }
  </code></pre>
  
  <p>The generated IR is:</p>
  
  <pre><code>define i32 @_Z4funcv() local_unnamed_addr #0 {
  entry:
    %T = alloca i32, align 4
    %0 = bitcast i32* %T to i8*
    call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0) #3
    store i32 25, i32* %T, align 4, !tbaa !2
    %call = call i32 @_Z3addPi(i32* nonnull %T)
    call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0) #3
    ret i32 %call
  }
  </code></pre>
  
  <p>I do not understand this line <code>%0 = bitcast i32* %T to i8*</code>. What is the purpose of converting <code>%T</code> from <code>i32</code> to <code>i8</code>?</p>