Fixed codegen for threadprivate variables with the redeclarations.