Debian Codegraph @

gcc/testsuite/g++.dg/opt/shrink-wrapping-vector-1.C

raw
1 // { dg-do compile { target { { { i?86-*-* x86_64-*-* } && { ! ia32 } } || { powerpc*-*-* aarch64*-*-* riscv*-*-* } } } }
2 // { dg-options "-O2 -fdump-rtl-pro_and_epilogue" }
3 // { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } }
4
5 // PR rtl-optimization/118502
6
7 // The shrink-wrapping should happen around the slow path of vector<int>::push_back,
8 // The fast path is just checking if there is enough space and doing a few stores.
9 // We want to verify that shrink wrapping always happens.
10
11 #include <vector>
12
13 void push_back(std::vector<int>& xs, unsigned char x) {
14 xs.push_back(x);
15 }
16
17 /* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */