// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(ffi_returns_twice)]

pub fn bar() { unsafe { foo() } }

extern {
    #[ffi_returns_twice] pub fn foo();
}
// CHECK: declare void @foo(){{.*}}#1{{.*}}
// CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }

// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(ffi_returns_twice)]

extern {
    // CHECK-LABEL: @foo()
    // CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }
    #[no_mangle]
    #[ffi_returns_twice]
    pub fn foo();
}

pub fn bar() {
    unsafe { foo() }
}

--- 
+++ 
@@ -2,14 +2,10 @@
 #![crate_type = "lib"]
 #![feature(ffi_returns_twice)]
 
+pub fn bar() { unsafe { foo() } }
+
 extern {
-    // CHECK-LABEL: @foo()
-    // CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }
-    #[no_mangle]
-    #[ffi_returns_twice]
-    pub fn foo();
+    #[ffi_returns_twice] pub fn foo();
 }
-
-pub fn bar() {
-    unsafe { foo() }
-}
+// CHECK: declare void @foo(){{.*}}#1{{.*}}
+// CHECK: attributes #1 = { {{.*}}returns_twice{{.*}} }
Use pattern to match attributes
