[PATCH] D49384: [IPSCCP] Do not zap return if the return value is overdefined at any call site.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 09:47:07 PDT 2018


fhahn created this revision.
fhahn added reviewers: efriedma, davide, mssimpso.

We cannot zap a return if the return value at any of the function's call
sites is overdefined. This can happen, for example, when the return
value is used as a condition on for a branch and the return value is
still unknown when the branch is visited during ResolvedUndefsIn(). Then
the return value of the call site will be force to false.

Alternatively, we could mark functions as 'do not zap' if we go to
overdefined when handling call instructions, but the current approach
seems more direct.

In general, it is unfortunate that we fail to do the optimal thing
here. I guess we could force the return value to the known constant
after solving to at least replace the uses, but this seems like a slight
hack without much benefit.


https://reviews.llvm.org/D49384

Files:
  lib/Transforms/Scalar/SCCP.cpp
  test/Transforms/IPConstantProp/return-zapped.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49384.155709.patch
Type: text/x-patch
Size: 4133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180716/b191277f/attachment.bin>


More information about the llvm-commits mailing list