Skip to content

[HLSL] vector float to int and vec int to float are asserting  #82826

@farzonl

Description

@farzonl
void Fn( int64_t2 p0);

void Call1(half2 p0) {
  Fn3(p0);
}

void Call2(float2 p0) {
  Fn3(p0);
}

doing an int cast when we need to be doing sitofp

static CastInst *llvm::CastInst::Create(Instruction::CastOps, Value *, Type *, const Twine &, Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#10 0x000055690b7b06b1 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) /mnt/DevDrive/projects/llvm-project/llvm/lib/IR/Instructions.cpp:3331:11
#11 0x00005569085869fa llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) /mnt/DevDrive/projects/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2150:19
#12 0x0000556908589832 llvm::IRBuilderBase::CreateIntCast(llvm::Value*, llvm::Type*, bool, llvm::Twine const&) /mnt/DevDrive/projects/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2185:5
void Fn4( float2 p0);

void Call5(int64_t2 p0) {
  Fn4(p0);
}

Need to be doing an int to float cast but we are doing a float to int

#10 0x0000563efc7c7fa1 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) /mnt/DevDrive/projects/llvm-project/llvm/lib/IR/Instructions.cpp:3331:11
#11 0x0000563ef958dfba llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) /mnt/DevDrive/projects/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2150:19
#12 0x0000563ef9866f2f llvm::IRBuilderBase::CreateFPToUI(llvm::Value*, llvm::Type*, llvm::Twine const&) /mnt/DevDrive/projects/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2060:5

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions