[llvm] [LLVM][SelectionDAG] Ensure Constant[FP]SDnode only store references to scalar Constant{Int,FP}. (PR #111005)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 07:49:01 PDT 2024


================
@@ -1678,6 +1678,7 @@ class ConstantSDNode : public SDNode {
       : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, 0, DebugLoc(),
                VTs),
         Value(val) {
+    assert(!isa<VectorType>(val->getType()) && "Unexpected vector type!");
----------------
david-arm wrote:

This is just a thought, but is it worth tying these asserts down even further, i.e.

  assert(val->getType()->isIntegerTy() && "Unexpected type!");

and similarly for the FP node? At the moment, these nodes still won't assert for any other unusual types.

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


More information about the llvm-commits mailing list