Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp =================================================================== --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -10868,6 +10868,10 @@ return RC; } +// FIXME: This is a workaround for DivergenceAnalysis not understanding always +// uniform values (as produced by the mask results of control flow intrinsics) +// used outside of divergent blocks. The phi users need to also be treated as +// always uniform. static bool hasCFUser(const Value *V, SmallPtrSet &Visited) { if (!isa(V)) return false; @@ -10910,32 +10914,13 @@ bool SITargetLowering::requiresUniformRegister(MachineFunction &MF, const Value *V) const { - if (const IntrinsicInst *Intrinsic = dyn_cast(V)) { - switch (Intrinsic->getIntrinsicID()) { - default: - return false; - case Intrinsic::amdgcn_if_break: - return true; - } - } - if (const ExtractValueInst *ExtValue = dyn_cast(V)) { - if (const IntrinsicInst *Intrinsic = - dyn_cast(ExtValue->getOperand(0))) { - switch (Intrinsic->getIntrinsicID()) { - default: - return false; - case Intrinsic::amdgcn_if: - case Intrinsic::amdgcn_else: { - ArrayRef Indices = ExtValue->getIndices(); - if (Indices.size() == 1 && Indices[0] == 1) { - return true; - } - } - } - } - } if (const CallInst *CI = dyn_cast(V)) { if (isa(CI->getCalledValue())) { + // FIXME: This cannot give a correct answer. This should only trigger in + // the case where inline asm returns mixed SGPR and VGPR results, used + // outside the defining block. We don't have a specific result to + // consider, so this assumes if any value is SGPR, the overall register + // also needs to be SGPR. const SIRegisterInfo *SIRI = Subtarget->getRegisterInfo(); ImmutableCallSite CS(CI); TargetLowering::AsmOperandInfoVector TargetConstraints = ParseConstraints(