[PATCH] Canonicalize addrspacecast between different pointer types.

Jingyue Wu jingyue at google.com
Tue Jun 3 11:41:39 PDT 2014


Hi Matt,

I found an issue with this patch that causes instcombine to run into an
infinite loops.

The test case is attached. The loop begins with the addrspacecast
instruction:

addrspacecast [16 x i32] addrspace(1)* %arr to i32

--> D2186:

%0 = addrspacecast [16 x i32] addrspace(1)* %arr to [16 x i32]*
bitcast [16 x i32]* %0 to i32*

--> visitBitCast

%0 = addrspacecast [16 x i32] addrspace(1)* %arr to [16 x i32]*
getelementptr [16 x i32]* %0, i64 0, i64 0

--> visitGetElementPtr

%0 = getelementptr [16 x i32] addrspace(1)* %arr, i64 0, i64 0
addrspacecast i32 addrspace(1)* %0 to i32*

--> commonPointerCastTransforms

addrspacecast [16 x i32] addrspace(1)* %arr to i32

and we have a loop.

I'll try to figure out the root cause today.

Jingyue

http://reviews.llvm.org/D2186






More information about the llvm-commits mailing list