Skip to content

Commit 884b919

Browse files
committed
Reapply [Hexagon] Use default attributes for intrinsics
The issue that caused the revert has been fixed in: 44bd807 ----- This switches Hexagon intrinsics to use the default attributes (nosync, nofree, nocallback and willreturn). Especially willreturn is needed to prevent optimization regressions in the future. The only intrinsics I've excluded here are the load/store locked intrinsics, which presumably aren't nosync. Differential Revision: https://reviews.llvm.org/D137623
1 parent 966867a commit 884b919

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

llvm/include/llvm/IR/IntrinsicsHexagon.td

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ let TargetPrefix = "hexagon" in {
1919
list<LLVMType> param_types,
2020
list<IntrinsicProperty> properties>
2121
: ClangBuiltin<!strconcat("__builtin_", GCCIntSuffix)>,
22-
Intrinsic<ret_types, param_types, properties>;
22+
DefaultAttrsIntrinsic<ret_types, param_types, properties>;
2323

2424
/// Hexagon_NonGCC_Intrinsic - Base class for bitcode convertible Hexagon
2525
/// intrinsics.
2626
class Hexagon_NonGCC_Intrinsic<list<LLVMType> ret_types,
2727
list<LLVMType> param_types,
2828
list<IntrinsicProperty> properties>
29-
: Intrinsic<ret_types, param_types, properties>;
29+
: DefaultAttrsIntrinsic<ret_types, param_types, properties>;
3030
}
3131

3232
class Hexagon_mem_memmemsi_Intrinsic<string GCCIntSuffix>
@@ -129,19 +129,27 @@ def llvm_ptr32_ty : LLVMPointerType<llvm_i32_ty>;
129129
def llvm_ptr64_ty : LLVMPointerType<llvm_i64_ty>;
130130

131131
// Mark locked loads as read/write to prevent any accidental reordering.
132-
def int_hexagon_L2_loadw_locked :
133-
Hexagon_Intrinsic<"HEXAGON_L2_loadw_locked", [llvm_i32_ty], [llvm_ptr32_ty],
134-
[IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
135-
def int_hexagon_L4_loadd_locked :
136-
Hexagon_Intrinsic<"HEXAGON_L4_loadd_locked", [llvm_i64_ty], [llvm_ptr64_ty],
137-
[IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
138-
139-
def int_hexagon_S2_storew_locked :
140-
Hexagon_Intrinsic<"HEXAGON_S2_storew_locked", [llvm_i32_ty],
141-
[llvm_ptr32_ty, llvm_i32_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
142-
def int_hexagon_S4_stored_locked :
143-
Hexagon_Intrinsic<"HEXAGON_S4_stored_locked", [llvm_i32_ty],
144-
[llvm_ptr64_ty, llvm_i64_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
132+
// These don't use Hexagon_Intrinsic, because they are not nosync, and as such
133+
// cannot use default attributes.
134+
let TargetPrefix = "hexagon" in {
135+
def int_hexagon_L2_loadw_locked :
136+
ClangBuiltin<"__builtin_HEXAGON_L2_loadw_locked">,
137+
Intrinsic<[llvm_i32_ty], [llvm_ptr32_ty],
138+
[IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
139+
def int_hexagon_L4_loadd_locked :
140+
ClangBuiltin<"__builtin__HEXAGON_L4_loadd_locked">,
141+
Intrinsic<[llvm_i64_ty], [llvm_ptr64_ty],
142+
[IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
143+
144+
def int_hexagon_S2_storew_locked :
145+
ClangBuiltin<"__builtin_HEXAGON_S2_storew_locked">,
146+
Intrinsic<[llvm_i32_ty],
147+
[llvm_ptr32_ty, llvm_i32_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
148+
def int_hexagon_S4_stored_locked :
149+
ClangBuiltin<"__builtin_HEXAGON_S4_stored_locked">,
150+
Intrinsic<[llvm_i32_ty],
151+
[llvm_ptr64_ty, llvm_i64_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
152+
}
145153

146154
def int_hexagon_vmemcpy : Hexagon_Intrinsic<"hexagon_vmemcpy",
147155
[], [llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty],

llvm/test/CodeGen/Hexagon/circ-load-isel.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define void @circ2() #0 {
1010
entry:
1111
store i32 0, i32* @l, align 4
1212
%0 = tail call i8* @llvm.hexagon.circ.ldw(i8* undef, i8* undef, i32 150995968, i32 4)
13-
unreachable
13+
ret void
1414
}
1515

1616
declare i8* @llvm.hexagon.circ.ldw(i8*, i8*, i32, i32) #1

llvm/test/CodeGen/Hexagon/select-vector-pred.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ entry:
2121
%3 = tail call <128 x i1> @llvm.hexagon.V6.pred.scalar2.128B(i32 %.sroa.speculated.i13.i.i) #3
2222
%4 = tail call <128 x i1> @llvm.hexagon.V6.pred.and.128B(<128 x i1> undef, <128 x i1> %3) #3
2323
tail call void @llvm.hexagon.V6.vS32b.qpred.ai.128B(<128 x i1> %4, i8* nonnull undef, <32 x i32> undef) #3
24-
unreachable
25-
}
24+
ret void
25+
}
2626

2727
attributes #0 = { nounwind writeonly }
2828
attributes #1 = { nounwind readnone }

0 commit comments

Comments
 (0)