[llvm] [DirectX] add GEP i8 legalization (PR #142475)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 14:52:43 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)) {
----------------
farzonl wrote:

Having a Mandela effect moment.  I remember a rule that if the other conditionals  ie the `else if`\ `else` cases go multiple lines then you do put braces on the `if` even if it is one line. But now I can't find documentation on that rule so I'll go ahead and make this change.

https://github.com/llvm/llvm-project/pull/142475


More information about the llvm-commits mailing list