erichkeane added a comment.

Either this or D108453 <https://reviews.llvm.org/D108453> (which were committed 
together!) caused this assert according to my git-bisect: 
https://godbolt.org/z/4rqYKfW7K

NOTE that this fails in a lit-test for me, clang CodeGen/ifunc.c (though my 
downstream seems to run the verifier even with -emit-llvm, so you might need to 
just swap it to an -emit-obj to get this to repro).

If you cannot fix this quickly, let me know and I can revert it.

IR for this looks like:

  [ekeane1@scsel-clx-24 llvm]$ 
/localdisk2/ekeane1/workspaces/xmain-web/builds/xmainefi2linux_debug/llvm/bin/clang
 -cc1 -internal-isystem 
/localdisk2/ekeane1/workspaces/xmain-web/builds/xmainefi2linux_debug/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -triple i386-unknown-linux-gnu -emit-llvm -o - 
/localdisk2/ekeane1/workspaces/xmain-web/llvm/clang/test/CodeGen/ifunc.c 
-disable-llvm-passes
  ; ModuleID = 
'/localdisk2/ekeane1/workspaces/xmain-web/llvm/clang/test/CodeGen/ifunc.c'
  source_filename = 
"/localdisk2/ekeane1/workspaces/xmain-web/llvm/clang/test/CodeGen/ifunc.c"
  target datalayout = 
"e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
  target triple = "i386-unknown-linux-gnu"
  
  @global = global i32 0, align 4
  
  @foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
  @goo = ifunc void (), bitcast (i8* ()* @goo_ifunc to void ()* ()*)
  
  ; Function Attrs: noinline nounwind optnone
  define internal i32 (i32)* @foo_ifunc() #0 {
  entry:
    %0 = load i32, i32* @global, align 4
    %tobool = icmp ne i32 %0, 0
    %1 = zext i1 %tobool to i64
    %cond = select i1 %tobool, i32 (i32)* @f1, i32 (i32)* @f2
    ret i32 (i32)* %cond
  }
  
  ; Function Attrs: noinline nounwind optnone
  define dso_local i32 @bar() #0 {
  entry:
    %call = call i32 @foo(i32 noundef 1)
    ret i32 %call
  }
  
  ; Function Attrs: noinline nounwind optnone
  define dso_local void @bar2() #0 {
  entry:
    call void @goo()
    ret void
  }
  
  ; Function Attrs: noinline nounwind optnone
  define dso_local i8* @goo_ifunc() #0 {
  entry:
    ret i8* null
  }
  
  ; Function Attrs: noinline nounwind optnone
  define internal i32 @f1(i32 noundef %i) #0 {
  entry:
    %i.addr = alloca i32, align 4
    store i32 %i, i32* %i.addr, align 4
    %0 = load i32, i32* %i.addr, align 4
    %add = add nsw i32 %0, 1
    ret i32 %add
  }
  
  ; Function Attrs: noinline nounwind optnone
  define internal i32 @f2(i32 noundef %i) #0 {
  entry:
    %i.addr = alloca i32, align 4
    store i32 %i, i32* %i.addr, align 4
    %0 = load i32, i32* %i.addr, align 4
    %add = add nsw i32 %0, 2
    ret i32 %add
  }
  
  attributes #0 = { noinline nounwind optnone "frame-pointer"="none" 
"min-legal-vector-width"="0" "no-trapping-math"="true" 
"stack-protector-buffer-size"="8" "target-features"="+cx8,+x87" }
  
  !llvm.module.flags = !{!0, !1}
  !llvm.ident = !{!2}
  
  !0 = !{i32 1, !"NumRegisterParameters", i32 0}
  !1 = !{i32 1, !"wchar_size", i32 4}
  !2 = !{!"Intel(R) oneAPI DPC++/C++ Compiler 2022.1.0 (2022.x.0.YYYYMMDD)"}




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105169/new/

https://reviews.llvm.org/D105169

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to