llvm.org GIT mirror llvm / 5b475f7
Merging r322056: ------------------------------------------------------------------------ r322056 | skatkov | 2018-01-08 20:37:06 -0800 (Mon, 08 Jan 2018) | 13 lines [CGP] Fix Complex addressing mode for offset If the offset is differ in two addressing mode we can continue only if ScaleReg is not set due to we will use it as merge of different offsets. It should fix PR35799 and PR35805. Reviewers: john.brawn, reames Reviewed By: reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41227 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322645 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 1 year, 7 months ago
2 changed file(s) with 25 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
26992699 // we still need to collect it due to original value is different.
27002700 // And later we will need all original values as anchors during
27012701 // finding the common Phi node.
2702 // We also must reject the case when base offset is different and
2703 // scale reg is not null, we cannot handle this case due to merge of
2704 // different offsets will be used as ScaleReg.
27022705 if (DifferentField != ExtAddrMode::MultipleFields &&
2703 DifferentField != ExtAddrMode::ScaleField) {
2706 DifferentField != ExtAddrMode::ScaleField &&
2707 (DifferentField != ExtAddrMode::BaseOffsField ||
2708 !NewAddrMode.ScaledReg)) {
27042709 AddrModes.emplace_back(NewAddrMode);
27052710 return true;
27062711 }
0 ; RUN: opt -S -codegenprepare -disable-complex-addr-modes=false -addr-sink-new-select=true %s | FileCheck %s --check-prefix=CHECK
1 target datalayout =
2 "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
3 target triple = "x86_64-unknown-linux-gnu"
4
5 ; Select when both offset and scale reg are present.
6 define i64 @test1(i1 %c, i64* %b, i64 %scale) {
7 ; CHECK-LABEL: @test1
8 entry:
9 ; CHECK-LABEL: entry:
10 %g = getelementptr inbounds i64, i64* %b, i64 %scale
11 %g1 = getelementptr inbounds i64, i64* %g, i64 8
12 %g2 = getelementptr inbounds i64, i64* %g, i64 16
13 %s = select i1 %c, i64* %g1, i64* %g2
14 ; CHECK-NOT: sunkaddr
15 %v = load i64 , i64* %s, align 8
16 ret i64 %v
17 }
18