2
votes

I try do compile my opencl kernel to llvm IR.

With the following instruction

/home/mypass/llvm/Debug+Asserts/bin/clang -I/home/ian031545/libclc/generic/include -include clc/clc.h -Dcl_clang_storage_class_specifiers -target nvptx--nvidiacl -Xclang -mlink-bitcode-file -Xclang /ian031545/libclc/nvptx--nvidiacl/lib/builtins.bc -S -emit-llvm kernel.cl -o kernel.ll

The opencl kernel's structure look like this

__kernel(){

  if() x[i]=a+b+1
  else x[i]=a+b+2

}

And the llvm IR after using the instruction above look like this

entry: // it perform a+b here , we say c
then part: // it perform c+1
else part: // it perform c+2

Does anyone know why does clang do this kind of optimization here ? ( we say it frontend )

Or it may not be a kind of optimization ?

I don't know why clang do this here , for what purpose ?

Can i ask clang not to do this by adding flag to the instruction above ?

Thanks in advance

1

1 Answers

1
votes

Try using -O0 flag with clang.