brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 37df371 Raw
37 lines · plain
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"3 4; Check that we can find and remove redundant insertvalues5; CHECK-LABEL: foo_simple6; CHECK-NOT: ptr %x, 07define { ptr, i64, i32 } @foo_simple(ptr %x, ptr %y) nounwind {8entry:9  %0 = insertvalue { ptr, i64, i32 } undef, ptr %x, 010  %1 = insertvalue { ptr, i64, i32 } %0, ptr %y, 011  ret { ptr, i64, i32 } %112}13; Check that we can find and remove redundant nodes in insertvalues chain14; CHECK-LABEL: foo_ovwrt_chain15; CHECK-NOT: i64 %y, 116; CHECK-NOT: i32 555, 217define { ptr, i64, i32 } @foo_ovwrt_chain(ptr %x, i64 %y, i64 %z) nounwind {18entry:19  %0 = insertvalue { ptr, i64, i32 } undef, ptr %x, 020  %1 = insertvalue { ptr, i64, i32 } %0, i64 %y, 121  %2 = insertvalue { ptr, i64, i32 } %1, i32 555, 222  %3 = insertvalue { ptr, i64, i32 } %2, i64 %z, 123  %4 = insertvalue { ptr, i64, i32 } %3, i32 777, 224  ret { ptr, i64, i32 } %425}26; Check that we propagate insertvalues only if they are use as the first27; operand (as initial value of aggregate)28; CHECK-LABEL: foo_use_as_second_operand29; CHECK: i16 %x, 030; CHECK: %0, 131define { i8, {i16, i32} } @foo_use_as_second_operand(i16 %x) nounwind {32entry:33  %0 = insertvalue { i16, i32 } undef, i16 %x, 034  %1 = insertvalue { i8, {i16, i32} } undef, { i16, i32 } %0, 135  ret { i8, {i16, i32} } %136}37