[PATCH] D98884: [IR] Ignore bitcasts of function pointers which are only used as callees in callbase instruction

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 27 06:32:34 PDT 2021


madhur13490 added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:2147
+      for (User *BU : U->users())
+        SetCallBaseFastCallingConv(BU);
+      continue;
----------------
fhahn wrote:
> madhur13490 wrote:
> > rampitec wrote:
> > > arsenm wrote:
> > > > rampitec wrote:
> > > > > I do not see why a user of bitcast must be necessarily a call.
> > > > This could be a function in a constant initializer for a global
> > > Right, that's what I mean. It could be anything, even a compare.
> > Right, now I remember why I had dyn_cast and return in previous diff.
> Is there a test where the user is not a bit cast ? If not, please add one, similar for the other places that were changed back to `dyn_cast`
blockaddr-bitcast-fastcc.ll test address this. 





================
Comment at: llvm/test/Transforms/GlobalOpt/assumelike-bitcast-fastcc.ll:1
+; RUN: opt < %s -globalopt -S | FileCheck %s
+
----------------
This test case demonstates that fastcc is not set on function bar because its address taken value is true as hasAddressTaken() is used with its default param values. 



================
Comment at: llvm/test/Transforms/GlobalOpt/bitcast-call-argument-fastcc.ll:1
+; RUN:  opt < %s -globalopt -S | FileCheck %s
+
----------------
Test case when bitcast is a call argument.



================
Comment at: llvm/test/Transforms/GlobalOpt/blockaddr-bitcast-fastcc.ll:1
+; RUN: opt < %s -globalopt -S | FileCheck %s
+
----------------
This test case demonstrates that fastcc is now set on function "g" unlike trunk which skips this function. This test also covers non call bases users case.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98884



More information about the llvm-commits mailing list