[PATCH] D105485: [IR] Use a proper type for AttributeList indexing

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 05:44:39 PDT 2021


gchatelet added a comment.

Replying here to my for future self. There's currently a hole in the type system which lets `AttributeIndex` be created from an `unsigned`, this leaves a whole lot of indexing logic deal with the unsafe type, starting with `llvm/utils/TableGen/IntrinsicEmitter.cpp`.
So there is actually much more work to introduce a proper type.

I'm putting this patch on hold for now.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2681
     if (CallerPAL.hasAttrSomewhere(Attribute::StructRet, &SRetIdx) &&
-        SRetIdx > FT->getNumParams())
+        SRetIdx.toArgNo() > FT->getNumParams())
       return false;
----------------
The mistake is here it should be `SRetIdx.rawValue() > FT->getNumParams()` but this leaks the abstraction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105485



More information about the llvm-commits mailing list