We accidentally used the store alignment for the value operand as well,
which is incorrect and crashed the SPASS application in the test suite.
}
const Value *UseV = U->get();
- if (auto *SI = dyn_cast<StoreInst>(I))
- Alignment = SI->getAlignment();
- else if (auto *LI = dyn_cast<LoadInst>(I))
+ if (auto *SI = dyn_cast<StoreInst>(I)) {
+ if (SI->getPointerOperand() == UseV)
+ Alignment = SI->getAlignment();
+ } else if (auto *LI = dyn_cast<LoadInst>(I))
Alignment = LI->getAlignment();
if (Alignment <= 1)
ret i64* %i2p
}
+; Use the store alignment only for the pointer operand.
+define void @aligned_store(i8* %Value, i8** %Ptr) {
+; ATTRIBUTOR: define void @aligned_store(i8* nofree writeonly %Value, i8** nocapture nofree nonnull writeonly align 32 dereferenceable(8) %Ptr)
+ store i8* %Value, i8** %Ptr, align 32
+ ret void
+}
+
attributes #0 = { nounwind uwtable noinline }
attributes #1 = { uwtable noinline }
attributes #2 = { "null-pointer-is-valid"="true" }