[PATCH] D108478: [llvm][IR] Add no_cfi constant

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 17:16:11 PDT 2021


pcc added inline comments.


================
Comment at: llvm/lib/IR/Constants.cpp:1966
+
+  auto *ToObj = To->stripPointerCastsAndAliases();
+  assert(isa<GlobalValue>(ToObj) &&
----------------
Shouldn't this use `stripPointerCasts` instead? Otherwise you're potentially replacing this with a different global.


================
Comment at: llvm/lib/IR/Constants.cpp:1970
+
+  if (cast<Constant>(ToObj)->isNullValue())
+    return To;
----------------
Can this ever be true if we're asserting that this is a GlobalValue?


================
Comment at: llvm/lib/Transforms/IPO/LowerTypeTests.cpp:1759
 
-    // Skip block addresses
-    if (isa<BlockAddress>(U.getUser()))
+    // Skip block addresses and no_cfi values
+    if (isa<BlockAddress, NoCFIValue>(U.getUser()))
----------------
Prefer to say why, not what, in this comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108478



More information about the llvm-commits mailing list