@spatel, are you OK with this fix? If Constants are given to foldExtractExtract, this Builder call:
Value *NewExt = Builder.CreateExtractElement(Shuf, CheapExtIndex);
will end up with a Constant instead of an Instruction, causing a crash on the later cast.
Please remove unnecessary text:
Function Attrs comment, dso_local, local_unnamed_addr, #0 (and corresponding attributes line).
I think you can just add this test to the existing extract-binop.ll test file instead of adding a new file.