[llvm] [DirectX] add GEP i8 legalization (PR #142475)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 14:54:22 PDT 2025
================
@@ -175,25 +207,35 @@ static void upcastI8AllocasAndUses(Instruction &I,
Type *SmallestType = nullptr;
- for (User *U : AI->users()) {
- auto *Load = dyn_cast<LoadInst>(U);
- if (!Load)
- continue;
+ auto ProcessLoad = [&](LoadInst *Load) {
for (User *LU : Load->users()) {
Type *Ty = nullptr;
- if (auto *Cast = dyn_cast<CastInst>(LU))
+ if (auto *Cast = dyn_cast<CastInst>(LU)) {
Ty = Cast->getType();
- if (CallInst *CI = dyn_cast<CallInst>(LU)) {
+ } else if (auto *CI = dyn_cast<CallInst>(LU)) {
if (CI->getIntrinsicID() == Intrinsic::memset)
Ty = Type::getInt32Ty(CI->getContext());
}
if (!Ty)
continue;
- if (!SmallestType ||
- Ty->getPrimitiveSizeInBits() < SmallestType->getPrimitiveSizeInBits())
+ if (!SmallestType || Ty->getPrimitiveSizeInBits() <
+ SmallestType->getPrimitiveSizeInBits()) {
----------------
farzonl wrote:
Yes thank you! Vscode did some auto complete funny buisness when was trying to move this into a lambda.
https://github.com/llvm/llvm-project/pull/142475
More information about the llvm-commits
mailing list