This is an archive of the discontinued LLVM Phabricator instance.

[GISel]: Pattern Match helpers for MachineInstructions
ClosedPublic

Authored by aditya_nandakumar on Jan 23 2018, 1:03 PM.

Details

Summary

Splitting the pattern matching part from https://reviews.llvm.org/D41373
This includes a few additional MIRBuilder build helper templates that are instantiated in the PatternMatch unit test.

Diff Detail

Event Timeline

Was missing the CMake update to the unit test. Fixed.

bogner accepted this revision.Jan 24 2018, 5:10 PM

I find the naming conventions for the matchers kind of weird, but I see that they're meant to be familiar to users of the IR level matcher APIs so I suppose they at least make sense. Let's get this in and start using it.

include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
1

IIRC someone was saying they wanted to use this outside of GISel as well. Should this be hoisted up into CodeGen rather than being part of GISel?

269–273

Remove these comments. It'll be obvious what's missing as people start using these APIs, and people can just add things as needed.

This revision is now accepted and ready to land.Jan 24 2018, 5:10 PM
include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
1

Yes - I think Hal mentioned that. However, there is only GISel matchers right now, and I figured (also due to the GISel Utils include in this file), we can move the file later when there's a use case for it.

269–273

Good point. Will remove.

Committed in r323400.
Thanks for the review.

vsk added a subscriber: vsk.Jan 25 2018, 6:16 PM

Hey @aditya_nandakumar, this has been failing since it was committed our stage2 + modules bots. See rdar://36892215, http://lab.llvm.org:8080/green/view/Clang/job/clang-stage2-configure-Rlto/23858/:

FAILED: bin/llvm-profdata
: && /Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/host-compiler/bin/clang++ -fno-stack-protector -fno-common -Wno-profile-instr-unprofiled -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/clang-build/Build/module.cache -fcxx-modules -gmodules -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -flto -O2 -gline-tables-only -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -flto -Wl,-dead_strip -Wl,-object_path_lto,/Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/clang-build/Build/tools/llvm-profdata/./llvm-profdata-lto.o tools/llvm-profdata/CMakeFiles/llvm-profdata.dir/llvm-profdata.cpp.o -o bin/llvm-profdata lib/libLLVMCore.a lib/libLLVMProfileData.a lib/libLLVMSupport.a lib/libLLVMCore.a lib/libLLVMBinaryFormat.a lib/libLLVMSupport.a -lz -lcurses -lm lib/libLLVMDemangle.a -Wl,-rpath,@loader_path/../lib && cd /Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/clang-build/Build/tools/llvm-profdata && xcrun dsymutil /Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/clang-build/Build/bin/llvm-profdata && xcrun strip -Sxl /Users/buildslave/jenkins/workspace/clang-stage2-configure-Rlto/clang-build/Build/bin/llvm-profdata
ld: Linking globals named '_ZN4llvm14MIPatternMatch6m_ICstERy': symbol multiply defined! for architecture x86_64

vsk added inline comments.Jan 25 2018, 6:17 PM
include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
57

Does this need to be static inline?