Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm_util/llvm2alive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,10 @@ class llvm2alive_ : public llvm::InstVisitor<llvm2alive_, unique_ptr<Instr>> {
Value **val, bool is_callsite) {
bool precise = true;
for (const llvm::Attribute &llvmattr : aset) {
if (!llvmattr.isEnumAttribute() && !llvmattr.isIntAttribute() &&
!llvmattr.isTypeAttribute())
continue;

switch (llvmattr.getKindAsEnum()) {
case llvm::Attribute::InReg:
attrs.set(ParamAttrs::InReg);
Expand Down
16 changes: 16 additions & 0 deletions tests/alive-tv/attrs/string-param-attr.srctgt.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; string attributes are legal on parameters (LLVM-C frontends emit them as a
; fallback when LLVMGetEnumAttributeKindForName returns 0). handleParamAttrs
; used to call getKindAsEnum() on them, which asserts.
define i32 @src(ptr "foo"="bar" %p) {
%v = load i32, ptr %p
call void @g(ptr "baz"="qux" %p)
ret i32 %v
}

define i32 @tgt(ptr "foo"="bar" %p) {
%v = load i32, ptr %p
call void @g(ptr "baz"="qux" %p)
ret i32 %v
}

declare void @g(ptr)