This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Fix insertion position of addrspace cast for alloca
ClosedPublic

Authored by yaxunl on Oct 27 2017, 7:59 AM.

Details

Summary

For non-zero alloca addr space, alloca is usually casted to default addr
space immediately.

For non-vla, alloca is inserted at AllocaInsertPt, therefore the addr
space cast should also be insterted at AllocaInsertPt. However,
for vla, alloca is inserted at the current insertion point of IRBuilder,
therefore the addr space cast should also inserted at the current
insertion point of IRBuilder.

Currently clang always insert addr space cast at AllocaInsertPt, which
causes invalid IR.

This patch fixes that.

Diff Detail

Repository
rL LLVM

Event Timeline

yaxunl created this revision.Oct 27 2017, 7:59 AM
This revision is now accepted and ready to land.Oct 29 2017, 11:37 PM
This revision was automatically updated to reflect the committed changes.