[llvm] r288834 - GlobalISel: stop the legalizer from trying to handle oddly-sized types.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 10:38:29 PST 2016


Author: tnorthover
Date: Tue Dec  6 12:38:29 2016
New Revision: 288834

URL: http://llvm.org/viewvc/llvm-project?rev=288834&view=rev
Log:
GlobalISel: stop the legalizer from trying to handle oddly-sized types.

It'll almost immediately fail because it always tries to half/double the size
until it finds a legal one. Unfortunately, this triggers an assertion
preventing the DAG fallback from being possible.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll

Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp?rev=288834&r1=288833&r2=288834&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp Tue Dec  6 12:38:29 2016
@@ -71,6 +71,11 @@ LegalizerInfo::getAction(const InstrAspe
   // These *have* to be implemented for now, they're the fundamental basis of
   // how everything else is transformed.
 
+  // Nothing is going to go well with types that aren't a power of 2 yet, so
+  // don't even try because we might make things worse.
+  if (!isPowerOf2_64(Aspect.Type.getSizeInBits()))
+      return std::make_pair(Unsupported, LLT());
+
   // FIXME: the long-term plan calls for expansion in terms of load/store (if
   // they're not legal).
   if (Aspect.Opcode == TargetOpcode::G_SEQUENCE ||

Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll?rev=288834&r1=288833&r2=288834&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll Tue Dec  6 12:38:29 2016
@@ -42,6 +42,7 @@ define [1 x double] @constant() {
   ; PHI. If so, we cannot complete the G_PHI and mustn't try or bad things
   ; happen.
 ; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for pending_phis
+; FALLBACK-WITH-REPORT-OUT-LABEL: pending_phis:
 define i32 @pending_phis(i1 %tst, i32 %val, i32* %addr) {
   br i1 %tst, label %true, label %false
 
@@ -57,3 +58,10 @@ false:
   br label %end
 
 }
+
+; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for odd_type
+; FALLBACK-WITH-REPORT-OUT-LABEL: odd_type:
+define void @odd_type(i42* %addr) {
+  %val42 = load i42, i42* %addr
+  ret void
+}




More information about the llvm-commits mailing list