This is an archive of the discontinued LLVM Phabricator instance.

[Mem2Reg] Enable promotion for bitcastable load/store values
AbandonedPublic

Authored by sdmitriev on Jan 16 2019, 2:16 PM.

Details

Summary

This patch enables Mem2Reg to handle loads/stores from/to bitcasted alloca
values as long as the loaded/stored value is bitcastable to the allocated
type (see example below). Such instruction sequences can be introduced by
the InstCombine pass as part of the load canonicalization.

  
%f = alloca float, align 4
...
%0 = getelementptr inbounds float, float* %A, i64 %idx
%1 = bitcast float* %0 to i32*
%2 = load i32, i32* %1, align 4
%3 = bitcast float* %f to i32*
store i32 %2, i32* %3, align 4

Diff Detail

Event Timeline

sdmitriev created this revision.Jan 16 2019, 2:16 PM

The diff does not seem to match the subject.
(also, probably should go do llvm-commits)

This patch is a clang's part of this review https://reviews.llvm.org/D56810

sdmitriev abandoned this revision.Sep 26 2019, 9:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2019, 9:53 AM