[PATCH] D158101: [Verifier] Allow undef/poison in entry_values expressions.
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 06:16:17 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26ea983d228d: [Verifier] Allow undef/poison in entry_values expressions. (authored by fdeazeve).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158101/new/
https://reviews.llvm.org/D158101
Files:
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll
Index: llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll
===================================================================
--- llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll
+++ llvm/test/Verifier/diexpression-entry-value-llvm-ir.ll
@@ -1,14 +1,18 @@
; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
+; CHECK-NOT: llvm.dbg.value
; CHECK: Entry values are only allowed in MIR unless they target a swiftasync Argument
; CHECK: call void @llvm.dbg.value(metadata i32 %param, metadata !{{.*}}, metadata !DIExpression(DW_OP_LLVM_entry_value, 1))
; CHECK-NOT: llvm.dbg.value
+; CHECK-NOT: Entry values are only allowed
; CHECK: warning: ignoring invalid debug info
define void @foo(i32 %param, ptr swiftasync %ok_param) !dbg !4 {
entry:
call void @llvm.dbg.value(metadata i32 %param, metadata !8, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !9
call void @llvm.dbg.value(metadata ptr %ok_param, metadata !8, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !9
+ call void @llvm.dbg.value(metadata ptr poison, metadata !8, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !9
+ call void @llvm.dbg.value(metadata ptr undef, metadata !8, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !9
ret void
}
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -6403,12 +6403,16 @@
if (!E || !E->isValid())
return;
- // We allow EntryValues for swift async arguments, as they have an
- // ABI-guarantee to be turned into a specific register.
- if (isa<ValueAsMetadata>(I.getRawLocation()))
- if (auto *ArgLoc = dyn_cast_or_null<Argument>(I.getVariableLocationOp(0));
+ if (isa<ValueAsMetadata>(I.getRawLocation())) {
+ Value *VarValue = I.getVariableLocationOp(0);
+ if (isa<UndefValue>(VarValue) || isa<PoisonValue>(VarValue))
+ return;
+ // We allow EntryValues for swift async arguments, as they have an
+ // ABI-guarantee to be turned into a specific register.
+ if (auto *ArgLoc = dyn_cast_or_null<Argument>(VarValue);
ArgLoc && ArgLoc->hasAttribute(Attribute::SwiftAsync))
return;
+ }
CheckDI(!E->isEntryValue(),
"Entry values are only allowed in MIR unless they target a "
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158101.551109.patch
Type: text/x-patch
Size: 2323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/1dd0e071/attachment.bin>
More information about the llvm-commits
mailing list