OSDN Git Service

[ConstantHoisting] Avoid hoisting constants in GEPs that index into a struct type.
authorLeo Li <aoli@google.com>
Thu, 29 Jun 2017 17:03:34 +0000 (17:03 +0000)
committerLeo Li <aoli@google.com>
Thu, 29 Jun 2017 17:03:34 +0000 (17:03 +0000)
commit2079d678b5bdb7114c9caad69168696b24bf13ff
tree8fd3e20c5d0e276015f83226242f44959396e83a
parentfe0d5f970c77600e023aea44ae8b7d70b45faed2
[ConstantHoisting] Avoid hoisting constants in GEPs that index into a struct type.

Summary:
Indices for GEPs that index into a struct type should always be
constants. This added more checks in `collectConstantCandidates:` which make
sure constants for GEP pointer type are not hoisted.

This fixed Bug https://bugs.llvm.org/show_bug.cgi?id=33538

Reviewers: ributzka, rnk

Reviewed By: ributzka

Subscribers: efriedma, llvm-commits, srhines, javed.absar, pirama

Differential Revision: https://reviews.llvm.org/D34576

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306704 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Scalar/ConstantHoisting.h
lib/Transforms/Scalar/ConstantHoisting.cpp
test/Transforms/ConstantHoisting/ARM/gep-struct-index.ll [new file with mode: 0644]