diff options
author | Justin Lebar <jlebar@google.com> | 2017-10-04 20:47:33 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2017-10-04 20:47:33 +0000 |
commit | d1dce4497d5ba4d67aeb18504113d73e51435466 (patch) | |
tree | ac09705f5ceb3fb09cd498a2dd03fffdfee1a990 /test/Analysis | |
parent | 2766ade041acf8d45a9acaed0edb6271f9fcb4bf (diff) |
Convert an APInt to int64_t properly in TTI::getGEPCost().
Summary:
If the pointer width is 32 bits and the calculated GEP offset is
negative, we call APInt::getLimitedValue(), which does a
*zero*-extension of the offset. That's wrong -- we should do an sext.
Fixes a bug introduced in rL314362 and found by Evgeny Astigeevich.
Reviewers: efriedma
Subscribers: sanjoy, javed.absar, llvm-commits, eastig
Differential Revision: https://reviews.llvm.org/D38557
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314935 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/CostModel/ARM/gep.ll | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/Analysis/CostModel/ARM/gep.ll b/test/Analysis/CostModel/ARM/gep.ll index 9d74da4c2d3..12e314e2407 100644 --- a/test/Analysis/CostModel/ARM/gep.ll +++ b/test/Analysis/CostModel/ARM/gep.ll @@ -83,5 +83,8 @@ define void @test_geps(i32 %i) { ;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x double>, <4 x double>* %c12 = getelementptr inbounds <4 x double>, <4 x double>* undef, i32 %i +;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i8, i8* + %d0 = getelementptr inbounds i8, i8* undef, i32 -1 + ret void } |