Break operands into multiple instructions

Hi All,

I am creating an instrumentation pass using LLVM libraries. I am using clang++ (version 2.9) to compile cpp code into LLVM bit code. When I generate the llvm bit code using clang++ using –O3, I get many instances of instructions that look like the following.

br i1 icmp ne (i8* bitcast (i32 (i32)* @pthread_cancel to i8*), i8* null), label %bb23, label %bb25

Here three LLVM instructions are used in one instruction, namely br, icmp and bitcast. Is there a way to tell clang++ to break the operand of br into 3 separate instructions or a pass that exists that does it. Ideally, I would like to see the following

I8* tmp0 = i8* bitcast (i32 (i32)* @pthread_cancel to i8*

I1 tmp = icmp ne i8* tmp0, i8* null

br i1 tmp, label %bb23, label %bb25

Thanks

Sreekumar

Hi All,

I am creating an instrumentation pass using LLVM libraries. I am using clang++ (version 2.9) to compile cpp code into LLVM bit code. When I generate the llvm bit code using clang++ using –O3, I get many instances of instructions that look like the following.

br i1 icmp ne (i8* bitcast (i32 (i32)* @pthread_cancel to i8*), i8* null), label %bb23, label %bb25

Here three LLVM instructions are used in one instruction, namely br, icmp and bitcast. Is there a way to tell clang++ to break the operand of br into 3 separate instructions or a pass that exists that does it. Ideally, I would like to see the following