llvm.org GIT mirror llvm / b9224cd
Fix PR 24633 - Handle undef values when parsing standalone constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247145 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Lorenz 5 years ago
3 changed file(s) with 21 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
42274227 switch (ID.Kind) {
42284228 case ValID::t_APSInt:
42294229 case ValID::t_APFloat:
4230 case ValID::t_Undef:
42304231 case ValID::t_Constant:
42314232 case ValID::t_ConstantStruct:
42324233 case ValID::t_PackedConstantStruct: {
179179 store i32 %conv, i32* getelementptr inbounds ([50 x %st], [50 x %st]* @values, i64 0, i64 0, i32 0), align 16
180180 ret void
181181 }
182
183 define i8* @undef_value() {
184 entry:
185 %0 = load i8*, i8** undef, align 8
186 ret i8* %0
187 }
182188 ...
183189 ---
184190 name: test
489495 MOV32mr killed %rax, 1, _, 0, _, %edi, implicit killed %rdi :: (store 4 into `i32* getelementptr inbounds ([50 x %st], [50 x %st]* @values, i64 0, i64 0, i32 0)`, align 16)
490496 RETQ
491497 ...
498 ---
499 name: undef_value
500 tracksRegLiveness: true
501 body: |
502 bb.0.entry:
503 ; CHECK-LABEL: name: undef_value
504 ; CHECK: %rax = MOV64rm undef %rax, 1, _, 0, _ :: (load 8 from `i8** undef`)
505 %rax = MOV64rm undef %rax, 1, _, 0, _ :: (load 8 from `i8** undef`)
506 RETQ %rax
507 ...
9898 ASSERT_TRUE(V);
9999 ASSERT_TRUE(isa(V));
100100
101 V = parseConstantValue("i8** undef", Error, M);
102 ASSERT_TRUE(V);
103 ASSERT_TRUE(isa(V));
104
101105 EXPECT_FALSE(parseConstantValue("duble 3.25", Error, M));
102106 EXPECT_EQ(Error.getMessage(), "expected type");
103107