[PATCH] D16083: [bugpoint] Teach bugpoint to reduce MDNodes

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 13:33:36 PST 2016


loladiro created this revision.
loladiro added reviewers: dexonsmith, tejohnson.
loladiro added a subscriber: llvm-commits.
Herald added a reviewer: tstellarAMD.
Herald added a subscriber: arsenm.

This is essentially pretty simple, it first walks through the the contents of
the module starting from instructions/named metadata to find all MDNodes and
then does a standard list reduction in order to cut down the list of which
metadata nodes to keep. To actually implement the MDNode removal, it creates
a temporary Node, inserts it into the VMap, and laters RAUWs that to null.
This works great, except that the verifier really doesn't like null values in
some MDTuples. Thus, we need some extra logic to also fix up any MDTuples,
which would otherwise contain a null.

The one ugly point here is that in order to do the above, we need to allow
temporary metadata during cloning. To make this possible, I had to modify
CloneModule and CloneFunctionInto, in order to allow passing RemapFlags
through. I think this API change is fine, but if there's a different way
to accomplish the same thing, I'd be happy to change that. Naturally, I can
split that part out into a separate review.

There's also a small fix to pass through AllowTemps recursively in
resolveCylces, which was needed to make the above work.

http://reviews.llvm.org/D16083

Files:
  include/llvm/Transforms/Utils/Cloning.h
  lib/ExecutionEngine/Orc/IndirectionUtils.cpp
  lib/IR/Metadata.cpp
  lib/Target/AMDGPU/AMDGPUOpenCLImageTypeLoweringPass.cpp
  lib/Transforms/Utils/CloneFunction.cpp
  lib/Transforms/Utils/CloneModule.cpp
  test/BugPoint/metadata.ll
  tools/bugpoint-passes/TestPasses.cpp
  tools/bugpoint/CrashDebugger.cpp
  tools/bugpoint/ListReducer.h
  unittests/Transforms/Utils/Cloning.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16083.44545.patch
Type: text/x-patch
Size: 21686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160111/354d8bff/attachment-0001.bin>


More information about the llvm-commits mailing list