[AArch64/GlobalISel] fcmp true
/ fcmp false
used in and
/ or
branching condition causes crash Unknown FP condition!
#58050
Labels
Description
When
fcmp true
/fcmp false
is used inand
/or
branching condition,llc
crashes with errorUnknown FP condition!
for AArch64 when using GlobalISel.Cause
The direct cause of the problem is that
AArch64GISelUtils::changeFCMPPredToAArch64CC
does not map predicatesCmpInst::FCMP_TRUE
andCmpInst::FCMP_FALSE
to someAArch64CC::CondCode
.The root cause is that the developers might have assumed that
fcmp true
andfcmp false
will be translated to anG_CONSTANT i1
in Generic MIR byIRTranslator
before Instruction Selection. Such an assumption is true in most situations due to the special handling ofCmpInst::FCMP_TRUE
andCmpInst::FCMP_FALSE
inIRTranslator::translateCompare
. However, when such instruction is used in anand
/or
branching condition,IRTranslator::emitSwitchCase
called byIRTranslator::translateBr
will emitG_FCMP floatpred(false)
instruction to Generic MIR here, thus failing the assumption.Minimal Reproduction
https://godbolt.org/z/MMcG6fxer
Code
Stack Trace
The text was updated successfully, but these errors were encountered: