[llvm] r278203 - [x86] Fix a bug in the auto-upgrade from r276416 where we failed to give

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 00:41:26 PDT 2016


Author: chandlerc
Date: Wed Aug 10 02:41:26 2016
New Revision: 278203

URL: http://llvm.org/viewvc/llvm-project?rev=278203&view=rev
Log:
[x86] Fix a bug in the auto-upgrade from r276416 where we failed to give
a sufficiently low alignment for the IR load created.

There is no test case because we don't have any test cases for the *IR*
produced by the autoupgrade, only the x86 assembly, and it happens that
the x86 assembly for this intrinsic as it is tested in the autoupgrade
path just happens to not produce a separate load instruction where we
might have observed the alignment.

I'm going to follow up on the original commit to suggest getting
IR-level testing in addition to the asm level testing here so that we
can see and test these kinds of issues. We might never get an x86
instruction out with an alignment constraint, but we could stil
miscompile code by folding against the alignment marked on (or inferred
for in this case) the load.

Modified:
    llvm/trunk/lib/IR/AutoUpgrade.cpp

Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=278203&r1=278202&r2=278203&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Wed Aug 10 02:41:26 2016
@@ -951,7 +951,7 @@ void llvm::UpgradeIntrinsicCall(CallInst
       Type *VT = VectorType::get(EltTy, NumSrcElts);
       Value *Op = Builder.CreatePointerCast(CI->getArgOperand(0),
                                             PointerType::getUnqual(VT));
-      Value *Load = Builder.CreateLoad(VT, Op);
+      Value *Load = Builder.CreateAlignedLoad(Op, 1);
       if (NumSrcElts == 2)
         Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
                                           { 0, 1, 0, 1 });




More information about the llvm-commits mailing list