// RUN: cir-opt %s -cir-canonicalize -o - | FileCheck %s !s32i = !cir.int module { cir.func @fold_complex_create_test() -> !cir.complex { %0 = cir.alloca !cir.complex, !cir.ptr>, ["__retval"] %1 = cir.alloca !cir.complex, !cir.ptr>, ["c", init] %2 = cir.const #cir.int<1> : !s32i %3 = cir.const #cir.int<2> : !s32i %4 = cir.complex.create %2, %3 : !s32i -> !cir.complex cir.store align(4) %4, %1 : !cir.complex, !cir.ptr> %5 = cir.load align(4) %1 : !cir.ptr>, !cir.complex cir.store align(4) %5, %0 : !cir.complex, !cir.ptr> %6 = cir.load %0 : !cir.ptr>, !cir.complex cir.return %6 : !cir.complex } // CHECK: cir.func{{.*}} @fold_complex_create_test() -> !cir.complex { // CHECK: %[[RET:.*]] = cir.alloca !cir.complex, !cir.ptr>, ["__retval"] // CHECK: %[[INIT:.*]] = cir.alloca !cir.complex, !cir.ptr>, ["c", init] // CHECK: %[[COMPLEX:.*]] = cir.const #cir.const_complex<#cir.int<1> : !s32i, #cir.int<2> : !s32i> : !cir.complex // CHECK: cir.store{{.*}} %[[COMPLEX]], %[[INIT]] : !cir.complex, !cir.ptr> // CHECK: %[[TMP:.*]] = cir.load{{.*}} %[[INIT]] : !cir.ptr>, !cir.complex // CHECK: cir.store{{.*}} %[[TMP:.*]], %[[RET]] : !cir.complex, !cir.ptr> // CHECK: %[[TMP_2:.*]] = cir.load %[[RET]] : !cir.ptr>, !cir.complex // CHECK: cir.return %[[TMP_2]] : !cir.complex // CHECK: } }