Skip to content

Commit 3c9eb3b

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: bdd9b15: Fix GEP lowering overflow issues
This change prevents usage of potentially negative values which are then zero-extended to 64 bits as indexes.
1 parent ceb9c26 commit 3c9eb3b

File tree

4 files changed

+11
-88
lines changed

4 files changed

+11
-88
lines changed

IGC/Compiler/CISACodeGen/GenIRLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2017-2025 Intel Corporation
3+
Copyright (C) 2017-2021 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -410,9 +410,6 @@ bool GEPLowering::simplifyGEP(BasicBlock &BB) const {
410410
auto *Idx = GEP->getOperand(1);
411411
if (auto *ZExt = dyn_cast<ZExtInst>(Idx)) {
412412
Idx = ZExt->getOperand(0);
413-
auto *Op = dyn_cast<OverflowingBinaryOperator>(Idx);
414-
if (Op && !Op->hasNoUnsignedWrap())
415-
continue;
416413
} else if (auto *SExt = dyn_cast<SExtInst>(Idx)) {
417414
Idx = SExt->getOperand(0);
418415
Operator *Opr = dyn_cast<Operator>(Idx);

IGC/Compiler/tests/GEPLowering/gep_simplification-typed-pointers.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2022-2025 Intel Corporation
3+
; Copyright (C) 2022-2024 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
@@ -36,21 +36,21 @@ define spir_kernel void @test_gep(i32 addrspace(1)* %dst, i32 addrspace(1)* %src
3636
case1:
3737
%simdLaneId16 = call i16 @llvm.genx.GenISA.simdLaneId()
3838
%simdLaneId = zext i16 %simdLaneId16 to i32
39-
%idbase1 = add nsw nuw i32 %Offset32, %simdLaneId
39+
%idbase1 = add nsw i32 %Offset32, %simdLaneId
4040
%id1.1 = zext i32 %idbase1 to i64
4141
%addr1.1 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.1
4242
%res1.0 = load i32, i32 addrspace(1)* %addr1.1, align 4
43-
%add11.1 = add nsw nuw i32 %idbase1, 4
43+
%add11.1 = add nsw i32 %idbase1, 4
4444
%id1.2 = zext i32 %add11.1 to i64
4545
%addr1.2 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.2
4646
%res1.1 = load i32, i32 addrspace(1)* %addr1.2, align 4
4747
%sum1.0 = add nsw i32 %res1.0, %res1.1
48-
%add11.2 = add nsw nuw i32 %idbase1, 8
48+
%add11.2 = add nsw i32 %idbase1, 8
4949
%id1.3 = zext i32 %add11.2 to i64
5050
%addr1.3 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.3
5151
%res1.2 = load i32, i32 addrspace(1)* %addr1.3, align 4
5252
%sum1.1 = add nsw i32 %sum1.0, %res1.2
53-
%add11.3 = add nsw nuw i32 %idbase1, 12
53+
%add11.3 = add nsw i32 %idbase1, 12
5454
%id1.4 = zext i32 %add11.3 to i64
5555
%addr1.4 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.4
5656
%res1.3 = load i32, i32 addrspace(1)* %addr1.4, align 4

IGC/Compiler/tests/GEPLowering/gep_simplification.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2022-2025 Intel Corporation
3+
; Copyright (C) 2022-2024 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
@@ -36,21 +36,21 @@ define spir_kernel void @test_gep(i32 addrspace(1)* %dst, i32 addrspace(1)* %src
3636
case1:
3737
%simdLaneId16 = call i16 @llvm.genx.GenISA.simdLaneId()
3838
%simdLaneId = zext i16 %simdLaneId16 to i32
39-
%idbase1 = add nsw nuw i32 %Offset32, %simdLaneId
39+
%idbase1 = add nsw i32 %Offset32, %simdLaneId
4040
%id1.1 = zext i32 %idbase1 to i64
4141
%addr1.1 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.1
4242
%res1.0 = load i32, i32 addrspace(1)* %addr1.1, align 4
43-
%add11.1 = add nsw nuw i32 %idbase1, 4
43+
%add11.1 = add nsw i32 %idbase1, 4
4444
%id1.2 = zext i32 %add11.1 to i64
4545
%addr1.2 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.2
4646
%res1.1 = load i32, i32 addrspace(1)* %addr1.2, align 4
4747
%sum1.0 = add nsw i32 %res1.0, %res1.1
48-
%add11.2 = add nsw nuw i32 %idbase1, 8
48+
%add11.2 = add nsw i32 %idbase1, 8
4949
%id1.3 = zext i32 %add11.2 to i64
5050
%addr1.3 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.3
5151
%res1.2 = load i32, i32 addrspace(1)* %addr1.3, align 4
5252
%sum1.1 = add nsw i32 %sum1.0, %res1.2
53-
%add11.3 = add nsw nuw i32 %idbase1, 12
53+
%add11.3 = add nsw i32 %idbase1, 12
5454
%id1.4 = zext i32 %add11.3 to i64
5555
%addr1.4 = getelementptr inbounds i32, i32 addrspace(1)* %src, i64 %id1.4
5656
%res1.3 = load i32, i32 addrspace(1)* %addr1.4, align 4

IGC/Compiler/tests/GEPLowering/unsigned-overflow.ll

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)