1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -function-specialization -force-function-specialization -S < %s | FileCheck %s 3 4; Check that we don't crash and specialise on a constant expression. 5 6%struct.pluto = type { %struct.spam } 7%struct.quux = type { i16 } 8%struct.spam = type { i16 } 9 10@global.5 = external dso_local global [4 x %struct.pluto], align 1 11@global.12 = external global %struct.quux, align 1 12 13define internal i16 @wobble.972(%struct.quux* byval(%struct.quux) align 1 %arg, i16 %arg1, %struct.spam* byval(%struct.spam) align 1 %arg2, %struct.quux* byval(%struct.quux) align 1 %arg3) #4 { 14; CHECK-LABEL: @wobble.972( 15; CHECK-NEXT: bb: 16; CHECK-NEXT: [[TMP34:%.*]] = bitcast %struct.spam* [[ARG2:%.*]] to i16* 17; CHECK-NEXT: unreachable 18; 19bb: 20 %tmp34 = bitcast %struct.spam* %arg2 to i16* 21 unreachable 22} 23 24define internal i16 @snork() { 25; CHECK-LABEL: @snork( 26; CHECK-NEXT: bb4: 27; CHECK-NEXT: [[TMP:%.*]] = call i16 @wobble.972(%struct.quux* byval([[STRUCT_QUUX:%.*]]) align 1 undef, i16 undef, %struct.spam* byval([[STRUCT_SPAM:%.*]]) align 1 getelementptr inbounds ([4 x %struct.pluto], [4 x %struct.pluto]* @global.5, i32 0, i32 3, i32 0), %struct.quux* byval([[STRUCT_QUUX]]) align 1 @global.12) 28; CHECK-NEXT: unreachable 29; 30bb4: 31 %tmp = call i16 @wobble.972(%struct.quux* byval(%struct.quux) align 1 undef, i16 undef, %struct.spam* byval(%struct.spam) align 1 getelementptr inbounds ([4 x %struct.pluto], [4 x %struct.pluto]* @global.5, i32 0, i32 3, i32 0), %struct.quux* byval(%struct.quux) align 1 @global.12) 32 unreachable 33} 34 35define i16 @main() { 36; CHECK-LABEL: @main( 37; CHECK-NEXT: bb: 38; CHECK-NEXT: [[TMP:%.*]] = call i16 @snork() 39; CHECK-NEXT: unreachable 40; 41bb: 42 %tmp = call i16 @snork() 43 unreachable 44} 45