This is an archive of the discontinued LLVM Phabricator instance.

[clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)
ClosedPublic

Authored by JOE1994 on Jun 19 2023, 7:25 PM.

Details

Summary

Partial progress towards replacing CreateElementBitCast, as it no
longer does what its name suggests. Either replace its uses with
Address::withElementType(), or remove them if no longer needed.

Diff Detail

Event Timeline

JOE1994 created this revision.Jun 19 2023, 7:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 7:25 PM
JOE1994 requested review of this revision.Jun 19 2023, 7:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 7:25 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nikic added inline comments.Jun 20 2023, 12:44 AM
clang/lib/CodeGen/CGNonTrivialStruct.cpp
368–369

Only BC.getPointer() is used, so you can omit the withElementType.

clang/lib/CodeGen/MicrosoftCXXABI.cpp
3120–3121
3121–3124

Can drop this bitcast while here.

clang/lib/CodeGen/Targets/AArch64.cpp
523

Can inline this withElementType call into Address ctor.

barannikov88 added inline comments.Jun 20 2023, 2:34 AM
clang/lib/CodeGen/CGAtomic.cpp
1474

as it no longer emits anything.

JOE1994 updated this revision to Diff 534598.Jun 26 2023, 9:20 AM
  • Rebase onto latest main
  • Apply feedback from reviews
    • Rename AtomicInfo::emitCastToAtomicIntPointer to AtomicInfo::castToAtomicIntPointer
nikic added inline comments.Jun 27 2023, 1:00 AM
clang/lib/CodeGen/Targets/AArch64.cpp
522–523
JOE1994 updated this revision to Diff 534913.Jun 27 2023, 4:55 AM

Apply suggested change from nikic
(sorry, I missed it out in the previous update)

nikic accepted this revision.Jun 27 2023, 5:32 AM

LGTM

This revision is now accepted and ready to land.Jun 27 2023, 5:32 AM
barannikov88 accepted this revision.Jun 27 2023, 6:49 AM