[PATCH] D119604: AttributorAttributes: avoid a crashing on bad alignments

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 12 01:02:55 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:6346-6347
+      } else {
+        uint64_t AlignInt = APAlign.getValue().getZExtValue();
+        if (AlignInt > llvm::Value::MaximumAlignment || !isPowerOf2_64(AlignInt)) {
+          LLVM_DEBUG(dbgs() << "[H2S] Invalid allocation alignment: " << AlignInt << "\n");
----------------
It's best to avoid conversion to integer, to avoid a crash when the alignment is larger than 64-bit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119604



More information about the llvm-commits mailing list