Skip to content

Commit d87bf79

Browse files
authored
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - X86ISD::GlobalBaseReg and X86ISD::Wrapper/WrapperRIP nodes are never poison (#149854)
Fixes #149841
1 parent 069f0fe commit d87bf79

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45059,6 +45059,10 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4505945059
unsigned NumElts = DemandedElts.getBitWidth();
4506045060

4506145061
switch (Op.getOpcode()) {
45062+
case X86ISD::GlobalBaseReg:
45063+
case X86ISD::Wrapper:
45064+
case X86ISD::WrapperRIP:
45065+
return true;
4506245066
case X86ISD::BLENDI:
4506345067
case X86ISD::PSHUFD:
4506445068
case X86ISD::UNPCKL:

llvm/test/CodeGen/X86/pr149841.ll

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc < %s | FileCheck %s
3+
4+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
5+
target triple = "x86_64-unknown-linux-gnu"
6+
7+
%struct.bar = type { [5 x ptr] }
8+
9+
@global = external dso_local global %struct.bar
10+
11+
define i1 @foo(ptr %arg, i1 %arg1) {
12+
; CHECK-LABEL: foo:
13+
; CHECK: # %bb.0: # %bb
14+
; CHECK-NEXT: cmpq $global+1, %rdi
15+
; CHECK-NEXT: setne %al
16+
; CHECK-NEXT: andb %sil, %al
17+
; CHECK-NEXT: retq
18+
bb:
19+
#dbg_value(ptr @global, !3, !DIExpression(), !5)
20+
%icmp = icmp ne ptr %arg, getelementptr inbounds nuw (i8, ptr @global, i64 1)
21+
%select = select i1 %arg1, i1 %icmp, i1 false
22+
ret i1 %select
23+
}
24+
25+
!llvm.dbg.cu = !{!0}
26+
!llvm.module.flags = !{!2}
27+
28+
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
29+
!1 = !DIFile(filename: "x.c", directory: "/proc/self/cwd")
30+
!2 = !{i32 2, !"Debug Info Version", i32 3}
31+
!3 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !1)
32+
!4 = distinct !DISubprogram(name: "x", scope: null, file: !1, spFlags: DISPFlagDefinition, unit: !0)
33+
!5 = !DILocation(line: 0, scope: !4)
34+

0 commit comments

Comments
 (0)