[llvm] r212201 - AArch64: Re-enable AArch64AddressTypePromotion

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Jul 2 11:17:40 PDT 2014


Author: dexonsmith
Date: Wed Jul  2 13:17:40 2014
New Revision: 212201

URL: http://llvm.org/viewvc/llvm-project?rev=212201&view=rev
Log:
AArch64: Re-enable AArch64AddressTypePromotion

This reverts commits r212189 and r212190.

While this pass was accidentally disabled (until r212073), r205437
slipped in a use of `auto` that should have been `auto&`.

This fixes PR20188.

Added:
    llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion-assertion.ll
Modified:
    llvm/trunk/lib/Target/AArch64/AArch64AddressTypePromotion.cpp
    llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
    llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion.ll

Modified: llvm/trunk/lib/Target/AArch64/AArch64AddressTypePromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64AddressTypePromotion.cpp?rev=212201&r1=212200&r2=212201&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64AddressTypePromotion.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64AddressTypePromotion.cpp Wed Jul  2 13:17:40 2014
@@ -384,7 +384,7 @@ void AArch64AddressTypePromotion::mergeS
       if (ToRemove.count(Inst))
         continue;
       bool inserted = false;
-      for (auto Pt : CurPts) {
+      for (auto &Pt : CurPts) {
         if (DT.dominates(Inst, Pt)) {
           DEBUG(dbgs() << "Replace all uses of:\n" << *Pt << "\nwith:\n"
                        << *Inst << '\n');

Modified: llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp?rev=212201&r1=212200&r2=212201&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp Wed Jul  2 13:17:40 2014
@@ -155,6 +155,8 @@ bool AArch64PassConfig::addPreISel() {
     addPass(createAArch64PromoteConstantPass());
   if (TM->getOptLevel() != CodeGenOpt::None)
     addPass(createGlobalMergePass(TM));
+  if (TM->getOptLevel() != CodeGenOpt::None)
+    addPass(createAArch64AddressTypePromotionPass());
 
   return false;
 }

Added: llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion-assertion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion-assertion.ll?rev=212201&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion-assertion.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion-assertion.ll Wed Jul  2 13:17:40 2014
@@ -0,0 +1,55 @@
+; RUN: llc -O3 -mcpu=cortex-a53 -mtriple=aarch64--linux-gnu %s -o - | FileCheck %s
+; PR20188: don't crash when merging sexts.
+
+; CHECK: foo:
+define void @foo() unnamed_addr align 2 {
+entry:
+  br label %invoke.cont145
+
+invoke.cont145:
+  %or.cond = and i1 undef, false
+  br i1 %or.cond, label %if.then274, label %invoke.cont145
+
+if.then274:
+  %0 = load i32* null, align 4
+  br i1 undef, label %invoke.cont291, label %if.else313
+
+invoke.cont291:
+  %idxprom.i.i.i605 = sext i32 %0 to i64
+  %arrayidx.i.i.i607 = getelementptr inbounds double* undef, i64 %idxprom.i.i.i605
+  %idxprom.i.i.i596 = sext i32 %0 to i64
+  %arrayidx.i.i.i598 = getelementptr inbounds double* undef, i64 %idxprom.i.i.i596
+  br label %if.end356
+
+if.else313:
+  %cmp314 = fcmp olt double undef, 0.000000e+00
+  br i1 %cmp314, label %invoke.cont317, label %invoke.cont353
+
+invoke.cont317:
+  br i1 undef, label %invoke.cont326, label %invoke.cont334
+
+invoke.cont326:
+  %idxprom.i.i.i587 = sext i32 %0 to i64
+  %arrayidx.i.i.i589 = getelementptr inbounds double* undef, i64 %idxprom.i.i.i587
+  %sub329 = fsub fast double undef, undef
+  br label %invoke.cont334
+
+invoke.cont334:
+  %lo.1 = phi double [ %sub329, %invoke.cont326 ], [ undef, %invoke.cont317 ]
+  br i1 undef, label %invoke.cont342, label %if.end356
+
+invoke.cont342:
+  %idxprom.i.i.i578 = sext i32 %0 to i64
+  %arrayidx.i.i.i580 = getelementptr inbounds double* undef, i64 %idxprom.i.i.i578
+  br label %if.end356
+
+invoke.cont353:
+  %idxprom.i.i.i572 = sext i32 %0 to i64
+  %arrayidx.i.i.i574 = getelementptr inbounds double* undef, i64 %idxprom.i.i.i572
+  br label %if.end356
+
+if.end356:
+  %lo.2 = phi double [ 0.000000e+00, %invoke.cont291 ], [ %lo.1, %invoke.cont342 ], [ undef, %invoke.cont353 ], [ %lo.1, %invoke.cont334 ]
+  call void null(i32 %0, double %lo.2)
+  unreachable
+}

Modified: llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion.ll?rev=212201&r1=212200&r2=212201&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/aarch64-address-type-promotion.ll Wed Jul  2 13:17:40 2014
@@ -1,5 +1,4 @@
 ; RUN: llc < %s -o - | FileCheck %s
-; XFAIL: *
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32:64"
 target triple = "arm64-apple-macosx10.9"





More information about the llvm-commits mailing list