[PATCH] D83829: [IR] Add a few asserts to provide a better failure signature if you try to create a load/store/alloca with no alignment or insertion position
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 18:48:37 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81cfb90f858e: [IR] Add a few asserts to provide a better failure signature if you try to… (authored by craig.topper).
Changed prior to commit:
https://reviews.llvm.org/D83829?vs=278014&id=278043#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83829/new/
https://reviews.llvm.org/D83829
Files:
llvm/lib/IR/Instructions.cpp
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -1262,11 +1262,15 @@
}
static Align computeAllocaDefaultAlign(Type *Ty, BasicBlock *BB) {
+ assert(BB && "Insertion BB cannot be null when alignment not provided!");
+ assert(BB->getParent() &&
+ "BB must be in a Function when alignment not provided!");
const DataLayout &DL = BB->getModule()->getDataLayout();
return DL.getPrefTypeAlign(Ty);
}
static Align computeAllocaDefaultAlign(Type *Ty, Instruction *I) {
+ assert(I && "Insertion position cannot be null when alignment not provided!");
return computeAllocaDefaultAlign(Ty, I->getParent());
}
@@ -1342,11 +1346,15 @@
}
static Align computeLoadStoreDefaultAlign(Type *Ty, BasicBlock *BB) {
+ assert(BB && "Insertion BB cannot be null when alignment not provided!");
+ assert(BB->getParent() &&
+ "BB must be in a Function when alignment not provided!");
const DataLayout &DL = BB->getModule()->getDataLayout();
return DL.getABITypeAlign(Ty);
}
static Align computeLoadStoreDefaultAlign(Type *Ty, Instruction *I) {
+ assert(I && "Insertion position cannot be null when alignment not provided!");
return computeLoadStoreDefaultAlign(Ty, I->getParent());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83829.278043.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/2d5f6d66/attachment.bin>
More information about the llvm-commits
mailing list