[llvm] r214177 - CodeGenPrep: fall back to MVT::Other if instruction's type isn't an EVT.
Tim Northover
tnorthover at apple.com
Tue Jul 29 03:20:23 PDT 2014
Author: tnorthover
Date: Tue Jul 29 05:20:22 2014
New Revision: 214177
URL: http://llvm.org/viewvc/llvm-project?rev=214177&view=rev
Log:
CodeGenPrep: fall back to MVT::Other if instruction's type isn't an EVT.
The test being performed is just an approximation anyway, so it really
shouldn't crash when things don't go entirely as expected.
Should fix PR20474.
Added:
llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/
llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/lit.local.cfg
llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/trunc-weird-user.ll
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=214177&r1=214176&r2=214177&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Tue Jul 29 05:20:22 2014
@@ -662,10 +662,13 @@ SinkShiftAndTruncate(BinaryOperator *Shi
if (!ISDOpcode)
continue;
- // If the use is actually a legal node, there will not be an implicit
- // truncate.
+ // If the use is actually a legal node, there will not be an
+ // implicit truncate.
+ // FIXME: always querying the result type is just an
+ // approximation; some nodes' legality is determined by the
+ // operand or other means. There's no good way to find out though.
if (TLI.isOperationLegalOrCustom(ISDOpcode,
- EVT::getEVT(TruncUser->getType())))
+ EVT::getEVT(TruncUser->getType(), true)))
continue;
// Don't bother for PHI nodes.
Added: llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/lit.local.cfg?rev=214177&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/lit.local.cfg (added)
+++ llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/lit.local.cfg Tue Jul 29 05:20:22 2014
@@ -0,0 +1,3 @@
+if not 'AArch64' in config.root.targets:
+ config.unsupported = True
+
Added: llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/trunc-weird-user.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/trunc-weird-user.ll?rev=214177&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/trunc-weird-user.ll (added)
+++ llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/trunc-weird-user.ll Tue Jul 29 05:20:22 2014
@@ -0,0 +1,17 @@
+; RUN: opt -S -codegenprepare -mtriple=arm64-apple-ios7.0 %s | FileCheck %s
+
+%foo = type { i8 }
+
+define %foo @test_merge(i32 %in) {
+; CHECK-LABEL: @test_merge
+
+ ; CodeGenPrepare was requesting the EVT for { i8 } to determine
+ ; whether the insertvalue user of the trunc was legal. This
+ ; asserted.
+
+; CHECK: insertvalue %foo undef, i8 %byte, 0
+ %lobit = lshr i32 %in, 31
+ %byte = trunc i32 %lobit to i8
+ %struct = insertvalue %foo undef, i8 %byte, 0
+ ret %"foo" %struct
+}
More information about the llvm-commits
mailing list