From 792d9b57194e51e9cc6805676b082932abeeede0 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Fri, 31 Jan 2020 17:28:25 -0500 Subject: [PATCH] DAG: Check if a value is divergent before requiresUniformRegister This avoids a potentially expensive scan if we already know it doesn't matter. --- llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index fa33400cd4b3..09e4af1b9012 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -387,8 +387,8 @@ unsigned FunctionLoweringInfo::CreateRegs(Type *Ty, bool isDivergent) { } unsigned FunctionLoweringInfo::CreateRegs(const Value *V) { - return CreateRegs(V->getType(), DA && !TLI->requiresUniformRegister(*MF, V) && - DA->isDivergent(V)); + return CreateRegs(V->getType(), DA && DA->isDivergent(V) && + !TLI->requiresUniformRegister(*MF, V)); } /// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the