[LLVMdev] Why int variable get promoted to i64

陳韋任 chenwj at iis.sinica.edu.tw
Fri Aug 19 02:32:37 PDT 2011


Hi, all

  I found in some cases the int variable get promoted to i64, 
although I think it should i32. I use the online demo
(http://llvm.org/demo). And below is the test case. 

------------- test case -------------
int test(int x[], int y[], int n) {
  int i = 0;
  int sum = 0;
  for ( ; i < n; i++) {
    sum += x[i] * y[i];
  }
  return sum;
}
-------------------------------------

  No matter the optimization level is standard or none, int
varible always get promoted to i64. After some discussions
on IRC, Duncan found GCC also does such promotion. So it's
not LLVM-only optimization.

  Anyone knows why? Thanks.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667




More information about the llvm-dev mailing list