Skip to content

Commit f7da93e

Browse files
authored
Merge pull request rust-lang#169 from vext01/unsupported-store
Reject unsupported store instructions.
2 parents 9065777 + 9bf8c6b commit f7da93e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,23 @@ class YkIRWriter {
744744

745745
void serialiseStoreInst(StoreInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
746746
unsigned &InstIdx) {
747+
// We don't yet support:
748+
// - volatile store
749+
// - atomic store
750+
// - stores into exotic address spaces
751+
// - potentially misaligned stores
752+
//
753+
// See the comment in `serialiseLoadInst()` for context on misaligned memory
754+
// accesses.
755+
DataLayout DL(&M);
756+
if (I->isVolatile() || (I->getOrdering() != AtomicOrdering::NotAtomic) ||
757+
(I->getPointerAddressSpace() != 0) ||
758+
(I->getAlign() !=
759+
DL.getPrefTypeAlign(I->getValueOperand()->getType()))) {
760+
serialiseUnimplementedInstruction(I, FLCtxt, BBIdx, InstIdx);
761+
return;
762+
}
763+
747764
// opcode:
748765
serialiseOpcode(OpCodeStore);
749766
// value:

0 commit comments

Comments
 (0)