Skip to content

Commit c7afb69

Browse files
committed
[AMDGPU] Avoid calling copyFastMathFlags in wrong context
Calling Instruction::copyFastMathFlags() assumes the caller is FPMathOperator. Avoid calling the function for instructions that are not instances of FPMathOperator.
1 parent f141d1a commit c7afb69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST,
159159
CallInst *NewCall = IC.Builder.CreateCall(I, Args);
160160
NewCall->takeName(&II);
161161
NewCall->copyMetadata(II);
162-
NewCall->copyFastMathFlags(&II);
162+
if (isa<FPMathOperator>(NewCall))
163+
NewCall->copyFastMathFlags(&II);
163164
return IC.replaceInstUsesWith(II, NewCall);
164165
}
165166

0 commit comments

Comments
 (0)