Index: lib/CodeGen/CGCall.cpp =================================================================== --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1804,6 +1804,7 @@ if (TargetDecl->hasAttr()) { FuncAttrs.addAttribute(llvm::Attribute::ReadNone); FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); + FuncAttrs.addAttribute(llvm::Attribute::Speculatable); } else if (TargetDecl->hasAttr()) { FuncAttrs.addAttribute(llvm::Attribute::ReadOnly); FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); Index: test/CodeGen/function-attributes.c =================================================================== --- test/CodeGen/function-attributes.c +++ test/CodeGen/function-attributes.c @@ -44,7 +44,7 @@ // FIXME: We should be setting nounwind on calls. // CHECK: call i32 @f10_t() -// CHECK: [[NUW_RN:#[0-9]+]] +// CHECK: [[NUW_RN_SP:#[0-9]+]] // CHECK: { int __attribute__((const)) f10_t(void); int f10(void) { return f10_t(); } @@ -114,5 +114,5 @@ // CHECK: attributes [[ALIGN]] = { nounwind optsize alignstack=16{{.*}} } // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} } // CHECK: attributes [[NR]] = { noreturn optsize } -// CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone } +// CHECK: attributes [[NUW_RN_SP]] = { nounwind optsize readnone speculatable } // CHECK: attributes [[RT_CALL]] = { optsize returns_twice } Index: test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp =================================================================== --- test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp +++ test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp @@ -5,18 +5,18 @@ // CHECK: define i32 @_Z1fv() [[TF:#[0-9]+]] { int f(void) { - // CHECK: call i32 @_Z1cv() [[NUW_RN_CALL:#[0-9]+]] + // CHECK: call i32 @_Z1cv() [[NUW_RN_SP_CALL:#[0-9]+]] // CHECK: call i32 @_Z1pv() [[NUW_RO_CALL:#[0-9]+]] return c() + p() + t(); } -// CHECK: declare i32 @_Z1cv() [[NUW_RN:#[0-9]+]] +// CHECK: declare i32 @_Z1cv() [[NUW_RN_SP:#[0-9]+]] // CHECK: declare i32 @_Z1pv() [[NUW_RO:#[0-9]+]] // CHECK: declare i32 @_Z1tv() [[TF2:#[0-9]+]] // CHECK: attributes [[TF]] = { {{.*}} } -// CHECK: attributes [[NUW_RN]] = { nounwind readnone{{.*}} } +// CHECK: attributes [[NUW_RN_SP]] = { nounwind readnone speculatable{{.*}} } // CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} } // CHECK: attributes [[TF2]] = { {{.*}} } -// CHECK: attributes [[NUW_RN_CALL]] = { nounwind readnone } +// CHECK: attributes [[NUW_RN_SP_CALL]] = { nounwind readnone speculatable } // CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }