diff options
author | Dave Airlie <[email protected]> | 2018-11-19 13:00:36 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-11-21 08:54:25 +1000 |
commit | ec9fe8abc730c890a76ffb6d01a3ec1099ddf264 (patch) | |
tree | 126ae53361caab4b0ff44ef9cb8b15f02d4a3361 /src/amd/common/ac_llvm_build.c | |
parent | a999798daad7181110922a7e756eb1d8dfe55c4e (diff) |
ac: avoid casting pointers on bcsel and stores
For variable pointers we really don't want to case the pointers to int
without a good reason, just add a wrapper for bcsel loading and result
storing.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 22245aadba1..abc18da13db 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -229,6 +229,15 @@ ac_to_integer(struct ac_llvm_context *ctx, LLVMValueRef v) return LLVMBuildBitCast(ctx->builder, v, ac_to_integer_type(ctx, type), ""); } +LLVMValueRef +ac_to_integer_or_pointer(struct ac_llvm_context *ctx, LLVMValueRef v) +{ + LLVMTypeRef type = LLVMTypeOf(v); + if (LLVMGetTypeKind(type) == LLVMPointerTypeKind) + return v; + return ac_to_integer(ctx, v); +} + static LLVMTypeRef to_float_type_scalar(struct ac_llvm_context *ctx, LLVMTypeRef t) { if (t == ctx->i16 || t == ctx->f16) |