[PATCH] D115924: [ConstantFolding] Unify handling of load from uniform value

Axel Y. Rivera via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 17 07:02:31 PST 2021


ayrivera added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:718
+    return UndefValue::get(Ty);
+  if (C->isNullValue() && !Ty->isX86_MMXTy() && !Ty->isX86_AMXTy())
+    return Constant::getNullValue(Ty);
----------------
Is there a chance that Ty is not X86_MMX neither X86_AMX and C is NullValue(), but getNullValue doesn't support the type? For example, assume that Ty is a Function type, then in that case getNullValue will default into the llvm_unreachable.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:722
+      (Ty->isIntegerTy() || Ty->isFloatingPointTy() || Ty->isVectorTy()) &&
+      !Ty->isX86_AMXTy() && !Ty->isX86_MMXTy() && !Ty->isPtrOrPtrVectorTy())
+    return Constant::getAllOnesValue(Ty);
----------------
If Ty is integer, or FP, or vector, can it be X86_AMX, X86_MMX or PtrOrPtrVector? Of not, then I think the extra check can be removed.


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

https://reviews.llvm.org/D115924



More information about the llvm-commits mailing list