---
title: 选项 -fipa-struct-sfc,-fipa-struct-sfc-bitfield,-fipa-struct-sfc-shadow
description: "- -fipa-struct-sfc: 开启结构体静态成员压缩优化，在编译期检查结构体成员存储数据的最大值，对成员的数据类型进行压缩，减小结构体大小。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/compilation/ug-hgcc/kunpenghgcc_06_0082.html
sourcePath: /source/zh/kunpengdevps/compilation/ug-hgcc/kunpenghgcc_06_0082.html
indexId: 8d2cefcfccd1d1f3cbc4d870d79da8b86f08ca531ab25993d515141e3d602c3268
---
# 选项 -fipa-struct-sfc,-fipa-struct-sfc-bitfield,-fipa-struct-sfc-shadow

#### 说明

- -fipa-struct-sfc: 开启结构体静态成员压缩优化，在编译期检查结构体成员存储数据的最大值，对成员的数据类型进行压缩，减小结构体大小。
- -fipa-struct-sfc-bitfield: 结构体静态成员压缩优化子选项，开启后可进一步将目标成员压缩成位域。

图1 结构体静态成员压缩示意图

- -fipa-struct-sfc-shadow: 结构体静态成员压缩优化子选项，开启后使能静态成员隐藏优化，检查结构体中相同类型成员的值是否一致，隐藏重复成员


#### 使用方法

在编译选项中加入：

```
-O3 -flto -flto-partition=one -fipa-struct-reorg=2 -fipa-struct-sfc -fipa-struct-sfc-bitfield -fipa-struct-sfc-shadow
```

- -fipa-struct-sfc选项需要在开启-O3 -flto -flto-partition=one以及-fipa-struct-reorg等级等于2或者更高（或使用-fipa-reorder-fields）的基础上才能使能。
- -fipa-struct-sfc-bitfield, -fipa-struct-sfc-shadow选项需要在开启-fipa-struct-sfc的基础上才能使能。
