[PATCH] D111237: [TypePromotion] Promote PHI + [SZ]Ext

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 16:09:18 PST 2022


adriantong1024 added inline comments.


================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:146
   unsigned RegisterBitWidth = 0;
-  SmallPtrSet<Value*, 16> AllVisited;
-  SmallPtrSet<Instruction*, 8> SafeToPromote;
-  SmallVector<Instruction*, 4> SafeWrap;
+  SmallPtrSet<Value *, 16> AllVisited;
+  SmallPtrSet<Instruction *, 8> SafeToPromote;
----------------
Should we change this in a separate patch, its not the intend of this patch to change how these structs are declared.


================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:981
+          if (Id != Intrinsic::masked_load) {
+            Transform = false;
+            break;
----------------
dmgreen wrote:
> I think you may be able to turn any `Transform = false; break;` into `return false;`
I agree with @dmgreen here. Once Transform becomes false, it cant become true and we end up return from this function. So should return early.


================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:985
+          masked = true;
+        } else if (LoadI->getOpcode() != Instruction::Load) {
+          Transform = false;
----------------
can we do isa<LoadInst> here ? I also see you use getOpcode() in other places. Isn't the standard way isa cast ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111237/new/

https://reviews.llvm.org/D111237



More information about the llvm-commits mailing list