[PATCH] D48803: Place the BlockAddress type in the program address space

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 30 06:26:17 PDT 2018


arichardson created this revision.
arichardson added reviewers: bjope, dylanmckay, theraven, arsenm.
Herald added subscribers: llvm-commits, wdng.

While this should not matter for most architectures (where the program
address space is 0), it is important for CHERI. We use address space 200
for all of our code pointers and without this change we assert in
SelectionDAG handling of BlockAddress nodes.


Repository:
  rL LLVM

https://reviews.llvm.org/D48803

Files:
  lib/IR/Constants.cpp


Index: lib/IR/Constants.cpp
===================================================================
--- lib/IR/Constants.cpp
+++ lib/IR/Constants.cpp
@@ -1409,8 +1409,10 @@
 }
 
 BlockAddress::BlockAddress(Function *F, BasicBlock *BB)
-: Constant(Type::getInt8PtrTy(F->getContext()), Value::BlockAddressVal,
-           &Op<0>(), 2) {
+    : Constant(Type::getInt8PtrTy(
+                   F->getContext(),
+                   F->getParent()->getDataLayout().getProgramAddressSpace()),
+               Value::BlockAddressVal, &Op<0>(), 2) {
   setOperand(0, F);
   setOperand(1, BB);
   BB->AdjustBlockAddressRefCount(1);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48803.153628.patch
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180630/e92339ea/attachment.bin>


More information about the llvm-commits mailing list