[LLVMdev] Replacing types, use of refineAbstractType

Eric McCorkle ericmcc at cs.umass.edu
Tue Aug 3 08:07:08 PDT 2010


I'm working on a personal project which involves lowering a superset of 
LLVM to "vanilla" LLVM.  Part of this involves rewriting types.  I'm 
working off of the 2.6 code base, so this may have been addressed in a bug 
fix.

I'm having trouble with refineAbstractType and recursive types. 
Specifically, I'm creating opaque types to serve as placeholders for the 
final recursive type, then using refineAbstractType to replace the 
placeholders with the actual type.  However, pointers to the opaque type 
aren't being replaced with pointers to the actual type, which causes 
errors further down the line.

For instance, if I had a type:

%t = { %t*, ... }

My pass would begin constructing a new type, say %t_1, and would replace 
all instances of %t with an opaque type, so...

$t_0 = opaque
%t_1 = { %t_0*, ... }

At the end, it calls t_1->refineAbstracType(t_0, t_1) to replace instances 
of t_0 with t_1.  But the resulting type I get is still

%t_1 = { %t_0*, ... }

Is this a bug, or is it supposed to work this way, and I need to do 
something else to accomplish what I'm trying to accomplish?



More information about the llvm-dev mailing list