llvm.org GIT mirror llvm / 7508f94
In my recent change to avoid use of underaligned memory I didn't notice that cpyDest can be mutated in some cases, which would then cause a crash later if indeed the memory was underaligned. This brought down several buildbots, so I guess the underaligned case is much more common than I thought! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165228 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 7 years ago
2 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
691691 bool changedArgument = false;
692692 for (unsigned i = 0; i < CS.arg_size(); ++i)
693693 if (CS.getArgument(i)->stripPointerCasts() == cpySrc) {
694 if (cpySrc->getType() != cpyDest->getType())
695 cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
696 cpyDest->getName(), C);
694 Value *Dest = cpySrc->getType() == cpyDest->getType() ? cpyDest
695 : CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
696 cpyDest->getName(), C);
697697 changedArgument = true;
698 if (CS.getArgument(i)->getType() == cpyDest->getType())
699 CS.setArgument(i, cpyDest);
698 if (CS.getArgument(i)->getType() == Dest->getType())
699 CS.setArgument(i, Dest);
700700 else
701 CS.setArgument(i, CastInst::CreatePointerCast(cpyDest,
702 CS.getArgument(i)->getType(), cpyDest->getName(), C));
701 CS.setArgument(i, CastInst::CreatePointerCast(Dest,
702 CS.getArgument(i)->getType(), Dest->getName(), C));
703703 }
704704
705705 if (!changedArgument)
88 define float @f() {
99 entry:
1010 %a_var = alloca %a
11 %b_var = alloca %b
11 %b_var = alloca %b, align 1
1212 call void @g(%a* %a_var)
1313 %a_i8 = bitcast %a* %a_var to i8*
1414 %b_i8 = bitcast %b* %b_var to i8*
15 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 4, i1 false)
15 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 1, i1 false)
1616 %tmp1 = getelementptr %b* %b_var, i32 0, i32 0
1717 %tmp2 = load float* %tmp1
1818 ret float %tmp2