@@ -718,14 +718,17 @@ class YkIRWriter {
718
718
// operation into multiple loads (in order to avoid a memory access
719
719
// straddling an alignment boundary on a CPU that disallows such things).
720
720
//
721
- // For now we are going to reject any load that has an alignment value not
722
- // the same as the natural alignment of the type of the data being loaded.
721
+ // For now we let through only loads with an alignment greater-than or
722
+ // equal-to the size of the type of the data being loaded. Such cases are
723
+ // trivially safe, since the codegen will never have to face an unaligned
724
+ // load for these.
725
+ //
723
726
// Eventually we will have to encode the alignment of the load into our IR
724
727
// and have the trace code generator split up the loads where necessary.
725
728
// The same will have to be done for store instructions.
726
729
if (I->isVolatile () || (I->getOrdering () != AtomicOrdering::NotAtomic) ||
727
730
(I->getPointerAddressSpace () != 0 ) ||
728
- (I->getAlign () != DL.getPrefTypeAlign (I->getType ()))) {
731
+ (I->getAlign () < DL.getTypeSizeInBits (I->getType ()) / 8 )) {
729
732
serialiseUnimplementedInstruction (I, FLCtxt, BBIdx, InstIdx);
730
733
return ;
731
734
}
@@ -753,8 +756,8 @@ class YkIRWriter {
753
756
// accesses.
754
757
if (I->isVolatile () || (I->getOrdering () != AtomicOrdering::NotAtomic) ||
755
758
(I->getPointerAddressSpace () != 0 ) ||
756
- (I->getAlign () !=
757
- DL.getPrefTypeAlign (I->getValueOperand ()->getType ()))) {
759
+ (I->getAlign () <
760
+ DL.getTypeSizeInBits (I->getValueOperand ()->getType ()) / 8 )) {
758
761
serialiseUnimplementedInstruction (I, FLCtxt, BBIdx, InstIdx);
759
762
return ;
760
763
}
0 commit comments