[llvm-bugs] [Bug 49104] New: [Attributor] Replace noundef value with undef
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 8 18:12:34 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49104
Bug ID: 49104
Summary: [Attributor] Replace noundef value with undef
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: zequanwu at google.com
CC: llvm-bugs at lists.llvm.org
Here is the reduced IR:
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.hash_table = type { %struct.hash_node*, i64, i64, i64 }
%struct.hash_node = type { i64, i8*, i64, i8* }
%union.label = type { %struct.anon }
%struct.anon = type { i32, i32, i64, i64, i64, i64, i8*, i8*, i8*, i8*, i32,
i32, i32 }
@ltab = external dso_local global %struct.hash_table, align 8
define hidden i32 @lookup_label() {
entry:
br label %if.end
if.end: ; preds = %entry
%call = call %union.label* @find_label(i1 false)
ret i32 undef
}
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
define internal %union.label* @find_label(i1 %create) {
entry:
%create.addr = alloca i8, align 1
%frombool = zext i1 %create to i8
store i8 %frombool, i8* %create.addr, align 1
br label %cond.true
cond.true: ; preds = %entry
br label %cond.end
cond.end: ; preds = %cond.true
br i1 undef, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %cond.end
%0 = load i8, i8* %create.addr, align 1, !range !0
%tobool2 = trunc i8 %0 to i1
br i1 %tobool2, label %if.end, label %if.then
if.then: ; preds = %lor.lhs.false,
%cond.end
ret %union.label* undef
if.end: ; preds = %lor.lhs.false
br label %if.then3
if.then3: ; preds = %if.end
%call4 = call i8* @nasm_malloc(i64 11264)
ret %union.label* undef
}
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0
define hidden i1 @declare_label() {
entry:
%call = call %union.label* @find_label(i1 true)
store %union.label* %call, %union.label** undef, align 8
ret i1 undef
}
declare hidden i32 @init_labels()
declare i8* @nasm_malloc(i64)
declare dso_local void @init_block()
; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg)
#1
declare i8** @hash_find()
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8*
noalias nocapture readonly, i64, i1 immarg) #0
attributes #0 = { argmemonly nofree nosync nounwind willreturn }
attributes #1 = { argmemonly nofree nosync nounwind willreturn writeonly }
!0 = !{i8 0, i8 2}
commands:
opt -O2 --attributor-enable=cgscc reduced.ll
Debug dumpping shows:
[Attributor] Delete at least 0 functions and 0 blocks and 0 instructions and 2
uses
Use i1 undef in call fastcc void @find_label(i1 noundef true) instead of i1
true
Use i1 true in br i1 %create, label %if.then3, label %if.then instead of i1
%create
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210209/6dde5500/attachment-0001.html>
More information about the llvm-bugs
mailing list