Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,12 @@ bool AMDGPULibCalls::TDOFold(CallInst *CI, const FuncInfo &FInfo) {
SmallVector<APFloat, 4> Values;
Values.reserve(vecSize);
for (int eltNo = 0; eltNo < vecSize; ++eltNo) {
ConstantFP *eltval =
cast<ConstantFP>(CV->getAggregateElement((unsigned)eltNo));
// A lane may be undef or poison, in which case there is nothing to
// look up in the table.
ConstantFP *eltval = dyn_cast_or_null<ConstantFP>(
CV->getAggregateElement((unsigned)eltNo));
if (!eltval)
return false;
auto MatchingRow = llvm::find_if(tr, [eltval](const TableEntry &entry) {
return eltval->isExactlyValue(entry.input);
});
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-tdo-cos.ll
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ entry:
ret <2 x double> %c
}

; A lane that is not a ConstantFP has nothing to look up in the table.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the comment, ignore the dumb bot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, reverted

define <2 x float> @test_tdo_v2_f32_cos_poison_lane() {
; CHECK-LABEL: define <2 x float> @test_tdo_v2_f32_cos_poison_lane() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[C:%.*]] = call <2 x float> @_Z3cosDv2_f(<2 x float> <float 0.000000e+00, float poison>)
; CHECK-NEXT: ret <2 x float> [[C]]
;
entry:
%c = call <2 x float> @_Z3cosDv2_f(<2 x float> <float 0.000000e+00, float poison>)
ret <2 x float> %c
}

declare float @_Z3cosf(float)
declare <2 x float> @_Z3cosDv2_f(<2 x float>)
declare half @_Z3cosDh(half)
Expand Down
Loading