[PATCH] D31609: [SystemZ] Fix bitcast of load translation to preserve alignment.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 01:56:35 PDT 2017


jonpa added a comment.

I don't follow how this relates to Offset (which seems to be 1 w or w/out patch)..?

The assert that triggers says 'memvt.getStoreSize() <= MMO->getSize() && "Size mismatch!"', which to me means that when calling getLoad(), the memory operand must have a size that is at least as big as the the size in memory of the load VT.

At trunk, the MMO Size is 1, as indicated on the DAG dump:

  t0: ch = EntryToken
    t27: i32,ch = load<LD1[undef+1], sext from i8> t0, undef:i64, undef:i64
  t22: f32 = bitcast t27

The load is going to load 1 byte (LD1), and then sext to i32.

With the trunk call to getLoad, we try to make a new Load of type f32 with a memory operand of size 1, which triggers the assert.

The patch instead calls getLoad (line 5621) with VT==f32, which calls getLoad (line 5551) with MemVT==f32. This method then creates a new MachineMemOperand of size 'MemVT.getStoreSize()', which is 4. Therefore this works.

This however means we are now loading 4 bytes as a float, instead of 1 byte which is sign-extended and then bitcast. I am guessing this must be wrong, or?


https://reviews.llvm.org/D31609





More information about the llvm-commits mailing list