Skip to content

Commit 2dc2ba9

Browse files
committed
[BitcodeReader] Use poison instead of undef to represent unsupported constexprs in metadata
Metadata that references unsupported constant expressions can be represented with `poison` metadata instead of `undef` metadata.
1 parent 538b8f8 commit 2dc2ba9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,13 +1229,13 @@ static Value *getValueFwdRef(BitcodeReaderValueList &ValueList, unsigned Idx,
12291229

12301230
// This is a reference to a no longer supported constant expression.
12311231
// Pretend that the constant was deleted, which will replace metadata
1232-
// references with undef.
1232+
// references with poison.
12331233
// TODO: This is a rather indirect check. It would be more elegant to use
12341234
// a separate ErrorInfo for constant materialization failure and thread
12351235
// the error reporting through getValueFwdRef().
12361236
if (Idx < ValueList.size() && ValueList[Idx] &&
12371237
ValueList[Idx]->getType() == Ty)
1238-
return UndefValue::get(Ty);
1238+
return PoisonValue::get(Ty);
12391239

12401240
return nullptr;
12411241
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: llvm-dis -expand-constant-exprs < %S/Inputs/constexpr-to-instr-metadata-2.bc | FileCheck %s
22

33
; CHECK-LABEL: define void @_ZN4alsa3pcm3PCM17hw_params_current17hf1c237aece2f69c4E() {
4-
; CHECK: #dbg_value(ptr undef, !4, !DIExpression(DW_OP_LLVM_fragment, 0, 64), !14
4+
; CHECK: #dbg_value(ptr poison, !4, !DIExpression(DW_OP_LLVM_fragment, 0, 64), !14
55

66
; CHECK-LABEL: define void @_ZN4alsa3pcm8HwParams3any17h02a64cfc85ce8a66E() {
7-
; CHECK: #dbg_value(ptr undef, !23, !DIExpression(DW_OP_LLVM_fragment, 0, 64), !28
7+
; CHECK: #dbg_value(ptr poison, !23, !DIExpression(DW_OP_LLVM_fragment, 0, 64), !28
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
; RUN: llvm-dis -expand-constant-exprs < %S/Inputs/constexpr-to-instr-metadata.bc | FileCheck %s
22

33
; CHECK-LABEL: define void @test() {
4-
; CHECK: #dbg_value(i64 undef, !4, !DIExpression(DW_OP_LLVM_fragment, 64, 64), !13
4+
; CHECK: #dbg_value(i64 poison, !4, !DIExpression(DW_OP_LLVM_fragment, 64, 64), !13

0 commit comments

Comments
 (0)