[llvm] 03a2d00 - AMDGPU: Add compile time hack for hasCFUser
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 6 11:42:19 PST 2020
Author: Matt Arsenault
Date: 2020-02-06T11:41:34-08:00
New Revision: 03a2d0045d2c11f4601bb2cbf5cdd5389ed2d72a
URL: https://github.com/llvm/llvm-project/commit/03a2d0045d2c11f4601bb2cbf5cdd5389ed2d72a
DIFF: https://github.com/llvm/llvm-project/commit/03a2d0045d2c11f4601bb2cbf5cdd5389ed2d72a.diff
LOG: AMDGPU: Add compile time hack for hasCFUser
Assume the control flow intrinsic results are never casted, and early
exit based on the type.
Added:
Modified:
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index ec347cc2eae6..147b2bc15768 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -10868,7 +10868,15 @@ SITargetLowering::getRegClassFor(MVT VT, bool isDivergent) const {
return RC;
}
-static bool hasCFUser(const Value *V, SmallPtrSet<const Value *, 16> &Visited) {
+static bool hasCFUser(const Value *V, SmallPtrSet<const Value *, 16> &Visited,
+ unsigned WaveSize) {
+ // FIXME: We asssume we never cast the mask results of a control flow
+ // intrinsic.
+ // Early exit if the type won't be consistent as a compile time hack.
+ IntegerType *IT = dyn_cast<IntegerType>(V->getType());
+ if (!IT || IT->getBitWidth() != WaveSize)
+ return false;
+
if (!isa<Instruction>(V))
return false;
if (!Visited.insert(V).second)
@@ -10900,7 +10908,7 @@ static bool hasCFUser(const Value *V, SmallPtrSet<const Value *, 16> &Visited) {
}
}
} else {
- Result = hasCFUser(U, Visited);
+ Result = hasCFUser(U, Visited, WaveSize);
}
if (Result)
break;
@@ -10959,5 +10967,5 @@ bool SITargetLowering::requiresUniformRegister(MachineFunction &MF,
}
}
SmallPtrSet<const Value *, 16> Visited;
- return hasCFUser(V, Visited);
+ return hasCFUser(V, Visited, Subtarget->getWavefrontSize());
}
More information about the llvm-commits
mailing list