This is an archive of the discontinued LLVM Phabricator instance.

fix bug for useless malloc elimination in CodeGenPrepare
ClosedPublic

Authored by drcut on Jul 19 2022, 2:41 PM.

Details

Summary

Put AllocationFn check before I->willReturn can allow CodeGenPrepare to remove useless malloc instruction

Diff Detail

Event Timeline

drcut created this revision.Jul 19 2022, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2022, 2:41 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
drcut requested review of this revision.Jul 19 2022, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2022, 2:41 PM
aeubanks accepted this revision.Jul 19 2022, 2:52 PM
aeubanks added inline comments.
llvm/test/CodeGen/Generic/dead-allocation.ll
19

add a newline at the end

This revision is now accepted and ready to land.Jul 19 2022, 2:52 PM
nikic added a subscriber: nikic.Jul 19 2022, 3:01 PM

Please put the test in llvm/test/Transforms/CodeGenPrepare instead and use update_test_checks.py. Omit the target triple if possible, which it likely is.

drcut updated this revision to Diff 445956.Jul 19 2022, 3:28 PM

Reformat the test file with update_test_checks.py

drcut added a comment.Jul 19 2022, 3:30 PM

Please put the test in llvm/test/Transforms/CodeGenPrepare instead and use update_test_checks.py. Omit the target triple if possible, which it likely is.

Thanks for the suggestions. The target triple is required for codegenprepare pass.

drcut updated this revision to Diff 445957.Jul 19 2022, 3:33 PM
This comment was removed by drcut.
This revision was landed with ongoing or failed builds.Jul 20 2022, 9:30 AM
This revision was automatically updated to reflect the committed changes.
craig.topper added inline comments.
llvm/test/Transforms/CodeGenPrepare/dead-allocation.ll
1 ↗(On Diff #446178)

This test needs REQUIRES: arm-registered-target otherwise it fails if the ARM target isn't built

dyung added a subscriber: dyung.Jul 20 2022, 10:54 AM

The test you added is failing on the PS4 Windows/Linux bots likely for the reason that Craig pointed out above. Please take a look and revert if you need time to investigate.

https://lab.llvm.org/buildbot/#/builders/139/builds/25268
https://lab.llvm.org/staging/#/builders/204/builds/1677

The test you added is failing on the PS4 Windows/Linux bots likely for the reason that Craig pointed out above. Please take a look and revert if you need time to investigate.

https://lab.llvm.org/buildbot/#/builders/139/builds/25268
https://lab.llvm.org/staging/#/builders/204/builds/1677

I'll go ahead and push the needed REQUIRES directive in a couple minutes