This is an archive of the discontinued LLVM Phabricator instance.

[ConstantFold][SVE] Fix constant folding for scalable vector unary operations.
ClosedPublic

Authored by huihuiz on Jan 29 2020, 5:47 PM.

Details

Summary

Similar to issue D71445. Scalable vector should not be evaluated element by element.
Add support to handle scalable vector UndefValue.

Diff Detail

Event Timeline

huihuiz created this revision.Jan 29 2020, 5:47 PM

current upstream crash with: llvm/lib/IR/Value.cpp:404: void llvm::Value::doRAUW(llvm::Value *, llvm::Value::ReplaceMetadataUses): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.

take this test.ll

define <vscale x 2 x double> @fneg(<vscale x 2 x double> %val) {
  %r = fneg <vscale x 2 x double> undef
  ret <vscale x 2 x double> %r
}

run: opt -S -constprop test.ll -o -

This revision is now accepted and ready to land.Jan 29 2020, 6:07 PM
This revision was automatically updated to reflect the committed changes.