Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalStatus] Skip non-pointer dead constant users
Constant expressions with a non-pointer result type used an early exit that bypassed the later dead constant user check, and resulted in different optimization outcomes depending on whether dead users were present or not. This fixes the issue reported in https://reviews.llvm.org/D117223#3287039.
- Loading branch information
Showing
2 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -S -passes='function(early-cse),globalopt' < %s | FileCheck %s | ||
; RUN: opt -S -passes='function(early-cse)' < %s | opt -S -passes=globalopt | FileCheck %s | ||
|
||
@g = internal global [6 x i16*] undef | ||
|
||
define void @test1() { | ||
; CHECK-LABEL: @test1( | ||
; CHECK-NEXT: ret void | ||
; | ||
%xor4 = xor i32 zext (i1 icmp ne (i8* getelementptr (i8, i8* bitcast ([6 x i16*]* @g to i8*), i64 3), i8* null) to i32), 0 | ||
%t0 = load i16*, i16** bitcast (i8* getelementptr (i8, i8* bitcast ([6 x i16*]* @g to i8*), i64 3) to i16**), align 1 | ||
%t1 = load i16, i16* %t0, align 1 | ||
ret void | ||
} | ||
|
||
define void @test2() { | ||
; CHECK-LABEL: @test2( | ||
; CHECK-NEXT: ret void | ||
; | ||
store i16* null, i16** getelementptr inbounds ([6 x i16*], [6 x i16*]* @g, i32 0, i32 5) | ||
ret void | ||
} |